From 7ed423deaf7825f2fc9d89f4f8bf5c53a5c17456 Mon Sep 17 00:00:00 2001 From: Jamie Hardt Date: Sun, 5 Jan 2025 12:19:22 -0800 Subject: [PATCH] Dropping max-complexity argument --- .github/workflows/python-package.yml | 2 +- pycmx/parse_cmx_statements.py | 51 ++++++++++++++-------------- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 37e87fc..e408048 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -32,7 +32,7 @@ jobs: run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - flake8 . --count --max-complexity=10 --max-line-length=79 --statistics + flake8 . --count --max-line-length=79 --statistics - name: Test with pytest run: | pytest diff --git a/pycmx/parse_cmx_statements.py b/pycmx/parse_cmx_statements.py index f511250..55a850c 100644 --- a/pycmx/parse_cmx_statements.py +++ b/pycmx/parse_cmx_statements.py @@ -61,33 +61,32 @@ def _parse_cmx3600_line(line: str, line_number: int) -> object: long_event_num_p = re.compile("^[0-9]{6} ") short_event_num_p = re.compile("^[0-9]{3} ") - if isinstance(line, str): - if line.startswith("TITLE:"): - return _parse_title(line, line_number) - elif line.startswith("FCM:"): - return _parse_fcm(line, line_number) - elif long_event_num_p.match(line) is not None: - length_file_128 = sum(_edl_column_widths(6, 128)) - if len(line) < length_file_128: - return _parse_long_standard_form(line, 32, line_number) - else: - return _parse_long_standard_form(line, 128, line_number) - elif short_event_num_p.match(line) is not None: - return _parse_standard_form(line, line_number) - elif line.startswith("AUD"): - return _parse_extended_audio_channels(line, line_number) - elif line.startswith("*"): - return _parse_remark(line[1:].strip(), line_number) - elif line.startswith(">>> SOURCE"): - return _parse_source_umid_statement(line, line_number) - elif line.startswith("EFFECTS NAME IS"): - return _parse_effects_name(line, line_number) - elif line.startswith("SPLIT:"): - return _parse_split(line, line_number) - elif line.startswith("M2"): - return _parse_motion_memory(line, line_number) + if line.startswith("TITLE:"): + return _parse_title(line, line_number) + elif line.startswith("FCM:"): + return _parse_fcm(line, line_number) + elif long_event_num_p.match(line) is not None: + length_file_128 = sum(_edl_column_widths(6, 128)) + if len(line) < length_file_128: + return _parse_long_standard_form(line, 32, line_number) else: - return _parse_unrecognized(line, line_number) + return _parse_long_standard_form(line, 128, line_number) + elif short_event_num_p.match(line) is not None: + return _parse_standard_form(line, line_number) + elif line.startswith("AUD"): + return _parse_extended_audio_channels(line, line_number) + elif line.startswith("*"): + return _parse_remark(line[1:].strip(), line_number) + elif line.startswith(">>> SOURCE"): + return _parse_source_umid_statement(line, line_number) + elif line.startswith("EFFECTS NAME IS"): + return _parse_effects_name(line, line_number) + elif line.startswith("SPLIT:"): + return _parse_split(line, line_number) + elif line.startswith("M2"): + return _parse_motion_memory(line, line_number) + else: + return _parse_unrecognized(line, line_number) def _parse_title(line, line_num) -> StmtTitle: