mirror of
https://github.com/LmeSzinc/AzurLaneAutoScript.git
synced 2025-04-05 01:13:31 +08:00
Pref: Reduce deep_get in config_update
since deep_iter yields the value already
This commit is contained in:
parent
477f917262
commit
dfb2db800f
@ -616,8 +616,7 @@ class ConfigUpdater:
|
|||||||
"""
|
"""
|
||||||
new = {}
|
new = {}
|
||||||
|
|
||||||
def deep_load(keys):
|
for keys, data in deep_iter(self.args, depth=3):
|
||||||
data = deep_get(self.args, keys=keys, default={})
|
|
||||||
value = deep_get(old, keys=keys, default=data['value'])
|
value = deep_get(old, keys=keys, default=data['value'])
|
||||||
typ = data['type']
|
typ = data['type']
|
||||||
display = data.get('display')
|
display = data.get('display')
|
||||||
@ -627,9 +626,6 @@ class ConfigUpdater:
|
|||||||
value = parse_value(value, data=data)
|
value = parse_value(value, data=data)
|
||||||
deep_set(new, keys=keys, value=value)
|
deep_set(new, keys=keys, value=value)
|
||||||
|
|
||||||
for path, _ in deep_iter(self.args, depth=3):
|
|
||||||
deep_load(path)
|
|
||||||
|
|
||||||
# AzurStatsID
|
# AzurStatsID
|
||||||
if is_template:
|
if is_template:
|
||||||
deep_set(new, 'Alas.DropRecord.AzurStatsID', None)
|
deep_set(new, 'Alas.DropRecord.AzurStatsID', None)
|
||||||
|
@ -85,8 +85,7 @@ class ConfigUpdater(config_updater.ConfigUpdater):
|
|||||||
"""
|
"""
|
||||||
new = {}
|
new = {}
|
||||||
|
|
||||||
def deep_load(keys):
|
for keys, data in deep_iter(self.args, depth=3):
|
||||||
data = deep_get(self.args, keys=keys, default={})
|
|
||||||
value = deep_get(old, keys=keys, default=data["value"])
|
value = deep_get(old, keys=keys, default=data["value"])
|
||||||
if (
|
if (
|
||||||
is_template
|
is_template
|
||||||
@ -99,9 +98,6 @@ class ConfigUpdater(config_updater.ConfigUpdater):
|
|||||||
value = parse_value(value, data=data)
|
value = parse_value(value, data=data)
|
||||||
deep_set(new, keys=keys, value=value)
|
deep_set(new, keys=keys, value=value)
|
||||||
|
|
||||||
for path, _ in deep_iter(self.args, depth=3):
|
|
||||||
deep_load(path)
|
|
||||||
|
|
||||||
if not is_template:
|
if not is_template:
|
||||||
new = self.config_redirect(old, new)
|
new = self.config_redirect(old, new)
|
||||||
|
|
||||||
|
@ -94,17 +94,13 @@ class ConfigUpdater(config_updater.ConfigUpdater):
|
|||||||
"""
|
"""
|
||||||
new = {}
|
new = {}
|
||||||
|
|
||||||
def deep_load(keys):
|
for keys, data in deep_iter(self.args, depth=3):
|
||||||
data = deep_get(self.args, keys=keys, default={})
|
|
||||||
value = deep_get(old, keys=keys, default=data['value'])
|
value = deep_get(old, keys=keys, default=data['value'])
|
||||||
if is_template or value is None or value == '' or data['type'] == 'lock' or data.get('display') == 'hide':
|
if is_template or value is None or value == '' or data['type'] == 'lock' or data.get('display') == 'hide':
|
||||||
value = data['value']
|
value = data['value']
|
||||||
value = parse_value(value, data=data)
|
value = parse_value(value, data=data)
|
||||||
deep_set(new, keys=keys, value=value)
|
deep_set(new, keys=keys, value=value)
|
||||||
|
|
||||||
for path, _ in deep_iter(self.args, depth=3):
|
|
||||||
deep_load(path)
|
|
||||||
|
|
||||||
if not is_template:
|
if not is_template:
|
||||||
new = self.config_redirect(old, new)
|
new = self.config_redirect(old, new)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user