Skip to content

Commit 83f9e7f

Browse files
committed
Formating fixes to pass codevac
Removed some trailing white space. Already refactored three functions: saturate_radicals saturate_unfilled_valence saturate_rng_bonds from camel case to underscores as agreed upon for style.
1 parent bcf5176 commit 83f9e7f

File tree

9 files changed

+26
-26
lines changed

9 files changed

+26
-26
lines changed

rmgpy/data/solvation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ def estimateSoluteViaGroupAdditivity(self, molecule):
804804

805805
# Now saturate radicals with H
806806
if sum([atom.radicalElectrons for atom in saturatedStruct.atoms]) > 0: # radical species
807-
addedToRadicals = saturatedStruct.saturateRadicals()
807+
addedToRadicals = saturatedStruct.saturate_radicals()
808808

809809
# Saturated structure should now have no unpaired electrons, and only "expected" lone pairs
810810
# based on the valency

rmgpy/data/thermo.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def splitBicyclicIntoSingleRings(bicyclic_submol):
514514
return [convertRingToSubMolecule(SSSR[0])[0],
515515
convertRingToSubMolecule(SSSR[1])[0]]
516516

517-
def saturateRingBonds(ring_submol):
517+
def saturate_ring_bonds(ring_submol):
518518
"""
519519
Given a ring submolelcule (`Molecule`), makes a deep copy and converts non-single bonds
520520
into single bonds, returns a new saturated submolecule (`Molecule`)
@@ -537,7 +537,7 @@ def saturateRingBonds(ring_submol):
537537
bond_order = 1.5
538538
mol0.addBond(Bond(atomsMapping[atom],atomsMapping[bondedAtom],order=bond_order))
539539

540-
mol0.saturateUnfilledValence()
540+
mol0.saturate_unfilled_valence()
541541
mol0.updateAtomTypes()
542542
mol0.updateMultiplicity()
543543
mol0.updateConnectivityValues()
@@ -1404,7 +1404,7 @@ def estimateRadicalThermoViaHBI(self, molecule, stableThermoEstimator ):
14041404

14051405
assert molecule.isRadical(), "Method only valid for radicals."
14061406
saturatedStruct = molecule.copy(deep=True)
1407-
added = saturatedStruct.saturateRadicals()
1407+
added = saturatedStruct.saturate_radicals()
14081408
saturatedStruct.props['saturated'] = True
14091409

14101410
# Get thermo estimate for saturated form of structure
@@ -1680,7 +1680,7 @@ def __addPolyRingCorrectionThermoDataFromHeuristic(self, thermoData, polyring):
16801680
for aromaticBond in aromaticBonds:
16811681
aromaticBond.setOrderNum(1)
16821682

1683-
submol.saturateUnfilledValence()
1683+
submol.saturate_unfilled_valence()
16841684
submol.update
16851685
singleRingThermodata = self.__addRingCorrectionThermoDataFromTree(None, \
16861686
self.groups['ring'], submol, submol.atoms)[0]
@@ -1700,7 +1700,7 @@ def getBicyclicCorrectionThermoDataFromHeuristic(self, bicyclic):
17001700
# saturate if the bicyclic has unsaturated bonds
17011701
# otherwise return None
17021702
bicyclic_submol = convertRingToSubMolecule(bicyclic)[0]
1703-
saturated_bicyclic_submol, alreadySaturated = saturateRingBonds(bicyclic_submol)
1703+
saturated_bicyclic_submol, alreadySaturated = saturate_ring_bonds(bicyclic_submol)
17041704

17051705
if alreadySaturated:
17061706
return None
@@ -1737,7 +1737,7 @@ def getBicyclicCorrectionThermoDataFromHeuristic(self, bicyclic):
17371737
for aromaticBond in aromaticBonds:
17381738
aromaticBond.setOrderNum(1)
17391739

1740-
submol.saturateUnfilledValence()
1740+
submol.saturate_unfilled_valence()
17411741
submol.update
17421742
single_ring_thermoData = self.__addRingCorrectionThermoDataFromTree(None,
17431743
self.groups['ring'], submol, submol.atoms)[0]
@@ -1756,7 +1756,7 @@ def getBicyclicCorrectionThermoDataFromHeuristic(self, bicyclic):
17561756
for aromaticBond in aromaticBonds:
17571757
aromaticBond.setOrderNum(1)
17581758

1759-
submol.saturateUnfilledValence()
1759+
submol.saturate_unfilled_valence()
17601760
submol.update
17611761
single_ring_thermoData = self.__addRingCorrectionThermoDataFromTree(None,
17621762
self.groups['ring'], submol, submol.atoms)[0]

rmgpy/data/thermoTest.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,8 +1201,8 @@ def testSplitBicyclicIntoSingleRings1(self):
12011201
single_ring_submol_a, single_ring_submol_b = sorted(single_ring_submols,
12021202
key=lambda submol: len(submol.atoms))
12031203

1204-
single_ring_submol_a.saturateUnfilledValence()
1205-
single_ring_submol_b.saturateUnfilledValence()
1204+
single_ring_submol_a.saturate_unfilled_valence()
1205+
single_ring_submol_b.saturate_unfilled_valence()
12061206

12071207
expected_submol_a = Molecule().fromSMILES('C1=CC1')
12081208
expected_submol_a.updateConnectivityValues()
@@ -1231,8 +1231,8 @@ def testSplitBicyclicIntoSingleRings2(self):
12311231
single_ring_submol_a, single_ring_submol_b = sorted(single_ring_submols,
12321232
key=lambda submol: len(submol.atoms))
12331233

1234-
single_ring_submol_a.saturateUnfilledValence()
1235-
single_ring_submol_b.saturateUnfilledValence()
1234+
single_ring_submol_a.saturate_unfilled_valence()
1235+
single_ring_submol_b.saturate_unfilled_valence()
12361236

12371237
expected_submol_a = Molecule().fromSMILES('C1=CC1')
12381238
expected_submol_a.updateConnectivityValues()
@@ -1251,7 +1251,7 @@ def testSaturateRingBonds1(self):
12511251
mol = Molecule().fromSMILES(smiles)
12521252
ring_submol = convertRingToSubMolecule(mol.getDisparateRings()[1][0])[0]
12531253

1254-
saturated_ring_submol, alreadySaturated = saturateRingBonds(ring_submol)
1254+
saturated_ring_submol, alreadySaturated = saturate_ring_bonds(ring_submol)
12551255

12561256
expected_saturated_ring_submol = Molecule().fromSMILES('C1CCC2C1C2')
12571257

@@ -1272,7 +1272,7 @@ def testSaturateRingBonds2(self):
12721272
mol = spe.molecule[1]
12731273
ring_submol = convertRingToSubMolecule(mol.getDisparateRings()[1][0])[0]
12741274

1275-
saturated_ring_submol, alreadySaturated = saturateRingBonds(ring_submol)
1275+
saturated_ring_submol, alreadySaturated = saturate_ring_bonds(ring_submol)
12761276

12771277
expected_spe = Species().fromSMILES('C1=CC=C2CCCCC2=C1')
12781278
expected_spe.generateResonanceIsomers()
@@ -1295,7 +1295,7 @@ def testSaturateRingBonds3(self):
12951295
mol = spe.molecule[1]
12961296
ring_submol = convertRingToSubMolecule(mol.getDisparateRings()[1][0])[0]
12971297

1298-
saturated_ring_submol, alreadySaturated = saturateRingBonds(ring_submol)
1298+
saturated_ring_submol, alreadySaturated = saturate_ring_bonds(ring_submol)
12991299

13001300
expected_spe = Species().fromSMILES('C1=CC=C2CCCCC2=C1')
13011301
expected_spe.generateResonanceIsomers()

rmgpy/data/transport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ def estimateCriticalPropertiesViaGroupAdditivity(self, molecule):
450450

451451
# Saturate structure by replacing all radicals with bonds to
452452
# hydrogen atoms
453-
added = saturatedStruct.saturateRadicals()
453+
saturatedStruct.saturate_radicals()
454454

455455
# Get critical point contribution estimates for saturated form of structure
456456
criticalPoint = self.estimateCriticalPropertiesViaGroupAdditivity(saturatedStruct)

rmgpy/molecule/atomtypeTest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ def testSulfurTypes(self):
453453
self.assertEqual(self.atomType(self.mol23, 1), 'S4sc')
454454
self.assertEqual(self.atomType(self.mol25, 2), 'S4d')
455455
self.assertEqual(self.atomType(self.mol26, 1), 'S4dc')
456-
#self.assertEqual(self.atomType(self.mol27, 0), 'S4b') # RMG correctly can't represent heteroatoms in aromatics. See RMG-Py issue #982
456+
#self.assertEqual(self.atomType(self.mol27, 0), 'S4b') # RMG correctly can't represent heteroatoms in aromatics. See RMG-Py issue #982
457457
self.assertEqual(self.atomType(self.mol28, 1), 'S4dd')
458458
self.assertEqual(self.atomType(self.mol38, 1), 'S4dd')
459459
self.assertEqual(self.atomType(self.mol28, 4), 'S4t')

rmgpy/molecule/molecule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,7 @@ def getNetCharge(self):
16571657
charge += atom.charge
16581658
return charge
16591659

1660-
def saturateUnfilledValence(self, update = True):
1660+
def saturate_unfilled_valence(self, update = True):
16611661
"""
16621662
Saturate the molecule by adding H atoms to any unfilled valence
16631663
"""
@@ -1666,7 +1666,7 @@ def saturateUnfilledValence(self, update = True):
16661666
saturator.saturate(self.atoms)
16671667
if update: self.update()
16681668

1669-
def saturateRadicals(self):
1669+
def saturate_radicals(self):
16701670
"""
16711671
Saturate the molecule by replacing all radicals with bonds to hydrogen atoms. Changes self molecule object.
16721672
"""

rmgpy/molecule/moleculeTest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,7 @@ def testSaturateAromaticRadical(self):
14681468
17 H u0 p0 c0 {6,S}
14691469
""")
14701470
saturated_molecule = indenyl.copy(deep=True)
1471-
saturated_molecule.saturateRadicals()
1471+
saturated_molecule.saturate_radicals()
14721472
self.assertTrue(saturated_molecule.isIsomorphic(indene))
14731473

