Refine option v2
This commit is contained in:
@@ -143,28 +143,29 @@ def set_option(name: str, cs: ChangeSet) -> ChangeSet:
|
|||||||
# MAP filename
|
# MAP filename
|
||||||
#--------------------------------------------------------------
|
#--------------------------------------------------------------
|
||||||
def inp_in_option(section: list[str]) -> ChangeSet:
|
def inp_in_option(section: list[str]) -> ChangeSet:
|
||||||
if len(section) > 0:
|
if len(section) <= 0:
|
||||||
cs = g_update_prefix | { 'type' : 'option' }
|
return ChangeSet()
|
||||||
for s in section:
|
|
||||||
if s.startswith(';'):
|
|
||||||
continue
|
|
||||||
|
|
||||||
tokens = s.strip().split()
|
cs = g_update_prefix | { 'type' : 'option' }
|
||||||
if tokens[0].upper() == 'PATTERN': # can not upper id
|
for s in section:
|
||||||
cs |= { 'PATTERN' : tokens[1] }
|
if s.startswith(';'):
|
||||||
elif tokens[0].upper() == 'QUALITY': # can not upper trace node
|
continue
|
||||||
value = tokens[1]
|
|
||||||
if len(tokens) > 2:
|
tokens = s.strip().split()
|
||||||
value += f' {tokens[2]}'
|
if tokens[0].upper() == 'PATTERN': # can not upper id
|
||||||
cs |= { 'QUALITY' : value }
|
cs |= { 'PATTERN' : tokens[1] }
|
||||||
else:
|
elif tokens[0].upper() == 'QUALITY': # can not upper trace node
|
||||||
line = s.upper().strip()
|
value = tokens[1]
|
||||||
for key in get_option_schema('').keys():
|
if len(tokens) > 2:
|
||||||
if line.startswith(key):
|
value += f' {tokens[2]}'
|
||||||
value = line.removeprefix(key).strip()
|
cs |= { 'QUALITY' : value }
|
||||||
cs |= { key : value }
|
else:
|
||||||
return ChangeSet(cs)
|
line = s.upper().strip()
|
||||||
return ChangeSet()
|
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]:
|
def inp_out_option(name: str) -> list[str]:
|
||||||
|
|||||||
Reference in New Issue
Block a user