From fba517491da255b614e4f0965ede6fccdd40cff4 Mon Sep 17 00:00:00 2001 From: Luna Pratali Maffei Date: Fri, 27 Dec 2024 10:11:55 +0100 Subject: [PATCH] lint fix --- automol/graph/_3super_func_group.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/automol/graph/_3super_func_group.py b/automol/graph/_3super_func_group.py index 47980cef..0ebd84c0 100644 --- a/automol/graph/_3super_func_group.py +++ b/automol/graph/_3super_func_group.py @@ -112,7 +112,8 @@ def assign_grps(self, gra): # assign base groups for key, fct in BASE_GRP_DCT.items(): self.sup_grps[key] = self.grp_fct_dct[fct] - base_grps_0 = list(itertools.chain(*[grp for grp in self.sup_grps.values() if len(grp) > 0])) + base_grps_0 = list(itertools.chain(*[ + grp for grp in self.sup_grps.values() if len(grp) > 0])) # assign substituents subs_fct_dct = {} for key, fct in SUBSTITUENTS_GRP_DCT.items(): @@ -135,13 +136,16 @@ def assign_grps(self, gra): # if the atoms of the substituent are part of (any) base group: skip for grp in sub_grps: - if not any(all(atm in basei for atm in grp if atm in heavy_atms) for basei in base_grps_0): + if not any(all( + atm in basei for atm in grp if atm in heavy_atms) + for basei in base_grps_0): sub_grps_eff += (grp,) # intersection base+sub becomes the new base_grps; # filter by bond type, e.g., C-C, C-O.. # with bonded_grps only: fails for OCH3 # (CH2-O bonded to an aromatic would work too) - base_grps = bonded_grps_checksymb(gra, base_grps, sub_grps_eff, "C", sub[0]) + base_grps = bonded_grps_checksymb( + gra, base_grps, sub_grps_eff, "C", sub[0]) # add to dct self.sup_grps[comp_grp] = base_grps @@ -197,14 +201,15 @@ def bonded_grps_checksymb(gra, grps1, grps2, symb1, symb2): grp2 = tuple( atm for atm in grp2 if atm in heavy_atms and atm not in grp1 ) - possible_bonds = list(itertools.product(grp1, grp2)) + list(itertools.product(grp2, grp1)) + possible_bonds = list(itertools.product(grp1, grp2)) + possible_bonds += list(itertools.product(grp2, grp1)) effective_bonds = list( bond for bond in possible_bonds if frozenset(bond) in gra[1].keys() ) if len(tuple(set(effective_bonds).intersection(correct_bonds))) > 0: grp = grp1 + grp2 - if sorted(grp) not in [sorted(grpi) for grpi in grps] and grp2 not in assigned_grps2: + if (sorted(grp) not in [sorted(grpi) for grpi in grps] + and grp2 not in assigned_grps2): grps += (grp,) assigned_grps2 += (grp2,) - - return grps + return grps \ No newline at end of file