diff --git a/src/cobra/core/model.py b/src/cobra/core/model.py index fe71e5047..9a504aba5 100644 --- a/src/cobra/core/model.py +++ b/src/cobra/core/model.py @@ -915,7 +915,7 @@ def existing_filter(new_group: Group) -> bool: """ if new_group.id in self.groups: logger.warning( - f"Ignoring group '{new_group.id}'" f" since it already exists." + f"Ignoring group '{new_group.id}' since it already exists." ) return False return True diff --git a/src/cobra/core/reaction.py b/src/cobra/core/reaction.py index ac65c0f0f..f67a5b3da 100644 --- a/src/cobra/core/reaction.py +++ b/src/cobra/core/reaction.py @@ -585,8 +585,8 @@ def metabolites(self, value: Dict[Metabolite, float]) -> None: """Set metabolites to a dictionary of metabolites and coefficients. Parameters - ------- - metabolites: Dict[Metabolite, float] + ---------- + value: Dict[Metabolite, float] A dictionary of cobra.Metabolite for keys and floats for coeffecieints. Positive coefficient means the reaction produces this metabolite, while negative coefficient means the reaction consumes this metabolite. @@ -1014,7 +1014,7 @@ def __iadd__(self, other: "Reaction") -> "Reaction": rule2 = other.gene_reaction_rule.strip() if rule1 != "" and rule2 != "": self.gene_reaction_rule = ( - f"({self.gene_reaction_rule}) and " f"({other.gene_reaction_rule})" + f"({self.gene_reaction_rule}) and ({other.gene_reaction_rule})" ) elif rule1 != "" and rule2 == "": self.gene_reaction_rule = rule1 @@ -1227,13 +1227,12 @@ def add_metabolites( # Make sure metabolites being added belong to the same model, or # else copy them. - if isinstance(metabolite, Metabolite): - if ( - (metabolite.model is not None) - and self.model - and (metabolite.model is not self._model) - ): - metabolite = metabolite.copy() + if isinstance(metabolite, Metabolite) and ( + (metabolite.model is not None) + and self.model + and (metabolite.model is not self._model) + ): + metabolite = metabolite.copy() met_id = str(metabolite) # If a metabolite already exists in the reaction then