requirements thinned out again

StrategyResolver.search_all_objects(enum_failed) set to False since we got no use in True
shortened update_code call
added modified_code8 test which currently still fails. (and thereby is commented out)
This commit is contained in:
hippocritical
2023-01-02 20:45:56 +01:00
parent 66f7c91357
commit 0817e1698f
4 changed files with 17 additions and 22 deletions

View File

@@ -22,7 +22,7 @@ def start_strategy_update(args: Dict[str, Any]) -> None:
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
strategy_objs = StrategyResolver.search_all_objects(
config, enum_failed=True, recursive=config.get('recursive_strategy_search', False))
config, enum_failed=False, recursive=config.get('recursive_strategy_search', False))
filtered_strategy_objs = []
for args_strategy in args['strategy_list']:

View File

@@ -69,7 +69,7 @@ class StrategyUpdater:
shutil.copy(source_file, target_file)
# update the code
new_code = StrategyUpdater.update_code(self, old_code)
new_code = self.update_code(old_code)
# write the modified code to the destination folder
with open(source_file, 'w') as f:
f.write(new_code)
@@ -113,7 +113,8 @@ class NameUpdater(ast.NodeTransformer):
def check_fields(self, field_value):
if isinstance(field_value, list):
for item in field_value:
if isinstance(item, ast.AST) or isinstance(item, ast.If):
if (isinstance(item, ast.AST) or isinstance(item, ast.If) or
isinstance(item, ast.Expr)):
self.visit(item)
if isinstance(field_value, ast.Name):
self.visit_Name(field_value)
@@ -138,7 +139,8 @@ class NameUpdater(ast.NodeTransformer):
if hasattr(node, "args"):
if isinstance(node.args, list):
for arg in node.args:
arg.arg = StrategyUpdater.name_mapping[arg.arg]
if arg.arg in StrategyUpdater.name_mapping:
arg.arg = StrategyUpdater.name_mapping[arg.arg]
return node
def visit_Name(self, node):