diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index abf7fc7..76e5849 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -17,7 +17,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pylint + pip install 'pylint==3.2.7' - name: Analysing the code with pylint run: | - pylint $(git ls-files '*.py') --rcfile .pylintrc --fail-under=7.0 + pylint $(git ls-files '*.py') --rcfile .pylintrc diff --git a/.pylintrc b/.pylintrc index 3a7dc9f..0dc1a02 100644 --- a/.pylintrc +++ b/.pylintrc @@ -16,4 +16,6 @@ method-rgx=(([a-z][a-zA-Z0-9]*)|([A-Z][a-zA-Z0-9]+))$ module-rgx=(([a-z][a-z0-9]*)|([A-Z][a-zA-Z0-9]+))$ [MASTER] +fail-under=7.0 +persistent=no ignore-patterns=(.)*_test\.py,test_(.)*\.py diff --git a/TurtleMol/avogadroPlugin/definiteBox.py b/TurtleMol/avogadroPlugin/definiteBox.py index cab536f..47c588b 100644 --- a/TurtleMol/avogadroPlugin/definiteBox.py +++ b/TurtleMol/avogadroPlugin/definiteBox.py @@ -110,7 +110,7 @@ def runCommand(): strucIO = io.StringIO(iparams['structureFile']) - struc = pd.read_csv(strucIO, delim_whitespace=',', + struc = pd.read_csv(strucIO, sep=r'\s+', skiprows=2, names=["Atom", "X", "Y", "Z"]) diff --git a/TurtleMol/avogadroPlugin/definiteMesh.py b/TurtleMol/avogadroPlugin/definiteMesh.py index 8b0828e..441249b 100644 --- a/TurtleMol/avogadroPlugin/definiteMesh.py +++ b/TurtleMol/avogadroPlugin/definiteMesh.py @@ -96,7 +96,7 @@ def runCommand(): strucIO = io.StringIO(iparams['structureFile']) - struc = pd.read_csv(strucIO, delim_whitespace=',', + struc = pd.read_csv(strucIO, sep=r'\s+', skiprows=2, names=["Atom", "X", "Y", "Z"]) diff --git a/TurtleMol/avogadroPlugin/definiteSphere.py b/TurtleMol/avogadroPlugin/definiteSphere.py index c86a81c..9c8a195 100644 --- a/TurtleMol/avogadroPlugin/definiteSphere.py +++ b/TurtleMol/avogadroPlugin/definiteSphere.py @@ -90,7 +90,7 @@ def runCommand(): strucIO = io.StringIO(iparams['structureFile']) - struc = pd.read_csv(strucIO, delim_whitespace=',', + struc = pd.read_csv(strucIO, sep=r'\s+', skiprows=2, names=["Atom", "X", "Y", "Z"]) diff --git a/TurtleMol/avogadroPlugin/densityBox.py b/TurtleMol/avogadroPlugin/densityBox.py index e0d6d1a..e507195 100644 --- a/TurtleMol/avogadroPlugin/densityBox.py +++ b/TurtleMol/avogadroPlugin/densityBox.py @@ -104,7 +104,7 @@ def runCommand(): strucIO = io.StringIO(iparams['structureFile']) - struc = pd.read_csv(strucIO, delim_whitespace=',', + struc = pd.read_csv(strucIO, sep=r'\s+', skiprows=2, names=["Atom", "X", "Y", "Z"]) diff --git a/TurtleMol/avogadroPlugin/densityMesh.py b/TurtleMol/avogadroPlugin/densityMesh.py index 83218d9..bda31f1 100644 --- a/TurtleMol/avogadroPlugin/densityMesh.py +++ b/TurtleMol/avogadroPlugin/densityMesh.py @@ -104,7 +104,7 @@ def runCommand(): strucIO = io.StringIO(iparams['structureFile']) - struc = pd.read_csv(strucIO, delim_whitespace=',', + struc = pd.read_csv(strucIO, sep=r'\s+', skiprows=2, names=["Atom", "X", "Y", "Z"]) diff --git a/TurtleMol/avogadroPlugin/densitySphere.py b/TurtleMol/avogadroPlugin/densitySphere.py index c890054..4df6aa6 100644 --- a/TurtleMol/avogadroPlugin/densitySphere.py +++ b/TurtleMol/avogadroPlugin/densitySphere.py @@ -84,7 +84,7 @@ def runCommand(): strucIO = io.StringIO(iparams['structureFile']) - struc = pd.read_csv(strucIO, delim_whitespace=',', + struc = pd.read_csv(strucIO, sep=r'\s+', skiprows=2, names=["Atom", "X", "Y", "Z"]) diff --git a/TurtleMol/avogadroPlugin/fillBox.py b/TurtleMol/avogadroPlugin/fillBox.py index b425c8e..5200a77 100644 --- a/TurtleMol/avogadroPlugin/fillBox.py +++ b/TurtleMol/avogadroPlugin/fillBox.py @@ -95,7 +95,7 @@ def runCommand(): strucIO = io.StringIO(iparams['structureFile']) - struc = pd.read_csv(strucIO, delim_whitespace=',', + struc = pd.read_csv(strucIO, sep=r'\s+', skiprows=2, names=["Atom", "X", "Y", "Z"]) diff --git a/TurtleMol/avogadroPlugin/fillMesh.py b/TurtleMol/avogadroPlugin/fillMesh.py index 340be56..1f67974 100644 --- a/TurtleMol/avogadroPlugin/fillMesh.py +++ b/TurtleMol/avogadroPlugin/fillMesh.py @@ -89,7 +89,7 @@ def runCommand(): strucIO = io.StringIO(iparams['structureFile']) - struc = pd.read_csv(strucIO, delim_whitespace=',', + struc = pd.read_csv(strucIO, sep=r'\s+', skiprows=2, names=["Atom", "X", "Y", "Z"]) diff --git a/TurtleMol/avogadroPlugin/fillSphere.py b/TurtleMol/avogadroPlugin/fillSphere.py index e5ae84a..5d06732 100644 --- a/TurtleMol/avogadroPlugin/fillSphere.py +++ b/TurtleMol/avogadroPlugin/fillSphere.py @@ -75,7 +75,7 @@ def runCommand(): strucIO = io.StringIO(iparams['structureFile']) - struc = pd.read_csv(strucIO, delim_whitespace=',', + struc = pd.read_csv(strucIO, sep=r'\s+', skiprows=2, names=["Atom", "X", "Y", "Z"]) diff --git a/TurtleMol/readWriteFiles.py b/TurtleMol/readWriteFiles.py index d73ef9c..eb3b495 100644 --- a/TurtleMol/readWriteFiles.py +++ b/TurtleMol/readWriteFiles.py @@ -26,7 +26,7 @@ def readStrucFile(filePath): '''Reads structure file''' # Reads XYZ if str(filePath[-3:]).lower() == 'xyz': - return pd.read_csv(filePath, delim_whitespace=True, + return pd.read_csv(filePath, sep=r'\s+', skiprows=2, names=["Atom", "X", "Y", "Z"]), None, None # Reads PDB if str(filePath[-3:]).lower() == 'pdb': diff --git a/tests/test_BaseStruc.py b/tests/test_BaseStruc.py index 43e61f1..ae3f7ed 100644 --- a/tests/test_BaseStruc.py +++ b/tests/test_BaseStruc.py @@ -32,10 +32,12 @@ def testBaseStruc(): if name not in iparamsCube: iparamsCube[name] = dparams[name] - struc, unitCell = readStrucFile(iparamsSphere['structureFile']) + struc, unitCell, connectivity = readStrucFile(iparamsSphere['structureFile']) if iparamsSphere['baseStrucFile']: - baseStruc, baseUnitCell = readStrucFile(iparamsSphere['baseStrucFile']) + baseStruc, baseUnitCell, baseConnectivity = readStrucFile( + iparamsSphere['baseStrucFile'] + ) else: baseStruc = None diff --git a/tests/test_atomFill.py b/tests/test_atomFill.py index b816012..fac0ac9 100644 --- a/tests/test_atomFill.py +++ b/tests/test_atomFill.py @@ -30,10 +30,10 @@ def testAtomFill(): if name not in iparamsCube: iparamsCube[name] = dparams[name] - struc, unitCell = readStrucFile(iparamsSphere['structureFile']) + struc, unitCell, connectivity = readStrucFile(iparamsSphere['structureFile']) if iparamsSphere['baseStrucFile']: - baseStruc = readStrucFile(iparamsSphere['baseStrucFile']) + baseStruc, _, _ = readStrucFile(iparamsSphere['baseStrucFile']) else: baseStruc = None @@ -45,4 +45,4 @@ def testAtomFill(): outStrucSphere, strucTypeSphere = drawMolSphere(struc, baseStruc, iparamsSphere) assert len(outStrucSphere) != 0, "Output structure should have some length" - assert strucTypeSphere == "atom", "Structure type should be an atom" \ No newline at end of file + assert strucTypeSphere == "atom", "Structure type should be an atom" diff --git a/tests/test_atomRandomPlace.py b/tests/test_atomRandomPlace.py index 458f087..87bf8f8 100644 --- a/tests/test_atomRandomPlace.py +++ b/tests/test_atomRandomPlace.py @@ -32,10 +32,10 @@ def testRandomPlace(): if name not in iparamsCube: iparamsCube[name] = dparams[name] - struc, unitCell = readStrucFile(iparamsSphere['structureFile']) + struc, unitCell, connectivity = readStrucFile(iparamsSphere['structureFile']) if iparamsSphere['baseStrucFile']: - baseStruc = readStrucFile(iparamsSphere['baseStrucFile']) + baseStruc, _, _ = readStrucFile(iparamsSphere['baseStrucFile']) else: baseStruc = None @@ -45,4 +45,4 @@ def testRandomPlace(): outStrucSphere, strucTypeSphere = drawMolSphere(struc, baseStruc, iparamsSphere) assert len(outStrucSphere) != 0, "Output structure should have some length" - assert strucTypeSphere == "atom", "Structure type should be an atom" \ No newline at end of file + assert strucTypeSphere == "atom", "Structure type should be an atom" diff --git a/tests/test_moleculeFill.py b/tests/test_moleculeFill.py index 12291c3..41695e6 100644 --- a/tests/test_moleculeFill.py +++ b/tests/test_moleculeFill.py @@ -30,10 +30,10 @@ def testMoleculeFill(): if name not in iparamsCube: iparamsCube[name] = dparams[name] - struc, unitCell = readStrucFile(iparamsSphere['structureFile']) + struc, unitCell, connectivity = readStrucFile(iparamsSphere['structureFile']) if iparamsSphere['baseStrucFile']: - baseStruc = readStrucFile(iparamsSphere['baseStrucFile']) + baseStruc, _, _ = readStrucFile(iparamsSphere['baseStrucFile']) else: baseStruc = None @@ -43,4 +43,4 @@ def testMoleculeFill(): outStrucSphere, strucTypeSphere = drawMolSphere(struc, baseStruc, iparamsSphere) assert len(outStrucSphere) != 0, "Output structure should have some length" - assert strucTypeSphere == "molecule", "Structure type should be an atom" \ No newline at end of file + assert strucTypeSphere == "molecule", "Structure type should be an atom" diff --git a/tests/test_moleculeRandomPlace.py b/tests/test_moleculeRandomPlace.py index d820f4c..76c62ec 100644 --- a/tests/test_moleculeRandomPlace.py +++ b/tests/test_moleculeRandomPlace.py @@ -32,10 +32,12 @@ def testMoleculeRandomPlace(): if name not in iparamsCube: iparamsCube[name] = dparams[name] - struc, unitCell = readStrucFile(iparamsSphere['structureFile']) + struc, unitCell, connectivity = readStrucFile(iparamsSphere['structureFile']) if iparamsSphere['baseStrucFile']: - baseStruc, baseUnitCell = readStrucFile(iparamsSphere['baseStrucFile']) + baseStruc, baseUnitCell, baseConnectivity = readStrucFile( + iparamsSphere['baseStrucFile'] + ) else: baseStruc = None @@ -45,4 +47,4 @@ def testMoleculeRandomPlace(): outStrucSphere, strucTypeSphere = drawMolSphere(struc, baseStruc, iparamsSphere) assert len(outStrucSphere) != 0, "Output structure should have some length" - assert strucTypeSphere == "molecule", "Structure type should be an atom" \ No newline at end of file + assert strucTypeSphere == "molecule", "Structure type should be an atom" diff --git a/tests/test_randOrient.py b/tests/test_randOrient.py index 6544c7f..5514b5f 100644 --- a/tests/test_randOrient.py +++ b/tests/test_randOrient.py @@ -32,10 +32,10 @@ def testRandOrient(): if name not in iparamsCube: iparamsCube[name] = dparams[name] - struc, unitCell = readStrucFile(iparamsSphere['structureFile']) + struc, unitCell, connectivity = readStrucFile(iparamsSphere['structureFile']) if iparamsSphere['baseStrucFile']: - baseStruc = readStrucFile(iparamsSphere['baseStrucFile']) + baseStruc, _, _ = readStrucFile(iparamsSphere['baseStrucFile']) else: baseStruc = None @@ -45,4 +45,4 @@ def testRandOrient(): outStrucSphere, strucTypeSphere = drawMolSphere(struc, baseStruc, iparamsSphere) assert len(outStrucSphere) != 0, "Output structure should have some length" - assert strucTypeSphere == "molecule", "Structure type should be an atom" \ No newline at end of file + assert strucTypeSphere == "molecule", "Structure type should be an atom" diff --git a/tests/test_readWritePDB.py b/tests/test_readWritePDB.py index 1b9e141..55d48c1 100644 --- a/tests/test_readWritePDB.py +++ b/tests/test_readWritePDB.py @@ -30,10 +30,10 @@ def testReadWritePDB(): if name not in iparamsCube: iparamsCube[name] = dparams[name] - struc, unitCell = readStrucFile(iparamsSphere['structureFile']) + struc, unitCell, connectivity = readStrucFile(iparamsSphere['structureFile']) if iparamsSphere['baseStrucFile']: - baseStruc = readStrucFile(iparamsSphere['baseStrucFile']) + baseStruc, _, _ = readStrucFile(iparamsSphere['baseStrucFile']) else: baseStruc = None @@ -45,4 +45,4 @@ def testReadWritePDB(): outStrucSphere, strucTypeSphere = drawMolSphere(struc, baseStruc, iparamsSphere) assert len(outStrucSphere) != 0, "Output structure should have some length" assert strucTypeSphere == "molecule", "Structure type should be an atom" - assert isinstance(outStrucSphere[0][0][-1], str), 'Final place should be residue ID' \ No newline at end of file + assert isinstance(outStrucSphere[0][0][-1], str), 'Final place should be residue ID'