14741474
def testMalformedAugmentedInChI(self):
@@ -2158,7 +2158,7 @@ def testSaturateUnfilleValence(self):
21582158
if atom.isHydrogen(): hydrogens +=1
21592159
self.assertEquals(hydrogens, 0)
21602160

2161-
test.saturateUnfilledValence()
2161+
test.saturate_unfilled_valence()
21622162

21632163
hydrogens = 0
21642164
for atom in test.atoms:
@@ -2177,7 +2177,7 @@ def testSaturateUnfilleValence(self):
21772177
if atom.isHydrogen(): hydrogens +=1
21782178
self.assertEquals(hydrogens, 0)
21792179

2180-
test.saturateUnfilledValence()
2180+
test.saturate_unfilled_valence()
21812181

21822182
hydrogens = 0
21832183
for atom in test.atoms:

rmgpy/test_data/testing_database/thermo/groups/gauche.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
entry(
1010
index = 0,
1111
label = "CsOsCdSs",
12-
group =
12+
group =
1313
"""
1414
1 * [Cs,O2s,Cd,S2s] u0
1515
""",
@@ -20,7 +20,7 @@
2020
S298 = (0,'cal/(mol*K)'),
2121
),
2222
shortDesc = u"""""",
23-
longDesc =
23+
longDesc =
2424
u"""
2525
2626
""",
@@ -29,7 +29,7 @@
2929
entry(
3030
index = 1,
3131
label = "Cs(RRRR)",
32-
group =
32+
group =
3333
"""
3434
1 * Cs u0
3535
""",

rmgpy/tools/uncertainty.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def retrieveSaturatedSpeciesFromList(species, speciesList):
3838
molecule = species.molecule[0]
3939
assert molecule.isRadical(), "Method only valid for radicals."
4040
saturatedStruct = molecule.copy(deep=True)
41-
saturatedStruct.saturateRadicals()
41+
saturatedStruct.saturate_radicals()
4242
for otherSpecies in speciesList:
4343
if otherSpecies.isIsomorphic(saturatedStruct):
4444
return otherSpecies

0 commit comments

Comments
 (0)