From 304ae6268f4dff6e6f901628e7ff89db1d6e0767 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Thu, 24 Mar 2022 16:58:39 -0700 Subject: [PATCH] minor optimization by changing the expression order --- jc/parsers/asciitable_m.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jc/parsers/asciitable_m.py b/jc/parsers/asciitable_m.py index fc13f7f7..8ff3eed1 100644 --- a/jc/parsers/asciitable_m.py +++ b/jc/parsers/asciitable_m.py @@ -272,11 +272,11 @@ def _normalize_rows(table_lines: Iterable[str]) -> List[Tuple[int, List[str]]]: continue # skip top table frame - if _is_separator(line) and not header_found and not data_found: + if not header_found and not data_found and _is_separator(line): continue # first header row found - if not _is_separator(line) and not header_found and not data_found: + if not header_found and not data_found and not _is_separator(line): header_found = True line = _snake_case(line) line = _fixup_separators(line) @@ -286,7 +286,7 @@ def _normalize_rows(table_lines: Iterable[str]) -> List[Tuple[int, List[str]]]: continue # subsequent header row found - if not _is_separator(line) and header_found and not data_found: + if header_found and not data_found and not _is_separator(line): line = _snake_case(line) line = _fixup_separators(line) line_list = line.split('|') @@ -295,13 +295,13 @@ def _normalize_rows(table_lines: Iterable[str]) -> List[Tuple[int, List[str]]]: continue # table separator found - this is a header separator - if _is_separator(line) and header_found and not data_found: + if header_found and not data_found and _is_separator(line): data_found = True row_counter += 1 continue # data row found - if not _is_separator(line) and header_found and data_found: + if header_found and data_found and not _is_separator(line): line = _fixup_separators(line) line_list = line.split('|') line_list = [x.strip() for x in line_list] @@ -309,7 +309,7 @@ def _normalize_rows(table_lines: Iterable[str]) -> List[Tuple[int, List[str]]]: continue # table separator found - this is a data separator - if _is_separator(line) and header_found and data_found: + if header_found and data_found and _is_separator(line): row_counter += 1 continue