Rules
- class code_generation.rules.AppendProducer(producers, samples=[], exclude_samples=[], scopes='global', invert=False, update_output=True)[source]
ProducerRule is a base class for all rules that modify producers.
- Parameters:
producers (Producer | ProducerGroup | List[Producer | ProducerGroup]) – A list of producers or producer groups to be modified.
samples (str | List[str]) – A list of samples, for which the rule should be applied. Only one of samples and exclude_samples can be defined.
exclude_samples (str | List[str]) – A list of samples, for which the rule should not be applied. Only one of samples and exclude_samples can be defined.
scopes (str | List[str]) – The scopes, in which the rule should be applied. Defaults to “global”.
invert (bool) – If set, the invert of the rule is applied. Defaults to False.
update_output (bool) – If set, the output quantities are updated. Defaults to True.
- update_outputs(outputs_to_be_updated)[source]
- Parameters:
outputs_to_be_updated (Dict[str, Set[Quantity]])
- Return type:
None
- update_producers(producers_to_be_updated, unpacked_producers)[source]
- Parameters:
producers_to_be_updated (Dict[str, List[Producer | ProducerGroup]])
unpacked_producers (Dict[str, List[Producer | ProducerGroup]])
- Return type:
None
- class code_generation.rules.ProducerRule(producers, samples=[], exclude_samples=[], scopes='global', invert=False, update_output=True)[source]
ProducerRule is a base class for all rules that modify producers.
- Parameters:
producers (Producer | ProducerGroup | List[Producer | ProducerGroup]) – A list of producers or producer groups to be modified.
samples (str | List[str]) – A list of samples, for which the rule should be applied. Only one of samples and exclude_samples can be defined.
exclude_samples (str | List[str]) – A list of samples, for which the rule should not be applied. Only one of samples and exclude_samples can be defined.
scopes (str | List[str]) – The scopes, in which the rule should be applied. Defaults to “global”.
invert (bool) – If set, the invert of the rule is applied. Defaults to False.
update_output (bool) – If set, the output quantities are updated. Defaults to True.
- affected_producers()[source]
- Return type:
List[Producer | ProducerGroup]
- apply(sample, producers_to_be_updated, unpacked_producers, outputs_to_be_updated)[source]
- Parameters:
sample (str)
producers_to_be_updated (Dict[str, List[Producer | ProducerGroup]])
unpacked_producers (Dict[str, List[Producer | ProducerGroup]])
outputs_to_be_updated (Dict[str, Set[Quantity]])
- Return type:
None
- update_outputs(outputs_to_be_updated)[source]
- Parameters:
outputs_to_be_updated (Dict[str, Set[Quantity]])
- Return type:
None
- update_producers(producers_to_be_updated, unpacked_producers)[source]
- Parameters:
producers_to_be_updated (Dict[str, List[Producer | ProducerGroup]])
unpacked_producers (Dict[str, List[Producer | ProducerGroup]])
- Return type:
None
- class code_generation.rules.RemoveProducer(producers, samples=[], exclude_samples=[], scopes='global', invert=False, update_output=True)[source]
ProducerRule is a base class for all rules that modify producers.
- Parameters:
producers (Producer | ProducerGroup | List[Producer | ProducerGroup]) – A list of producers or producer groups to be modified.
samples (str | List[str]) – A list of samples, for which the rule should be applied. Only one of samples and exclude_samples can be defined.
exclude_samples (str | List[str]) – A list of samples, for which the rule should not be applied. Only one of samples and exclude_samples can be defined.
scopes (str | List[str]) – The scopes, in which the rule should be applied. Defaults to “global”.
invert (bool) – If set, the invert of the rule is applied. Defaults to False.
update_output (bool) – If set, the output quantities are updated. Defaults to True.
- update_outputs(outputs_to_be_updated)[source]
- Parameters:
outputs_to_be_updated (Dict[str, Set[Quantity]])
- Return type:
None
- update_producers(producers_to_be_updated, unpacked_producers)[source]
- Parameters:
producers_to_be_updated (Dict[str, List[Producer | ProducerGroup]])
unpacked_producers (Dict[str, List[Producer | ProducerGroup]])
- Return type:
None
- class code_generation.rules.ReplaceProducer(producers, samples=[], exclude_samples=[], scopes='global', invert=False, update_output=True)[source]
ProducerRule is a base class for all rules that modify producers.
- Parameters:
producers (Producer | ProducerGroup | List[Producer | ProducerGroup]) – A list of producers or producer groups to be modified.
samples (str | List[str]) – A list of samples, for which the rule should be applied. Only one of samples and exclude_samples can be defined.
exclude_samples (str | List[str]) – A list of samples, for which the rule should not be applied. Only one of samples and exclude_samples can be defined.
scopes (str | List[str]) – The scopes, in which the rule should be applied. Defaults to “global”.
invert (bool) – If set, the invert of the rule is applied. Defaults to False.
update_output (bool) – If set, the output quantities are updated. Defaults to True.
- update_outputs(outputs_to_be_updated)[source]
- Parameters:
outputs_to_be_updated (Dict[str, Set[Quantity]])
- Return type:
None
- update_producers(producers_to_be_updated, unpacked_producers)[source]
- Parameters:
producers_to_be_updated (Dict[str, List[Producer | ProducerGroup]])
unpacked_producers (Dict[str, List[Producer | ProducerGroup]])
- Return type:
None