diff --git a/jc/parsers/universal.py b/jc/parsers/universal.py index 5e856b70..b1de1ca4 100644 --- a/jc/parsers/universal.py +++ b/jc/parsers/universal.py @@ -2,7 +2,7 @@ import string -from typing import List, Dict, Optional +from typing import List, Dict def simple_table_parse(data: List[str]) -> List[Dict]: @@ -33,7 +33,7 @@ def simple_table_parse(data: List[str]) -> List[Dict]: return raw_output -def sparse_table_parse(data: List[str], delim: Optional[str] ='\u2063') -> List[Dict]: +def sparse_table_parse(data: List[str], delim: str = '\u2063') -> List[Dict]: """ Parse tables with missing column data or with spaces in column data. @@ -96,7 +96,7 @@ def sparse_table_parse(data: List[str], delim: Optional[str] ='\u2063') -> List[ h_end -= 1 # insert custom delimiter - entry = f'{entry[:h_end]}{delim}{entry[h_end + 1:]}' + entry = entry[:h_end] + delim + entry[h_end + 1:] # create the entry list from the new custom delimiter entry_list = entry.split(delim, maxsplit=len(header_list) - 1) diff --git a/jc/utils.py b/jc/utils.py index 75b1bdf9..58c51dbb 100644 --- a/jc/utils.py +++ b/jc/utils.py @@ -5,7 +5,7 @@ import locale import shutil from datetime import datetime, timezone from textwrap import TextWrapper -from typing import Dict, Iterable, List, Union, Optional +from typing import Dict, Iterable, List, Union def warning_message(message_lines: List[str]) -> None: @@ -76,7 +76,7 @@ def error_message(message_lines: List[str]) -> None: print(message, file=sys.stderr) -def compatibility(mod_name: str, compatible: List, quiet: Optional[bool] = False) -> None: +def compatibility(mod_name: str, compatible: List, quiet: bool = False) -> None: """ Checks for the parser's compatibility with the running OS platform.