Skip to content

Commit

Permalink
style: more intuitive names
Browse files Browse the repository at this point in the history
  • Loading branch information
Adamantios committed Aug 9, 2024
1 parent 2edaf44 commit 1132bb3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions aea/configurations/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,10 @@ def validate_data_with_pattern(
excludes_: List[Tuple[str]] = []
else:
excludes_ = excludes
pattern_path_value = {
original_config = {
tuple(path): value for path, value in dict_to_path_value(pattern)
}
data_path_value = {tuple(path): value for path, value in dict_to_path_value(data)}
overrides = {tuple(path): value for path, value in dict_to_path_value(data)}
errors = []

def check_excludes(path: Tuple[str, ...]) -> bool:
Expand All @@ -315,25 +315,25 @@ def is_a_dict_override(path: Tuple[str, ...]) -> bool:
flag = False
while len(path) > 0:
path = path[:-1]
if path in pattern_path_value:
pattern_value = pattern_path_value[path]
if path in original_config:
pattern_value = original_config[path]
flag = isinstance(pattern_value, OrderedDict)
break
return flag

for path, new_value in data_path_value.items():
for path, new_value in overrides.items():
if check_excludes(path):
continue

if path not in pattern_path_value:
if path not in original_config:
if not is_a_dict_override(path=(*path,)):
errors.append(
f"Attribute `{'.'.join(path)}` is not allowed to be updated!"
)

continue

pattern_value = pattern_path_value[path]
pattern_value = original_config[path]

if pattern_value is None:
# not possible to determine data type for optional value not set
Expand Down

0 comments on commit 1132bb3

Please sign in to comment.