mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-15 01:24:29 +02:00
minor optimization by changing the expression order
This commit is contained in:
@ -272,11 +272,11 @@ def _normalize_rows(table_lines: Iterable[str]) -> List[Tuple[int, List[str]]]:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# skip top table frame
|
# 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
|
continue
|
||||||
|
|
||||||
# first header row found
|
# 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
|
header_found = True
|
||||||
line = _snake_case(line)
|
line = _snake_case(line)
|
||||||
line = _fixup_separators(line)
|
line = _fixup_separators(line)
|
||||||
@ -286,7 +286,7 @@ def _normalize_rows(table_lines: Iterable[str]) -> List[Tuple[int, List[str]]]:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# subsequent header row found
|
# 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 = _snake_case(line)
|
||||||
line = _fixup_separators(line)
|
line = _fixup_separators(line)
|
||||||
line_list = line.split('|')
|
line_list = line.split('|')
|
||||||
@ -295,13 +295,13 @@ def _normalize_rows(table_lines: Iterable[str]) -> List[Tuple[int, List[str]]]:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# table separator found - this is a header separator
|
# 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
|
data_found = True
|
||||||
row_counter += 1
|
row_counter += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# data row found
|
# 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 = _fixup_separators(line)
|
||||||
line_list = line.split('|')
|
line_list = line.split('|')
|
||||||
line_list = [x.strip() for x in line_list]
|
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
|
continue
|
||||||
|
|
||||||
# table separator found - this is a data separator
|
# 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
|
row_counter += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user