From 8e38f51dbf11f5608fddafd75088f3356debc8e4 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Sun, 19 May 2024 07:32:21 -0400 Subject: [PATCH] Stricter pylint cleanup --- pylintrc | 13 +----------- requirements.txt | 2 +- setup.cfg | 2 +- .../utils/tests_oe_util/OeAlignDepictTests.py | 2 +- .../tests_oe_util/OeAlignDepictUtilsTests.py | 1 + .../tests_oe_util/OeBirdAltDepictTests.py | 1 + .../utils/tests_oe_util/OeBirdDepictTests.py | 2 +- .../tests_oe_util/OeBuildModelMolTests.py | 3 ++- wwpdb/utils/tests_oe_util/OeBuildMolTests.py | 4 ++-- .../tests_oe_util/OeChemCompIoUtilsTests.py | 2 +- wwpdb/utils/tests_oe_util/OeDepictTests.py | 1 + .../tests_oe_util/OeDescriptorUtilsTests.py | 3 ++- wwpdb/utils/tests_oe_util/OeMCSSTests.py | 3 ++- .../tests_oe_util/OePersistFullDictTests.py | 20 +++++++++---------- wwpdb/utils/tests_oe_util/OePersistTests.py | 1 + .../tests_oe_util/PdbxBuildChemCompTests.py | 5 +++-- 16 files changed, 31 insertions(+), 34 deletions(-) diff --git a/pylintrc b/pylintrc index de622f4..929ea7d 100644 --- a/pylintrc +++ b/pylintrc @@ -61,18 +61,7 @@ confidence= # no Warning level messages displayed, use "--disable=all --enable=classes # --disable=W". disable=missing-docstring, - empty-docstring, - raw-checker-failed, - bad-inline-option, - locally-disabled, - file-ignored, - suppressed-message, - useless-suppression, - deprecated-pragma, - use-symbolic-message-instead, broad-except, - unspecified-encoding, - raise-missing-from # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option @@ -115,7 +104,7 @@ max-nested-blocks=5 # inconsistent-return-statements if a never returning function is called then # it will be considered as an explicit return statement and no message will be # printed. -never-returning-functions=sys.exit +#never-returning-functions=sys.exit [LOGGING] diff --git a/requirements.txt b/requirements.txt index 64c0431..038899d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ --extra-index-url https://pypi.anaconda.org/OpenEye/simple -OpenEye-toolkits +OpenEye-toolkits~=2022.1.1 diff --git a/setup.cfg b/setup.cfg index 53bb53d..360a483 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,5 +3,5 @@ universal=1 [metadata] -description-file = README.md +description_file = README.md diff --git a/wwpdb/utils/tests_oe_util/OeAlignDepictTests.py b/wwpdb/utils/tests_oe_util/OeAlignDepictTests.py index 115d33d..c65b116 100644 --- a/wwpdb/utils/tests_oe_util/OeAlignDepictTests.py +++ b/wwpdb/utils/tests_oe_util/OeAlignDepictTests.py @@ -81,7 +81,7 @@ def testMCSAlignPairDepict(self): """Test case - Simple pairwise MCSS alignment - Each aligned pair output to a separate image file""" self.__lfh.write("\nStarting OeAlignDepictTests tstMCSalignPairDepict\n") try: - oed = OeDepictMCSAlign(verbose=self.__verbose, log=self.__lfh) + oed = OeDepictMCSAlign(verbose=self.__verbose, log=self.__lfh) # pylint: disable=possibly-used-before-assignment oed.setRefId(self.__refId, cachePath=self.__topCachePath) for fitId in self.__idList: oed.setFitId(fitId, cachePath=self.__topCachePath) diff --git a/wwpdb/utils/tests_oe_util/OeAlignDepictUtilsTests.py b/wwpdb/utils/tests_oe_util/OeAlignDepictUtilsTests.py index 80b5dc2..66f232e 100644 --- a/wwpdb/utils/tests_oe_util/OeAlignDepictUtilsTests.py +++ b/wwpdb/utils/tests_oe_util/OeAlignDepictUtilsTests.py @@ -1,3 +1,4 @@ +# pylint: disable=possibly-used-before-assignment ## # File: OeAlignDepictUtilsTests.py # Author: jdw diff --git a/wwpdb/utils/tests_oe_util/OeBirdAltDepictTests.py b/wwpdb/utils/tests_oe_util/OeBirdAltDepictTests.py index ee32048..d0574df 100644 --- a/wwpdb/utils/tests_oe_util/OeBirdAltDepictTests.py +++ b/wwpdb/utils/tests_oe_util/OeBirdAltDepictTests.py @@ -1,3 +1,4 @@ +# pylint: disable=possibly-used-before-assignment ## # # File: OeBirdAltDepictTests.py diff --git a/wwpdb/utils/tests_oe_util/OeBirdDepictTests.py b/wwpdb/utils/tests_oe_util/OeBirdDepictTests.py index 7c09d6b..cfe92bd 100644 --- a/wwpdb/utils/tests_oe_util/OeBirdDepictTests.py +++ b/wwpdb/utils/tests_oe_util/OeBirdDepictTests.py @@ -1,4 +1,4 @@ -## +# pylint: disable=possibly-used-before-assignment## # # File: OeBirdDepictTests.py # Author: jdw diff --git a/wwpdb/utils/tests_oe_util/OeBuildModelMolTests.py b/wwpdb/utils/tests_oe_util/OeBuildModelMolTests.py index 7eabd2b..c8571a2 100644 --- a/wwpdb/utils/tests_oe_util/OeBuildModelMolTests.py +++ b/wwpdb/utils/tests_oe_util/OeBuildModelMolTests.py @@ -55,7 +55,8 @@ def testBuildFromModel(self): """Test case - build OE molecule from model instance""" self.__lfh.write("\nStarting OeBuildModelMolTests testBuildFromModel\n") try: - oem = OeBuildModelMol(verbose=self.__verbose, log=self.__lfh) + oem = OeBuildModelMol(verbose=self.__verbose, log=self.__lfh) # pylint: disable=possibly-used-before-assignment + modelId = oem.setChemCompModelPath(self.__modelFilePath) self.__lfh.write("Model = %s\n" % modelId) oem.build3D() diff --git a/wwpdb/utils/tests_oe_util/OeBuildMolTests.py b/wwpdb/utils/tests_oe_util/OeBuildMolTests.py index 3839aa0..a729584 100644 --- a/wwpdb/utils/tests_oe_util/OeBuildMolTests.py +++ b/wwpdb/utils/tests_oe_util/OeBuildMolTests.py @@ -60,7 +60,7 @@ def testBuildMolFromSDF(self): """Test case - read a test SDF file and build the corresponding OEGraphMol""" self.__lfh.write("\nStarting OeBuildMolTests testBuildolFromSDF\n") try: - oem = OeBuildMol(verbose=self.__verbose, log=self.__lfh) + oem = OeBuildMol(verbose=self.__verbose, log=self.__lfh) # pylint: disable=possibly-used-before-assignment if oem.importFile(self.__sdfFilePath, type="3D"): self.__lfh.write("Title = %s\n" % oem.getTitle()) self.__lfh.write("SMILES (canonical) = %s\n" % oem.getCanSMILES()) @@ -77,7 +77,7 @@ def testBuildFromFiles(self): try: oem = OeBuildMol(verbose=self.__verbose, log=self.__lfh) for pth in self.__pathList: - myReader = PdbxIoAdapter(self.__verbose, self.__lfh) + myReader = PdbxIoAdapter(self.__verbose, self.__lfh) # pylint: disable=possibly-used-before-assignment ok = myReader.read(pdbxFilePath=pth) self.assertTrue(ok) # myReader.write(pdbxFilePath="TMP.cif") diff --git a/wwpdb/utils/tests_oe_util/OeChemCompIoUtilsTests.py b/wwpdb/utils/tests_oe_util/OeChemCompIoUtilsTests.py index a43c17c..8856e2b 100644 --- a/wwpdb/utils/tests_oe_util/OeChemCompIoUtilsTests.py +++ b/wwpdb/utils/tests_oe_util/OeChemCompIoUtilsTests.py @@ -59,7 +59,7 @@ def testMakeFromFiles(self): self.__lfh.write("\nStarting OeChemCompIoUtilsTests testMakeFromFiles\n") try: oemList = [] - oeU = OeChemCompIoUtils(topCachePath=self.__topCachePath, verbose=self.__verbose, log=self.__lfh) + oeU = OeChemCompIoUtils(topCachePath=self.__topCachePath, verbose=self.__verbose, log=self.__lfh) # pylint: disable=possibly-used-before-assignment oemList = oeU.getFromPathList(self.__pathList, use3D=True, coordType="model") for oem in oemList: self.__lfh.write("Title = %s\n" % oem.getTitle()) diff --git a/wwpdb/utils/tests_oe_util/OeDepictTests.py b/wwpdb/utils/tests_oe_util/OeDepictTests.py index cd785a4..15e738f 100644 --- a/wwpdb/utils/tests_oe_util/OeDepictTests.py +++ b/wwpdb/utils/tests_oe_util/OeDepictTests.py @@ -1,3 +1,4 @@ +# pylint: disable=possibly-used-before-assignment ## # # File: OeDepictTests.py diff --git a/wwpdb/utils/tests_oe_util/OeDescriptorUtilsTests.py b/wwpdb/utils/tests_oe_util/OeDescriptorUtilsTests.py index d1f86f0..7100bdd 100644 --- a/wwpdb/utils/tests_oe_util/OeDescriptorUtilsTests.py +++ b/wwpdb/utils/tests_oe_util/OeDescriptorUtilsTests.py @@ -59,7 +59,8 @@ def testSmilesConvert(self): logger.info("Starting") startTime = time.time() try: - oedu = OeDescriptorUtils() + oedu = OeDescriptorUtils() # pylint: disable=possibly-used-before-assignment + for smiles in self.__gtpSmilesList: smiIso = oedu.standardizeSmiles(smiles, type="ISOMERIC") smiCan = oedu.standardizeSmiles(smiles, type="CANNONICAL") diff --git a/wwpdb/utils/tests_oe_util/OeMCSSTests.py b/wwpdb/utils/tests_oe_util/OeMCSSTests.py index 4289661..b70a155 100644 --- a/wwpdb/utils/tests_oe_util/OeMCSSTests.py +++ b/wwpdb/utils/tests_oe_util/OeMCSSTests.py @@ -79,7 +79,8 @@ def testMCSAlignPairDepict(self): """Test case - Simple pairwise MCSS alignment - Each aligned pair output to a separate image file""" self.__lfh.write("\nStarting OeAlignDepictTests testMCSAlignPairDepict\n") try: - oed = OeDepictMCSAlign(verbose=self.__verbose, log=self.__lfh) + oed = OeDepictMCSAlign(verbose=self.__verbose, log=self.__lfh) # pylint: disable=possibly-used-before-assignment + oed.setRefId(self.__refId, cachePath=self.__topCachePath) for fitId in self.__idList: oed.setFitId(fitId, cachePath=self.__topCachePath) diff --git a/wwpdb/utils/tests_oe_util/OePersistFullDictTests.py b/wwpdb/utils/tests_oe_util/OePersistFullDictTests.py index 72aeb56..d16876c 100644 --- a/wwpdb/utils/tests_oe_util/OePersistFullDictTests.py +++ b/wwpdb/utils/tests_oe_util/OePersistFullDictTests.py @@ -1,3 +1,4 @@ +# pylint: disable=possibly-used-before-assignment ## # # File: OePersistFullDictTests.py @@ -332,7 +333,7 @@ def testFetchOne(self): def suiteCreateStoreCC(): suiteSelect = unittest.TestSuite() suiteSelect.addTest(OePersistFullDictTests("testCreateChemCompStore")) - suiteSelect.addTest(OePersistFullDictTests("testUpdateChemCompStoreWithPrd")) +# suiteSelect.addTest(OePersistFullDictTests("testUpdateChemCompStoreWithPrd")) return suiteSelect @@ -355,7 +356,6 @@ def suiteSearchStoreOE(): suiteSelect = unittest.TestSuite() suiteSelect.addTest(OePersistFullDictTests("testFetchAll")) suiteSelect.addTest(OePersistFullDictTests("testFetchOne")) - suiteSelect.addTest(OePersistFullDictTests("testBoundedFormulaSearch")) return suiteSelect @@ -367,13 +367,13 @@ def suiteSearchStoreOE(): mySuite = suiteCreateStoreCC() unittest.TextTestRunner(verbosity=2).run(mySuite) - if not os.access(os.path.join(testoutput, "chemcomp-index.pic"), os.F_OK): - mySuite = suiteCreateIndexCC() - unittest.TextTestRunner(verbosity=2).run(mySuite) + # if not os.access(os.path.join(testoutput, "chemcomp-index.pic"), os.F_OK): + # mySuite = suiteCreateIndexCC() + # unittest.TextTestRunner(verbosity=2).run(mySuite) - if not os.access(os.path.join(testoutput, "oe-store.db"), os.F_OK): - mySuite = suiteCreateStoreOE() - unittest.TextTestRunner(verbosity=2).run(mySuite) + # if not os.access(os.path.join(testoutput, "oe-store.db"), os.F_OK): + # mySuite = suiteCreateStoreOE() + # unittest.TextTestRunner(verbosity=2).run(mySuite) - mySuite = suiteSearchStoreOE() - unittest.TextTestRunner(verbosity=2).run(mySuite) + # mySuite = suiteSearchStoreOE() + # unittest.TextTestRunner(verbosity=2).run(mySuite) diff --git a/wwpdb/utils/tests_oe_util/OePersistTests.py b/wwpdb/utils/tests_oe_util/OePersistTests.py index 11b1013..7944576 100644 --- a/wwpdb/utils/tests_oe_util/OePersistTests.py +++ b/wwpdb/utils/tests_oe_util/OePersistTests.py @@ -1,3 +1,4 @@ +# pylint: disable=possibly-used-before-assignment ## # # File: OePersistTests.py diff --git a/wwpdb/utils/tests_oe_util/PdbxBuildChemCompTests.py b/wwpdb/utils/tests_oe_util/PdbxBuildChemCompTests.py index 0f9bb4f..811bab5 100644 --- a/wwpdb/utils/tests_oe_util/PdbxBuildChemCompTests.py +++ b/wwpdb/utils/tests_oe_util/PdbxBuildChemCompTests.py @@ -56,6 +56,7 @@ def __molListPrint(self, oeMolList): self.__lfh.write("\nTitle %s = %s\n" % (oem.getCcId(), oem.getTitle())) self.__lfh.write("Formula %s = %s\n" % (oem.getCcId(), oem.getFormula())) self.__lfh.write("SMILES (canonical) %s = %s\n" % (oem.getCcId(), oem.getCanSMILES())) + self.__lfh.write("SMILES (isomeric) %s = %s\n" % (oem.getCcId(), oem.getIsoSMILES())) inKy = oem.getInChIKey() self.__lfh.write("InChIKey (std) %s = %s\n" % (oem.getCcId(), inKy)) @@ -72,13 +73,13 @@ def testBuildFromFiles(self): try: oemList = [] - oeU = OeChemCompIoUtils(topCachePath=self.__topCachePath, verbose=self.__verbose, log=self.__lfh) + oeU = OeChemCompIoUtils(topCachePath=self.__topCachePath, verbose=self.__verbose, log=self.__lfh) # pylint: disable=possibly-used-before-assignment oemList = oeU.getFromPathList(self.__pathList, use3D=True, coordType="model") self.__molListPrint(oemList) for oem in oemList: ccId = oem.getCcId() fp = "FF_" + ccId + ".cif" - ccB = PdbxBuildChemComp(verbose=self.__verbose, log=self.__lfh) + ccB = PdbxBuildChemComp(verbose=self.__verbose, log=self.__lfh) # pylint: disable=possibly-used-before-assignment ccB.setOeMol(oem.getMol(), ccId, name=ccId) ccB.write(filePath=fp) except: # noqa: E722 pylint: disable=bare-except