Skip to content

Commit

Permalink
Fix flake8 errors, mainly long lines
Browse files Browse the repository at this point in the history
  • Loading branch information
ximenesuk committed Mar 5, 2024
1 parent dcc2ca3 commit 650a8c3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
39 changes: 25 additions & 14 deletions test/fixtures_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down Expand Up @@ -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': {}
},
Expand All @@ -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 <CR> and '
Expand Down Expand Up @@ -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': {}
},
Expand Down
8 changes: 5 additions & 3 deletions test/unit/test_checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'}),
])
Expand Down

0 comments on commit 650a8c3

Please sign in to comment.