From 650a8c325418c53f9a3992e6f1664a2ae1a0cc10 Mon Sep 17 00:00:00 2001 From: Colin Blackburn Date: Tue, 5 Mar 2024 19:03:17 +0000 Subject: [PATCH] Fix flake8 errors, mainly long lines --- app/conversion.py | 2 +- test/fixtures_json.py | 39 ++++++++++++++++++++++++-------------- test/unit/test_checkers.py | 8 +++++--- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/app/conversion.py b/app/conversion.py index db4ed17..ef66612 100644 --- a/app/conversion.py +++ b/app/conversion.py @@ -10,7 +10,7 @@ logger = logging.getLogger(__name__) -def convert(filename: Path, results_dir: Path, sorting_strategy: Optional[str]=None) -> Tuple[Optional[Path], dict]: +def convert(filename: Path, results_dir: Path, sorting_strategy: Optional[str] = None) -> Tuple[Optional[Path], dict]: """ Convert filename between .ags and .xlsx. Write output to file in results_dir and return path alongside job status data in dictionary.""" diff --git a/test/fixtures_json.py b/test/fixtures_json.py index bd43eab..42878ca 100644 --- a/test/fixtures_json.py +++ b/test/fixtures_json.py @@ -43,29 +43,37 @@ 'dictionary': 'Standard_dictionary_v4_1_1.ags', 'time': dt.datetime(2021, 8, 23, 14, 25, 43, tzinfo=dt.timezone.utc), 'message': '37 error(s) found in file!', - 'errors': {'AGS Format Rule 1': [{'desc': "Has Non-ASCII character(s) (assuming that file encoding is 'utf-8') and/or " - "a byte-order-mark (BOM).", + 'errors': {'AGS Format Rule 1': [{'desc': "Has Non-ASCII character(s) " + "(assuming that file encoding is 'utf-8') " + "and/or a byte-order-mark (BOM).", 'group': '', 'line': 1}, - {'desc': "Has Non-ASCII character(s) (assuming that file encoding is 'utf-8').", + {'desc': "Has Non-ASCII character(s) " + "(assuming that file encoding is 'utf-8').", 'group': '', 'line': 2}, - {'desc': "Has Non-ASCII character(s) (assuming that file encoding is 'utf-8').", + {'desc': "Has Non-ASCII character(s) " + "(assuming that file encoding is 'utf-8').", 'group': '', 'line': 3}, - {'desc': "Has Non-ASCII character(s) (assuming that file encoding is 'utf-8').", + {'desc': "Has Non-ASCII character(s) " + "(assuming that file encoding is 'utf-8').", 'group': '', 'line': 4}, - {'desc': "Has Non-ASCII character(s) (assuming that file encoding is 'utf-8').", + {'desc': "Has Non-ASCII character(s) " + "(assuming that file encoding is 'utf-8').", 'group': '', 'line': 5}, - {'desc': "Has Non-ASCII character(s) (assuming that file encoding is 'utf-8').", + {'desc': "Has Non-ASCII character(s) " + "(assuming that file encoding is 'utf-8').", 'group': '', 'line': 6}, - {'desc': "Has Non-ASCII character(s) (assuming that file encoding is 'utf-8').", + {'desc': "Has Non-ASCII character(s) " + "(assuming that file encoding is 'utf-8').", 'group': '', 'line': 7}, - {'desc': "Has Non-ASCII character(s) (assuming that file encoding is 'utf-8').", + {'desc': "Has Non-ASCII character(s) " + "(assuming that file encoding is 'utf-8').", 'group': '', 'line': 8}], 'AGS Format Rule 13': [{'desc': 'PROJ group not found.', @@ -185,7 +193,8 @@ "encoding as it is the most widely used encoding compatible with Unicode. The user " "can override this default if the file encoding is different but, it is highly " "recommended that the 'utf-8' encoding be used when creating AGS4 files. (Hint: " - "If not 'utf-8', then the encoding is most likely to be 'windows-1252' aka 'cp1252')"}]}, + "If not 'utf-8', then the encoding is most likely to be 'windows-1252' " + "aka 'cp1252')"}]}, 'valid': False, 'additional_metadata': {} }, @@ -212,8 +221,9 @@ 'dictionary': 'Standard_dictionary_v4_1_1.ags', 'time': dt.datetime(2021, 8, 23, 14, 25, 43, tzinfo=dt.timezone.utc), 'message': '95 error(s) found in file!', - 'errors': {'AGS Format Rule 1': [{'desc': "Has Non-ASCII character(s) (assuming that file encoding is 'utf-8') and/or " - "a byte-order-mark (BOM).", + 'errors': {'AGS Format Rule 1': [{'desc': "Has Non-ASCII character(s) " + "(assuming that file encoding is 'utf-8') " + "and/or a byte-order-mark (BOM).", 'group': '', 'line': 1}], 'AGS Format Rule 2a': [{'desc': 'Is not terminated by and ' @@ -596,8 +606,9 @@ "If not 'utf-8', then the encoding is most likely to be 'windows-1252' aka 'cp1252')"}, {'line': '', 'group': '', - 'desc': 'This file seems to be encoded with a byte-order-mark (BOM). It is highly ' - 'recommended that the file be saved without BOM encoding to avoid issues with other software.'}]}, + 'desc': 'This file seems to be encoded with a byte-order-mark (BOM). ' + 'It is highly recommended that the file be saved without BOM encoding ' + 'to avoid issues with other software.'}]}, 'valid': False, 'additional_metadata': {} }, diff --git a/test/unit/test_checkers.py b/test/unit/test_checkers.py index 81e6876..548357e 100644 --- a/test/unit/test_checkers.py +++ b/test/unit/test_checkers.py @@ -19,14 +19,16 @@ @pytest.mark.parametrize('filename, expected_rules', [ ('example_ags.ags', set()), - ('random_binary.ags', {'General', 'AGS Format Rule 1', 'AGS Format Rule 2a', 'AGS Format Rule 3', 'AGS Format Rule 5', - 'AGS Format Rule 13', 'AGS Format Rule 14', 'AGS Format Rule 15', 'AGS Format Rule 17'}), + ('random_binary.ags', {'General', 'AGS Format Rule 1', 'AGS Format Rule 2a', 'AGS Format Rule 3', + 'AGS Format Rule 5', 'AGS Format Rule 13', 'AGS Format Rule 14', 'AGS Format Rule 15', + 'AGS Format Rule 17'}), ('nonsense.AGS', {'AGS Format Rule 2a', 'AGS Format Rule 3', 'AGS Format Rule 5', 'AGS Format Rule 13', 'AGS Format Rule 14', 'AGS Format Rule 15', 'AGS Format Rule 17'}), ('empty.ags', {'AGS Format Rule 13', 'AGS Format Rule 14', 'AGS Format Rule 15', 'AGS Format Rule 17'}), ('real/A3040_03.ags', {'AGS Format Rule 3'}), ('real/43370.ags', {'General', 'AGS Format Rule 2a', 'AGS Format Rule 1'}), - ('real/JohnStPrimarySchool.ags', {'AGS Format Rule 3', 'AGS Format Rule 5', 'AGS Format Rule ?', 'AGS Format Rule 4', 'AGS Format Rule 2a'}), + ('real/JohnStPrimarySchool.ags', {'AGS Format Rule 3', 'AGS Format Rule 5', 'AGS Format Rule ?', + 'AGS Format Rule 4', 'AGS Format Rule 2a'}), ('real/19684.ags', {'AGS Format Rule 3'}), ('real/E52A4379 (2).ags', {'AGS Format Rule 3'}), ])