Bump requirements.
This commit is contained in:
parent
67856d8bcb
commit
6b95217da8
28
pogrep.py
28
pogrep.py
|
@ -18,8 +18,7 @@ from tabulate import tabulate
|
||||||
|
|
||||||
|
|
||||||
def get_colors():
|
def get_colors():
|
||||||
"""Just returns the CSI codes for red, green, magenta, and reset color.
|
"""Just returns the CSI codes for red, green, magenta, and reset color."""
|
||||||
"""
|
|
||||||
try:
|
try:
|
||||||
curses.setupterm()
|
curses.setupterm()
|
||||||
fg_color = curses.tigetstr("setaf") or curses.tigetstr("setf") or ""
|
fg_color = curses.tigetstr("setaf") or curses.tigetstr("setf") or ""
|
||||||
|
@ -60,8 +59,7 @@ def colorize(text, pattern, prefixes=()):
|
||||||
|
|
||||||
|
|
||||||
class Match(NamedTuple):
|
class Match(NamedTuple):
|
||||||
"""Represents a string found in a po file.
|
"""Represents a string found in a po file."""
|
||||||
"""
|
|
||||||
|
|
||||||
file: str
|
file: str
|
||||||
line: int
|
line: int
|
||||||
|
@ -75,8 +73,7 @@ def find_in_po(
|
||||||
not_in_source: bool = False,
|
not_in_source: bool = False,
|
||||||
in_translation: bool = False,
|
in_translation: bool = False,
|
||||||
) -> Tuple[List[str], List[Match]]:
|
) -> Tuple[List[str], List[Match]]:
|
||||||
"""Find the given pattern in the given list of paths or files.
|
"""Find the given pattern in the given list of paths or files."""
|
||||||
"""
|
|
||||||
results = []
|
results = []
|
||||||
errors = []
|
errors = []
|
||||||
for filename in path:
|
for filename in path:
|
||||||
|
@ -97,10 +94,12 @@ def find_in_po(
|
||||||
|
|
||||||
|
|
||||||
def display_results(
|
def display_results(
|
||||||
matches: Sequence[Match], pattern: str, line_number: bool, files_with_matches: bool,
|
matches: Sequence[Match],
|
||||||
|
pattern: str,
|
||||||
|
line_number: bool,
|
||||||
|
files_with_matches: bool,
|
||||||
):
|
):
|
||||||
"""Display matches as a colorfull table.
|
"""Display matches as a colorfull table."""
|
||||||
"""
|
|
||||||
files = {match.file for match in matches}
|
files = {match.file for match in matches}
|
||||||
if files_with_matches: # Just print filenames
|
if files_with_matches: # Just print filenames
|
||||||
for file in files:
|
for file in files:
|
||||||
|
@ -160,8 +159,7 @@ def process_path(path: Sequence[str], recursive: bool) -> List[str]:
|
||||||
|
|
||||||
|
|
||||||
def parse_args() -> argparse.Namespace:
|
def parse_args() -> argparse.Namespace:
|
||||||
"""Parse command line arguments.
|
"""Parse command line arguments."""
|
||||||
"""
|
|
||||||
parser = argparse.ArgumentParser(description="Find translated words.")
|
parser = argparse.ArgumentParser(description="Find translated words.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-F",
|
"-F",
|
||||||
|
@ -237,8 +235,7 @@ def parse_args() -> argparse.Namespace:
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Command line entry point.
|
"""Command line entry point."""
|
||||||
"""
|
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
if args.fixed_strings:
|
if args.fixed_strings:
|
||||||
args.pattern = regex.escape(args.pattern)
|
args.pattern = regex.escape(args.pattern)
|
||||||
|
@ -254,7 +251,10 @@ def main():
|
||||||
for error in errors:
|
for error in errors:
|
||||||
print(error, file=sys.stderr)
|
print(error, file=sys.stderr)
|
||||||
display_results(
|
display_results(
|
||||||
results, args.pattern, args.line_number, args.files_with_matches,
|
results,
|
||||||
|
args.pattern,
|
||||||
|
args.line_number,
|
||||||
|
args.files_with_matches,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
-r requirements.txt
|
||||||
black
|
black
|
||||||
flake8
|
flake8
|
||||||
isort
|
isort
|
||||||
|
|
|
@ -4,41 +4,109 @@
|
||||||
#
|
#
|
||||||
# pip-compile requirements-dev.in
|
# pip-compile requirements-dev.in
|
||||||
#
|
#
|
||||||
appdirs==1.4.4 # via black, virtualenv
|
appdirs==1.4.4
|
||||||
astroid==2.4.2 # via pylint
|
# via
|
||||||
attrs==19.3.0 # via black, pytest
|
# black
|
||||||
black==19.10b0 # via -r requirements-dev.in
|
# virtualenv
|
||||||
click==7.1.2 # via black, pip-tools
|
astroid==2.5.1
|
||||||
distlib==0.3.0 # via virtualenv
|
# via pylint
|
||||||
filelock==3.0.12 # via tox, virtualenv
|
attrs==20.3.0
|
||||||
flake8==3.8.3 # via -r requirements-dev.in
|
# via pytest
|
||||||
isort==4.3.21 # via -r requirements-dev.in, pylint
|
black==20.8b1
|
||||||
lazy-object-proxy==1.4.3 # via astroid
|
# via -r requirements-dev.in
|
||||||
mccabe==0.6.1 # via flake8, pylint
|
click==7.1.2
|
||||||
more-itertools==8.4.0 # via pytest
|
# via
|
||||||
mypy-extensions==0.4.3 # via mypy
|
# black
|
||||||
mypy==0.782 # via -r requirements-dev.in
|
# pip-tools
|
||||||
packaging==20.4 # via pytest, tox
|
distlib==0.3.1
|
||||||
pathspec==0.8.0 # via black
|
# via virtualenv
|
||||||
pip-tools==5.2.1 # via -r requirements-dev.in
|
filelock==3.0.12
|
||||||
pluggy==0.13.1 # via pytest, tox
|
# via
|
||||||
polib==1.1.0 # via -r requirements-dev.in
|
# tox
|
||||||
py==1.8.1 # via pytest, tox
|
# virtualenv
|
||||||
pycodestyle==2.6.0 # via flake8
|
flake8==3.8.4
|
||||||
pyflakes==2.2.0 # via flake8
|
# via -r requirements-dev.in
|
||||||
pylint==2.5.3 # via -r requirements-dev.in
|
iniconfig==1.1.1
|
||||||
pyparsing==2.4.7 # via packaging
|
# via pytest
|
||||||
pytest==5.4.3 # via -r requirements-dev.in
|
isort==5.7.0
|
||||||
regex==2020.6.8 # via -r requirements-dev.in, black
|
# via
|
||||||
six==1.15.0 # via astroid, packaging, pip-tools, tox, virtualenv
|
# -r requirements-dev.in
|
||||||
tabulate==0.8.7 # via -r requirements-dev.in
|
# pylint
|
||||||
toml==0.10.1 # via black, pylint, tox
|
lazy-object-proxy==1.5.2
|
||||||
tox==3.15.2 # via -r requirements-dev.in
|
# via astroid
|
||||||
typed-ast==1.4.1 # via black, mypy
|
mccabe==0.6.1
|
||||||
typing-extensions==3.7.4.2 # via mypy
|
# via
|
||||||
virtualenv==20.0.23 # via tox
|
# flake8
|
||||||
wcwidth==0.2.4 # via pytest
|
# pylint
|
||||||
wrapt==1.12.1 # via astroid
|
mypy-extensions==0.4.3
|
||||||
|
# via
|
||||||
|
# black
|
||||||
|
# mypy
|
||||||
|
mypy==0.812
|
||||||
|
# via -r requirements-dev.in
|
||||||
|
packaging==20.9
|
||||||
|
# via
|
||||||
|
# pytest
|
||||||
|
# tox
|
||||||
|
pathspec==0.8.1
|
||||||
|
# via black
|
||||||
|
pip-tools==5.5.0
|
||||||
|
# via -r requirements-dev.in
|
||||||
|
pluggy==0.13.1
|
||||||
|
# via
|
||||||
|
# pytest
|
||||||
|
# tox
|
||||||
|
polib==1.1.0
|
||||||
|
# via
|
||||||
|
# -r requirements-dev.in
|
||||||
|
# -r requirements.txt
|
||||||
|
py==1.10.0
|
||||||
|
# via
|
||||||
|
# pytest
|
||||||
|
# tox
|
||||||
|
pycodestyle==2.6.0
|
||||||
|
# via flake8
|
||||||
|
pyflakes==2.2.0
|
||||||
|
# via flake8
|
||||||
|
pylint==2.7.2
|
||||||
|
# via -r requirements-dev.in
|
||||||
|
pyparsing==2.4.7
|
||||||
|
# via packaging
|
||||||
|
pytest==6.2.2
|
||||||
|
# via -r requirements-dev.in
|
||||||
|
regex==2020.11.13
|
||||||
|
# via
|
||||||
|
# -r requirements-dev.in
|
||||||
|
# -r requirements.txt
|
||||||
|
# black
|
||||||
|
six==1.15.0
|
||||||
|
# via
|
||||||
|
# tox
|
||||||
|
# virtualenv
|
||||||
|
tabulate==0.8.9
|
||||||
|
# via
|
||||||
|
# -r requirements-dev.in
|
||||||
|
# -r requirements.txt
|
||||||
|
toml==0.10.2
|
||||||
|
# via
|
||||||
|
# black
|
||||||
|
# pylint
|
||||||
|
# pytest
|
||||||
|
# tox
|
||||||
|
tox==3.22.0
|
||||||
|
# via -r requirements-dev.in
|
||||||
|
typed-ast==1.4.2
|
||||||
|
# via
|
||||||
|
# black
|
||||||
|
# mypy
|
||||||
|
typing-extensions==3.7.4.3
|
||||||
|
# via
|
||||||
|
# black
|
||||||
|
# mypy
|
||||||
|
virtualenv==20.4.2
|
||||||
|
# via tox
|
||||||
|
wrapt==1.12.1
|
||||||
|
# via astroid
|
||||||
|
|
||||||
# The following packages are considered to be unsafe in a requirements file:
|
# The following packages are considered to be unsafe in a requirements file:
|
||||||
# pip
|
# pip
|
||||||
|
|
12
requirements.txt
Normal file
12
requirements.txt
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#
|
||||||
|
# This file is autogenerated by pip-compile
|
||||||
|
# To update, run:
|
||||||
|
#
|
||||||
|
# pip-compile setup.py
|
||||||
|
#
|
||||||
|
polib==1.1.0
|
||||||
|
# via pogrep (setup.py)
|
||||||
|
regex==2020.11.13
|
||||||
|
# via pogrep (setup.py)
|
||||||
|
tabulate==0.8.9
|
||||||
|
# via pogrep (setup.py)
|
|
@ -49,7 +49,10 @@ def test_not_in_source(about_po):
|
||||||
|
|
||||||
def test_in_translation(about_po):
|
def test_in_translation(about_po):
|
||||||
errors, results = find_in_po(
|
errors, results = find_in_po(
|
||||||
"propos", ("about.po",), in_translation=True, not_in_source=True,
|
"propos",
|
||||||
|
("about.po",),
|
||||||
|
in_translation=True,
|
||||||
|
not_in_source=True,
|
||||||
)
|
)
|
||||||
assert not errors
|
assert not errors
|
||||||
assert "about.po" in {result.file for result in results}
|
assert "about.po" in {result.file for result in results}
|
||||||
|
@ -57,7 +60,10 @@ def test_in_translation(about_po):
|
||||||
|
|
||||||
def test_not_in_translation(about_po):
|
def test_not_in_translation(about_po):
|
||||||
errors, results = find_in_po(
|
errors, results = find_in_po(
|
||||||
"About", ("about.po",), in_translation=True, not_in_source=True,
|
"About",
|
||||||
|
("about.po",),
|
||||||
|
in_translation=True,
|
||||||
|
not_in_source=True,
|
||||||
)
|
)
|
||||||
assert not errors
|
assert not errors
|
||||||
assert not results
|
assert not results
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -2,7 +2,7 @@
|
||||||
max-line-length = 88
|
max-line-length = 88
|
||||||
|
|
||||||
[tox]
|
[tox]
|
||||||
envlist = py36, py37, py38, flake8, mypy, black, pylint
|
envlist = py36, py37, py38, py39, flake8, mypy, black, pylint
|
||||||
isolated_build = True
|
isolated_build = True
|
||||||
skip_missing_interpreters = True
|
skip_missing_interpreters = True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user