Clean code
This commit is contained in:
@@ -46,7 +46,7 @@ class Source(object):
|
||||
return { 'type': self.type, 'node': self.node }
|
||||
|
||||
|
||||
def set_source_cmd(name: str, cs: ChangeSet) -> DbChangeSet:
|
||||
def _set_source(name: str, cs: ChangeSet) -> DbChangeSet:
|
||||
old = Source(get_source(name, cs.operations[0]['node']))
|
||||
raw_new = get_source(name, cs.operations[0]['node'])
|
||||
|
||||
@@ -67,10 +67,10 @@ def set_source_cmd(name: str, cs: ChangeSet) -> DbChangeSet:
|
||||
|
||||
|
||||
def set_source(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
return execute_command(name, set_source_cmd(name, cs))
|
||||
return execute_command(name, _set_source(name, cs))
|
||||
|
||||
|
||||
def add_source_cmd(name: str, cs: ChangeSet) -> DbChangeSet:
|
||||
def _add_source(name: str, cs: ChangeSet) -> DbChangeSet:
|
||||
new = Source(cs.operations[0])
|
||||
|
||||
redo_sql = f"insert into sources (node, type, strength, pattern) values ({new.f_node}, {new.f_s_type}, {new.f_strength}, {new.f_pattern});"
|
||||
@@ -83,10 +83,10 @@ def add_source_cmd(name: str, cs: ChangeSet) -> DbChangeSet:
|
||||
|
||||
|
||||
def add_source(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
return execute_command(name, add_source_cmd(name, cs))
|
||||
return execute_command(name, _add_source(name, cs))
|
||||
|
||||
|
||||
def delete_source_cmd(name: str, cs: ChangeSet) -> DbChangeSet:
|
||||
def _delete_source(name: str, cs: ChangeSet) -> DbChangeSet:
|
||||
old = Source(get_source(name, cs.operations[0]['node']))
|
||||
|
||||
redo_sql = f"delete from sources where node = {old.f_node};"
|
||||
@@ -99,7 +99,7 @@ def delete_source_cmd(name: str, cs: ChangeSet) -> DbChangeSet:
|
||||
|
||||
|
||||
def delete_source(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
return execute_command(name, delete_source_cmd(name, cs))
|
||||
return execute_command(name, _delete_source(name, cs))
|
||||
|
||||
|
||||
#--------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user