Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mondeja committed May 30, 2022
1 parent 0357533 commit 341df2c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
12 changes: 1 addition & 11 deletions hooks/file_check_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,11 @@ def smart_quoted(value):
)


def normalize_lines(lines):
normalized_lines = []
for line in lines:
if line:
normalized_lines.append(line.strip("\r\n"))
normalized_lines.sort()
return normalized_lines


def file_check_lines(filename, expected_lines, quiet=False):

with open(filename, encoding="utf-8") as f:
lines = f.read().splitlines()

expected_lines = normalize_lines(expected_lines)
expected_lines = [line.strip("\r\n") for line in expected_lines]
if not expected_lines:
sys.stderr.write("Any valid non empty expected line passed as argument\n")
return 1
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@ dev =
pytest==6.2.4
pytest-cov==2.12.1
pyyaml==5.4.1
toml==0.10.2
waves==0.2.5
test =
cloudflare==2.8.15
dnspython==2.1.0
pytest==6.2.4
pytest-cov==2.12.1
pyyaml==5.4.1
waves==0.2.5
toml==0.10.2
waves==0.2.5

[bdist_wheel]
universal = True
Expand Down

0 comments on commit 341df2c

Please sign in to comment.