Skip to content

Commit

Permalink
Black
Browse files Browse the repository at this point in the history
  • Loading branch information
tvoigtlaender committed Dec 6, 2024
1 parent a6c5f83 commit 932c6dd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
26 changes: 15 additions & 11 deletions code_generation/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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]
]
)
Expand Down
6 changes: 1 addition & 5 deletions code_generation/producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
12 changes: 6 additions & 6 deletions code_generation/systematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 932c6dd

Please sign in to comment.