Skip to content

Commit d13f019

Browse files
committed
Avoid calling fails_species_constraints() twice in a row.
Since Python 3.8 we can do this "walrus" operator :=
1 parent 3dc9bef commit d13f019

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

rmgpy/data/kinetics/family.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,8 +1655,7 @@ def _generate_product_structures(self, reactant_structures, maps, forward, relab
16551655
for struct in product_structures:
16561656
if self.is_molecule_forbidden(struct):
16571657
raise ForbiddenStructureException()
1658-
if fails_species_constraints(struct):
1659-
reason = fails_species_constraints(struct)
1658+
if (reason := fails_species_constraints(struct)):
16601659
raise ForbiddenStructureException(
16611660
"Species constraints forbids product species {0}. Please "
16621661
"reformulate constraints, or explicitly "

0 commit comments

Comments
 (0)