diff --git a/spock/backend/builder.py b/spock/backend/builder.py index 949b1ac7..e3ec2d1b 100644 --- a/spock/backend/builder.py +++ b/spock/backend/builder.py @@ -727,7 +727,7 @@ def _make_group_override_parser(parser, class_obj, class_name): ) # If it's a reference to a class it needs to be an arg of a simple string as class matching will take care # of it later on - elif val_type.__module__ == 'spock.backend.config': + elif val_type.__module__ == "spock.backend.config": arg_name = f"--{str(attr_name)}.{val.name}" val_type = str group_parser = make_argument(arg_name, val_type, group_parser) diff --git a/spock/backend/payload.py b/spock/backend/payload.py index 7423816e..96bf0ba2 100644 --- a/spock/backend/payload.py +++ b/spock/backend/payload.py @@ -395,7 +395,11 @@ def _handle_payload_override(payload, key, value): key_split = key.split(".") curr_ref = payload # Handle non existing parts of the payload for specific cases - root_classes = [idx for idx, val in enumerate(key_split) if hasattr(sys.modules["spock"].backend.config, val)] + root_classes = [ + idx + for idx, val in enumerate(key_split) + if hasattr(sys.modules["spock"].backend.config, val) + ] # Verify any classes have roots in the payload dict for idx in root_classes: # Update all root classes if not present @@ -405,13 +409,24 @@ def _handle_payload_override(payload, key, value): # Make sure it's there by setting it -- since this is an override setting is fine as these should be the # final say in the param values so don't worry about clashing if idx != 0: - payload[key_split[0]][key_split[idx-1]] = key_split[idx] + payload[key_split[0]][key_split[idx - 1]] = key_split[idx] # Check also for repeated classes -- value will be a list when the type is not - var = getattr(getattr(sys.modules["spock"].backend.config, key_split[idx]).__attrs_attrs__, key_split[-1]) + var = getattr( + getattr( + sys.modules["spock"].backend.config, key_split[idx] + ).__attrs_attrs__, + key_split[-1], + ) if isinstance(value, list) and var.type != list: # If the dict is blank we need to handle the creation of the list of dicts if len(payload[key_split[idx]]) == 0: - payload.update({key_split[idx]: [{key_split[-1]: None} for _ in range(len(value))]}) + payload.update( + { + key_split[idx]: [ + {key_split[-1]: None} for _ in range(len(value)) + ] + } + ) # If it's already partially filled we need to update not overwrite else: for val in payload[key_split[idx]]: diff --git a/spock/builder.py b/spock/builder.py index 20a88819..5ca36245 100644 --- a/spock/builder.py +++ b/spock/builder.py @@ -401,7 +401,11 @@ def _get_payload(self, payload_obj, input_classes, ignore_args: typing.List): if len(self._args.config) > 0: for configs in self._args.config: payload_update = payload_obj.payload( - input_classes, ignore_args, configs, self._args, dependencies + input_classes, + ignore_args, + configs, + self._args, + dependencies, ) check_payload_overwrite(payload, payload_update, configs) deep_payload_update(payload, payload_update)