From eaddab02ecf405c997b5b8e363ddf5a63eb927d5 Mon Sep 17 00:00:00 2001 From: Alejandro Velez Date: Tue, 5 Mar 2024 14:11:47 -0500 Subject: [PATCH 1/2] add YAPF to GH Action --- .github/workflows/conda-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/conda-tests.yml b/.github/workflows/conda-tests.yml index dc9a52b8..88d72159 100644 --- a/.github/workflows/conda-tests.yml +++ b/.github/workflows/conda-tests.yml @@ -36,10 +36,11 @@ jobs: auto-update-conda: true auto-activate-base: true - - name: Create and start Conda environment. Run tests. + - name: Create and start Conda environment. Run tests. Run YAPF run: | echo "Creating Conda Environment from environment.yml" conda env create -f environment.yml conda activate tdc-conda-env python run_tests.py + yapf --style=google -r -d tdc conda deactivate From 44d945c7c8fcd6a470c69383ae4490d2475053c1 Mon Sep 17 00:00:00 2001 From: Alejandro Velez Date: Tue, 5 Mar 2024 14:27:40 -0500 Subject: [PATCH 2/2] remaining lint errors --- tdc/multi_pred/__init__.py | 2 +- tdc/test/dev_tests/chem_utils_test/test_molconverter.py | 3 +-- tdc/test/dev_tests/chem_utils_test/test_molfilter.py | 3 +-- tdc/test/dev_tests/chem_utils_test/test_oracles.py | 2 -- tdc/test/dev_tests/utils_tests/test_misc_utils.py | 7 +------ tdc/test/dev_tests/utils_tests/test_splits.py | 6 ------ tdc/utils/label.py | 6 ++++-- 7 files changed, 8 insertions(+), 21 deletions(-) diff --git a/tdc/multi_pred/__init__.py b/tdc/multi_pred/__init__.py index 6d4527d6..94c58e5d 100644 --- a/tdc/multi_pred/__init__.py +++ b/tdc/multi_pred/__init__.py @@ -10,4 +10,4 @@ from .ppi import PPI from .test_multi_pred import TestMultiPred from .tcr_epi import TCREpitopeBinding -from .trialoutcome import TrialOutcome \ No newline at end of file +from .trialoutcome import TrialOutcome diff --git a/tdc/test/dev_tests/chem_utils_test/test_molconverter.py b/tdc/test/dev_tests/chem_utils_test/test_molconverter.py index c08b847a..bb925dda 100644 --- a/tdc/test/dev_tests/chem_utils_test/test_molconverter.py +++ b/tdc/test/dev_tests/chem_utils_test/test_molconverter.py @@ -21,7 +21,6 @@ def setUp(self): print(os.getcwd()) pass - def test_MolConvert(self): from tdc.chem_utils import MolConvert @@ -35,7 +34,7 @@ def test_MolConvert(self): MolConvert.eligible_format() - # + # def tearDown(self): print(os.getcwd()) diff --git a/tdc/test/dev_tests/chem_utils_test/test_molfilter.py b/tdc/test/dev_tests/chem_utils_test/test_molfilter.py index 95bf402c..c9fbcc1b 100644 --- a/tdc/test/dev_tests/chem_utils_test/test_molfilter.py +++ b/tdc/test/dev_tests/chem_utils_test/test_molfilter.py @@ -21,14 +21,13 @@ def setUp(self): print(os.getcwd()) pass - def test_MolConvert(self): from tdc.chem_utils import MolFilter filters = MolFilter(filters=["PAINS"], HBD=[0, 6]) filters(["CCSc1ccccc1C(=O)Nc1onc2c1CCC2"]) - # + # def tearDown(self): print(os.getcwd()) diff --git a/tdc/test/dev_tests/chem_utils_test/test_oracles.py b/tdc/test/dev_tests/chem_utils_test/test_oracles.py index 884e8a55..48c4ac48 100644 --- a/tdc/test/dev_tests/chem_utils_test/test_oracles.py +++ b/tdc/test/dev_tests/chem_utils_test/test_oracles.py @@ -21,7 +21,6 @@ def setUp(self): print(os.getcwd()) pass - def test_Oracle(self): from tdc import Oracle @@ -35,7 +34,6 @@ def test_Oracle(self): oracle = Oracle(name="Hop") x = oracle(["CC(=O)OC1=CC=CC=C1C(=O)O", "C1=CC=C(C=C1)C=O"]) - def test_distribution(self): from tdc import Evaluator diff --git a/tdc/test/dev_tests/utils_tests/test_misc_utils.py b/tdc/test/dev_tests/utils_tests/test_misc_utils.py index c28e1bdb..8c4b1f17 100644 --- a/tdc/test/dev_tests/utils_tests/test_misc_utils.py +++ b/tdc/test/dev_tests/utils_tests/test_misc_utils.py @@ -33,7 +33,6 @@ def test_neg_sample(self): # data = ADME(name='Caco2_Wang') # x = data.label_distribution() - def test_get_label_map(self): from tdc.multi_pred import DDI from tdc.utils import get_label_map @@ -42,26 +41,22 @@ def test_get_label_map(self): split = data.get_split() get_label_map(name="DrugBank", task="DDI") - def test_balanced(self): from tdc.single_pred import HTS data = HTS(name="SARSCoV2_3CLPro_Diamond") data.balanced(oversample=True, seed=42) - def test_cid2smiles(self): from tdc.utils import cid2smiles smiles = cid2smiles(2248631) - def test_uniprot2seq(self): from tdc.utils import uniprot2seq seq = uniprot2seq("P49122") - def test_to_graph(self): from tdc.multi_pred import DTI @@ -95,7 +90,7 @@ def test_to_graph(self): ) # output: {'pyg_graph': the PyG graph object, 'index_to_entities': a dict map from ID in the data to node ID in the PyG object, 'split': {'train': df, 'valid': df, 'test': df}} - # + # def tearDown(self): print(os.getcwd()) diff --git a/tdc/test/dev_tests/utils_tests/test_splits.py b/tdc/test/dev_tests/utils_tests/test_splits.py index fdf22ac1..69759416 100644 --- a/tdc/test/dev_tests/utils_tests/test_splits.py +++ b/tdc/test/dev_tests/utils_tests/test_splits.py @@ -21,14 +21,12 @@ def setUp(self): print(os.getcwd()) pass - def test_random_split(self): from tdc.single_pred import ADME data = ADME(name="Caco2_Wang") split = data.get_split(method="random") - def test_scaffold_split(self): ## requires RDKit from tdc.single_pred import ADME @@ -36,7 +34,6 @@ def test_scaffold_split(self): data = ADME(name="Caco2_Wang") split = data.get_split(method="scaffold") - def test_cold_start_split(self): from tdc.multi_pred import DTI @@ -70,21 +67,18 @@ def test_cold_start_split(self): self.assertEqual(0, len(train_entity.intersection(test_entity))) self.assertEqual(0, len(valid_entity.intersection(test_entity))) - def test_combination_split(self): from tdc.multi_pred import DrugSyn data = DrugSyn(name="DrugComb") split = data.get_split(method="combination") - def test_time_split(self): from tdc.multi_pred import DTI data = DTI(name="BindingDB_Patent") split = data.get_split(method="time", time_column="Year") - def test_tearDown(self): print(os.getcwd()) diff --git a/tdc/utils/label.py b/tdc/utils/label.py index b875d882..6814633d 100644 --- a/tdc/utils/label.py +++ b/tdc/utils/label.py @@ -222,7 +222,8 @@ def NegSample(df, column_names, frac, two_types): 4: "Y" }) ], - ignore_index=True, sort=False) + ignore_index=True, + sort=False) return df else: df_unique_id1 = np.unique(df[id1].values.reshape(-1)) @@ -267,5 +268,6 @@ def NegSample(df, column_names, frac, two_types): 4: "Y" }) ], - ignore_index=True, sort=False) + ignore_index=True, + sort=False) return df