diff --git a/code_generation/configuration.py b/code_generation/configuration.py index 59c753af..c0ccb4f1 100644 --- a/code_generation/configuration.py +++ b/code_generation/configuration.py @@ -372,16 +372,16 @@ def add_shift( if scope in shift.get_scopes(): self._add_available_shift(shift, scope) shift.apply(scope) - self.shifts[scope][ - shift.shiftname - ] = self.resolve_modifiers(shift.get_shift_config(scope)) + self.shifts[scope][shift.shiftname] = ( + self.resolve_modifiers(shift.get_shift_config(scope)) + ) else: self._add_available_shift(shift, scope) shift.apply(self.global_scope) - self.shifts[scope][ - shift.shiftname - ] = self.resolve_modifiers( - shift.get_shift_config(self.global_scope) + self.shifts[scope][shift.shiftname] = ( + self.resolve_modifiers( + shift.get_shift_config(self.global_scope) + ) ) else: for scope in scopes_to_shift: @@ -514,7 +514,9 @@ def _remove_empty_scopes(self) -> None: # we have to use a seperate list, because we cannot modify the list while iterating over it without breaking stuff scopes_to_test = [scope for scope in self.scopes] for scope in scopes_to_test: - if (len(self.producers[scope]) == 0 or scope not in self.selected_scopes) and scope is not self.global_scope: + if ( + len(self.producers[scope]) == 0 or scope not in self.selected_scopes + ) and scope is not self.global_scope: log.warning("Removing unrequested / empty scope {}".format(scope)) self.scopes.remove(scope) del self.producers[scope] @@ -766,9 +768,11 @@ def report(self) -> None: total_quantities = [ sum( [ - len(self.config_parameters[scope][output.vec_config]) - if isinstance(output, QuantityGroup) - else 1 + ( + len(self.config_parameters[scope][output.vec_config]) + if isinstance(output, QuantityGroup) + else 1 + ) for output in self.outputs[scope] ] ) diff --git a/code_generation/producer.py b/code_generation/producer.py index 414e17ce..8e3d12ea 100644 --- a/code_generation/producer.py +++ b/code_generation/producer.py @@ -830,11 +830,7 @@ def writecalls( calls: List[str] = [] for producer in self.producers[scope]: # duplicate outputs of vector subproducers if they were generated automatically - if ( - self.call - and isinstance(producer, VectorProducer) - and producer.output - ): + if self.call and isinstance(producer, VectorProducer) and producer.output: for i in range(len(config["nominal"][producer.vec_configs[0]]) - 1): producer.output.append( producer.output[0].copy( diff --git a/code_generation/systematics.py b/code_generation/systematics.py index 86448999..027011eb 100644 --- a/code_generation/systematics.py +++ b/code_generation/systematics.py @@ -82,9 +82,9 @@ def __init__( ] = self.expand_producer_dict_keys(ignore_producers) self.producers: TProducerStore = {} self.ignore_producers: TProducerStore = {} - self.shift_config: Dict[ - str, TConfiguration - ] = self.expand_configuration_dict_keys(shift_config) + self.shift_config: Dict[str, TConfiguration] = ( + self.expand_configuration_dict_keys(shift_config) + ) self.scopes: Set[str] = self.determine_scopes(scopes) self.validate() @@ -403,9 +403,9 @@ def __init__( scopes: List of scopes that are affected by the systematic shift. """ super().__init__(name, {}, {}, scopes, {}) - self.quantity_change: Dict[ - NanoAODQuantity, Union[str, NanoAODQuantity] - ] = quantity_change + self.quantity_change: Dict[NanoAODQuantity, Union[str, NanoAODQuantity]] = ( + quantity_change + ) self.quantities: Set[NanoAODQuantity] = set(quantity_change.keys()) def apply(self, scope: str) -> None: