Clean code

This commit is contained in:
WQY\qiong
2023-04-29 15:42:01 +08:00
parent 35d2ce08e1
commit 4b452c5f0a
12 changed files with 141 additions and 171 deletions

View File

@@ -106,7 +106,7 @@ def get_option(name: str) -> dict[str, Any]:
return d
def set_option_cmd(name: str, cs: ChangeSet) -> DbChangeSet:
def _set_option(name: str, cs: ChangeSet) -> DbChangeSet:
raw_old = get_option(name)
old = {}
@@ -140,9 +140,8 @@ def set_option_cmd(name: str, cs: ChangeSet) -> DbChangeSet:
return DbChangeSet(redo_sql, undo_sql, [redo_cs], [undo_cs])
def set_option_only(name: str, cs: ChangeSet) -> ChangeSet:
v2_cmd = set_option_cmd(name, cs)
return execute_command(name, v2_cmd)
def set_option(name: str, cs: ChangeSet) -> ChangeSet:
return execute_command(name, _set_option(name, cs))
OPTION_V3_FLOW_UNITS_CFS = OPTION_UNITS_CFS
@@ -231,7 +230,7 @@ def get_option_v3(name: str) -> dict[str, Any]:
return d
def set_option_v3_cmd(name: str, cs: ChangeSet) -> DbChangeSet:
def _set_option_v3(name: str, cs: ChangeSet) -> DbChangeSet:
raw_old = get_option_v3(name)
old = {}
@@ -265,9 +264,8 @@ def set_option_v3_cmd(name: str, cs: ChangeSet) -> DbChangeSet:
return DbChangeSet(redo_sql, undo_sql, [redo_cs], [undo_cs])
def set_option_v3_only(name: str, cs: ChangeSet) -> ChangeSet:
v3_cmd = set_option_v3_cmd(name, cs)
return execute_command(name, v3_cmd)
def set_option_v3(name: str, cs: ChangeSet) -> ChangeSet:
return execute_command(name, _set_option_v3(name, cs))
_key_map_23 = {