From 341df2ce07afc92ab2411998bf1a1634a06dc6e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Mon, 30 May 2022 15:14:40 +0200 Subject: [PATCH] Refactor --- hooks/file_check_lines.py | 12 +----------- setup.cfg | 3 ++- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/hooks/file_check_lines.py b/hooks/file_check_lines.py index ef7eb7e..97efec7 100644 --- a/hooks/file_check_lines.py +++ b/hooks/file_check_lines.py @@ -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 diff --git a/setup.cfg b/setup.cfg index 273164c..4e1d752 100644 --- a/setup.cfg +++ b/setup.cfg @@ -46,6 +46,7 @@ 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 @@ -53,8 +54,8 @@ test = 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