diff --git a/api/s23_options.py b/api/s23_options.py index 50d0b97..43e6ada 100644 --- a/api/s23_options.py +++ b/api/s23_options.py @@ -143,28 +143,29 @@ def set_option(name: str, cs: ChangeSet) -> ChangeSet: # MAP filename #-------------------------------------------------------------- def inp_in_option(section: list[str]) -> ChangeSet: - if len(section) > 0: - cs = g_update_prefix | { 'type' : 'option' } - for s in section: - if s.startswith(';'): - continue + if len(section) <= 0: + return ChangeSet() - tokens = s.strip().split() - if tokens[0].upper() == 'PATTERN': # can not upper id - cs |= { 'PATTERN' : tokens[1] } - elif tokens[0].upper() == 'QUALITY': # can not upper trace node - value = tokens[1] - if len(tokens) > 2: - value += f' {tokens[2]}' - cs |= { 'QUALITY' : value } - else: - line = s.upper().strip() - for key in get_option_schema('').keys(): - if line.startswith(key): - value = line.removeprefix(key).strip() - cs |= { key : value } - return ChangeSet(cs) - return ChangeSet() + cs = g_update_prefix | { 'type' : 'option' } + for s in section: + if s.startswith(';'): + continue + + tokens = s.strip().split() + if tokens[0].upper() == 'PATTERN': # can not upper id + cs |= { 'PATTERN' : tokens[1] } + elif tokens[0].upper() == 'QUALITY': # can not upper trace node + value = tokens[1] + if len(tokens) > 2: + value += f' {tokens[2]}' + cs |= { 'QUALITY' : value } + else: + line = s.upper().strip() + for key in get_option_schema('').keys(): + if line.startswith(key): + value = line.removeprefix(key).strip() + cs |= { key : value } + return ChangeSet(cs) def inp_out_option(name: str) -> list[str]: