diff --git a/maml/apps/bowsr/model/cgcnn.py b/maml/apps/bowsr/model/cgcnn.py index b056e0ae..12cc0cd7 100644 --- a/maml/apps/bowsr/model/cgcnn.py +++ b/maml/apps/bowsr/model/cgcnn.py @@ -16,7 +16,7 @@ from cgcnn.data import AtomCustomJSONInitializer, GaussianDistance from cgcnn.model import CrystalGraphConvNet from torch import Tensor -except ImportError as error: +except ImportError: torch = None # type: ignore cgcnn = None # type: ignore Tensor = None # type: ignore diff --git a/maml/apps/bowsr/model/megnet.py b/maml/apps/bowsr/model/megnet.py index 8dbcd9c7..2a6f2e5d 100644 --- a/maml/apps/bowsr/model/megnet.py +++ b/maml/apps/bowsr/model/megnet.py @@ -16,7 +16,7 @@ from megnet.data.crystal import CrystalGraph from megnet.data.graph import GaussianDistance from megnet.models import MEGNetModel -except Exception as error: +except Exception: megnet = None MEGNetModel = None CrystalGraph = None diff --git a/maml/apps/bowsr/model/tests/test_cgcnn.py b/maml/apps/bowsr/model/tests/test_cgcnn.py index 5e76f32b..b4cea323 100644 --- a/maml/apps/bowsr/model/tests/test_cgcnn.py +++ b/maml/apps/bowsr/model/tests/test_cgcnn.py @@ -9,7 +9,7 @@ try: import cgcnn -except ImportError as e: +except ImportError: cgcnn = None module_dir = os.path.dirname(__file__) diff --git a/maml/apps/bowsr/optimizer.py b/maml/apps/bowsr/optimizer.py index c756752a..cc3f01cc 100644 --- a/maml/apps/bowsr/optimizer.py +++ b/maml/apps/bowsr/optimizer.py @@ -13,9 +13,17 @@ from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernels import RationalQuadratic -from maml.apps.bowsr.acquisition import AcquisitionFunction, ensure_rng, propose_query_point +from maml.apps.bowsr.acquisition import ( + AcquisitionFunction, + ensure_rng, + propose_query_point, +) from maml.apps.bowsr.model import EnergyModel -from maml.apps.bowsr.perturbation import LatticePerturbation, WyckoffPerturbation, get_standardized_structure +from maml.apps.bowsr.perturbation import ( + LatticePerturbation, + WyckoffPerturbation, + get_standardized_structure, +) from maml.apps.bowsr.preprocessing import DummyScaler, StandardScaler from maml.apps.bowsr.target_space import TargetSpace diff --git a/maml/apps/bowsr/tests/test_acquisition.py b/maml/apps/bowsr/tests/test_acquisition.py index f0aa009f..18b90a93 100644 --- a/maml/apps/bowsr/tests/test_acquisition.py +++ b/maml/apps/bowsr/tests/test_acquisition.py @@ -6,7 +6,12 @@ from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernels import Matern, RationalQuadratic -from maml.apps.bowsr.acquisition import AcquisitionFunction, ensure_rng, predict_mean_std, propose_query_point +from maml.apps.bowsr.acquisition import ( + AcquisitionFunction, + ensure_rng, + predict_mean_std, + propose_query_point, +) from maml.apps.bowsr.preprocessing import DummyScaler, StandardScaler diff --git a/maml/apps/bowsr/tests/test_target_space.py b/maml/apps/bowsr/tests/test_target_space.py index ab79557b..2226fc01 100644 --- a/maml/apps/bowsr/tests/test_target_space.py +++ b/maml/apps/bowsr/tests/test_target_space.py @@ -5,7 +5,6 @@ from pymatgen.core.structure import Structure from maml.apps.bowsr.acquisition import ensure_rng -from maml.apps.bowsr.optimizer import struct2perturbation from maml.apps.bowsr.perturbation import WyckoffPerturbation from maml.apps.bowsr.preprocessing import DummyScaler, StandardScaler from maml.apps.bowsr.target_space import TargetSpace @@ -226,28 +225,28 @@ def test_set_empty(self): for i in range(10): sample = self.space1.uniform_sample() - target1 = self.space1.probe(sample) + self.space1.probe(sample) self.assertEqual(len(self.space1), i + 1) self.space1.set_empty() self.assertEqual(len(self.space1), 0) for i in range(20): sample = self.space2.uniform_sample() - target1 = self.space2.probe(sample) + self.space2.probe(sample) self.assertEqual(len(self.space2), i + 1) self.space2.set_empty() self.assertEqual(len(self.space2), 0) for i in range(15): sample = self.space3.uniform_sample() - target1 = self.space3.probe(sample) + self.space3.probe(sample) self.assertEqual(len(self.space3), i + 1) self.space3.set_empty() self.assertEqual(len(self.space3), 0) for i in range(10): sample = self.space4.uniform_sample() - target1 = self.space4.probe(sample) + self.space4.probe(sample) self.assertEqual(len(self.space4), i + 1) self.space4.set_empty() self.assertEqual(len(self.space4), 0) diff --git a/maml/apps/pes/_base.py b/maml/apps/pes/_base.py index d589e3b2..2ce3f4a8 100644 --- a/maml/apps/pes/_base.py +++ b/maml/apps/pes/_base.py @@ -61,7 +61,6 @@ def predict_efs(self, structure): Returns: energy, forces, stress """ - pass @abc.abstractmethod def write_param(self): @@ -84,5 +83,3 @@ class Potential(PotentialMixin, BaseModel): # type: ignore Potential models that can be used to fit structure-[energy, force, stress] pairs """ - - pass diff --git a/maml/apps/pes/_lammps.py b/maml/apps/pes/_lammps.py index 2d2f656a..95d4e7f2 100644 --- a/maml/apps/pes/_lammps.py +++ b/maml/apps/pes/_lammps.py @@ -17,7 +17,11 @@ from pymatgen.io.lammps.data import LammpsData from maml.apps.pes._base import Potential -from maml.utils import get_lammps_lattice_and_rotation, stress_list_to_matrix, stress_matrix_to_list +from maml.utils import ( + get_lammps_lattice_and_rotation, + stress_list_to_matrix, + stress_matrix_to_list, +) logging.basicConfig() logger = logging.getLogger(__name__) diff --git a/maml/apps/pes/_snap.py b/maml/apps/pes/_snap.py index d7d7984d..95106e14 100644 --- a/maml/apps/pes/_snap.py +++ b/maml/apps/pes/_snap.py @@ -12,7 +12,12 @@ from maml.base import SKLModel from maml.describers import BispectrumCoefficients -from maml.utils import check_structures_forces_stresses, convert_docs, pool_from, stress_format_change +from maml.utils import ( + check_structures_forces_stresses, + convert_docs, + pool_from, + stress_format_change, +) from ._lammps import LammpsPotential diff --git a/maml/apps/symbolic/tests/test_selectors.py b/maml/apps/symbolic/tests/test_selectors.py index c471cd2e..3e847cee 100644 --- a/maml/apps/symbolic/tests/test_selectors.py +++ b/maml/apps/symbolic/tests/test_selectors.py @@ -10,12 +10,23 @@ try: import cvxpy as cp - from maml.apps.symbolic._selectors_cvxpy import AdaptiveLassoCP, DantzigSelectorCP, LassoCP, cp + from maml.apps.symbolic._selectors_cvxpy import ( + AdaptiveLassoCP, + DantzigSelectorCP, + LassoCP, + cp, + ) except ImportError: cp = None # noqa -from maml.apps.symbolic._selectors import SCAD, AdaptiveLasso, DantzigSelector, L0BrutalForce, Lasso +from maml.apps.symbolic._selectors import ( + SCAD, + AdaptiveLasso, + DantzigSelector, + L0BrutalForce, + Lasso, +) CWD = os.path.abspath(os.path.dirname(__file__)) diff --git a/maml/base/__init__.py b/maml/base/__init__.py index 2252fcf4..459ecb83 100644 --- a/maml/base/__init__.py +++ b/maml/base/__init__.py @@ -5,10 +5,21 @@ Define abstract base classes. """ from ._data import BaseDataSource # noqa -from ._describer import BaseDescriber, DummyDescriber, SequentialDescriber, describer_type # noqa +from ._describer import ( # noqa + BaseDescriber, + DummyDescriber, + SequentialDescriber, + describer_type, +) from ._feature_batch import get_feature_batch from ._mixin import TargetScalerMixin -from ._model import BaseModel, KerasModel, SKLModel, is_keras_model, is_sklearn_model # noqa +from ._model import ( # noqa + BaseModel, + KerasModel, + SKLModel, + is_keras_model, + is_sklearn_model, +) __all__ = [ "BaseDataSource", diff --git a/maml/base/_data.py b/maml/base/_data.py index a176f916..49e8b6a7 100644 --- a/maml/base/_data.py +++ b/maml/base/_data.py @@ -16,4 +16,3 @@ def get(self, *args, **kwargs) -> pd.DataFrame: """ Get data from sources """ - pass diff --git a/maml/describers/__init__.py b/maml/describers/__init__.py index 0135335e..ac1115b7 100644 --- a/maml/describers/__init__.py +++ b/maml/describers/__init__.py @@ -5,10 +5,20 @@ from ._composition import ElementProperty, ElementStats # noqa from ._site import SmoothOverlapAtomicPosition # noqa -from ._site import BispectrumCoefficients, BPSymmetryFunctions, MEGNetSite, SiteElementProperty # noqa +from ._site import ( # noqa + BispectrumCoefficients, + BPSymmetryFunctions, + MEGNetSite, + SiteElementProperty, +) from ._structure import CoulombMatrix # noqa from ._structure import SortedCoulombMatrix # noqa -from ._structure import CoulombEigenSpectrum, DistinctSiteProperty, MEGNetStructure, RandomizedCoulombMatrix +from ._structure import ( + CoulombEigenSpectrum, + DistinctSiteProperty, + MEGNetStructure, + RandomizedCoulombMatrix, +) __all__ = [ "BispectrumCoefficients", diff --git a/maml/describers/_composition.py b/maml/describers/_composition.py index 5c88d38b..fe20a711 100644 --- a/maml/describers/_composition.py +++ b/maml/describers/_composition.py @@ -27,7 +27,9 @@ try: - from matminer.featurizers.composition import ElementProperty as MatminerElementProperty # noqa + from matminer.featurizers.composition import ( # noqa + ElementProperty as MatminerElementProperty, + ) ElementProperty = wrap_matminer_describer( "ElementProperty", MatminerElementProperty, to_composition, describer_type="composition" diff --git a/maml/models/dl/tests/test_atomsets.py b/maml/models/dl/tests/test_atomsets.py index b59bc60e..7065fd27 100644 --- a/maml/models/dl/tests/test_atomsets.py +++ b/maml/models/dl/tests/test_atomsets.py @@ -1,7 +1,7 @@ """ Test models """ -from unittest import TestCase, main, skip +from unittest import TestCase, main import numpy as np diff --git a/maml/utils/__init__.py b/maml/utils/__init__.py index 8fa7c1bd..451a2f30 100644 --- a/maml/utils/__init__.py +++ b/maml/utils/__init__.py @@ -9,11 +9,26 @@ from ._lammps import stress_format_change # noqa from ._lammps import stress_list_to_matrix # noqa from ._lammps import write_data_from_structure # noqa -from ._lammps import check_structures_forces_stresses, get_lammps_lattice_and_rotation, stress_matrix_to_list # noqa +from ._lammps import ( # noqa + check_structures_forces_stresses, + get_lammps_lattice_and_rotation, + stress_matrix_to_list, +) from ._material import to_composition # noqa from ._preprocessing import DummyScaler, Scaler, StandardScaler # noqa -from ._signal_processing import cwt, fft_magnitude, get_sp_method, spectrogram, wvd # noqa -from ._stats import STATS_KWARGS, Stats, get_full_stats_and_funcs, stats_list_conversion # noqa +from ._signal_processing import ( # noqa + cwt, + fft_magnitude, + get_sp_method, + spectrogram, + wvd, +) +from ._stats import ( # noqa + STATS_KWARGS, + Stats, + get_full_stats_and_funcs, + stats_list_conversion, +) from ._tempfile import MultiScratchDir # noqa from ._value_profile import ConstantValue, LinearProfile, ValueProfile # noqa diff --git a/maml/utils/_data_split.py b/maml/utils/_data_split.py index 0e6bec1f..fd299c72 100644 --- a/maml/utils/_data_split.py +++ b/maml/utils/_data_split.py @@ -24,7 +24,6 @@ def split(self, mat_ids, **kwargs): Returns: (train_ids, val_ids, test_ids) or (train_ids, test_ids) """ - pass class ShuffleSplitter(DataSplitter): diff --git a/requirements-ci.txt b/requirements-ci.txt index 7af51789..900ae6ba 100644 --- a/requirements-ci.txt +++ b/requirements-ci.txt @@ -5,4 +5,4 @@ mypy==0.941 pydocstyle==6.1.1 pylint==2.12.2 black==22.1.0 -flake8==4.0.1 \ No newline at end of file +flake8==4.0.1 diff --git a/requirements-dl.txt b/requirements-dl.txt index aa037f4c..7497e72f 100644 --- a/requirements-dl.txt +++ b/requirements-dl.txt @@ -1,2 +1,2 @@ tensorflow==2.8.0 -torch==1.11.0 \ No newline at end of file +torch==1.11.0 diff --git a/requirements.txt b/requirements.txt index 657ef669..d2fc2ed8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,4 +7,4 @@ scikit-learn==1.0.2 h5py==3.6.0 joblib==1.1.0 tqdm==4.63.0 -pymongo==4.0.1 \ No newline at end of file +pymongo==4.0.1 diff --git a/tasks.py b/tasks.py index cdd56d04..770acd11 100644 --- a/tasks.py +++ b/tasks.py @@ -9,8 +9,6 @@ import json import os import re -import subprocess -import webbrowser import requests from invoke import task