From b0807bf481635854176245542691b265c4a62ba2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 23:05:29 +0000 Subject: [PATCH 1/2] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.3 → v0.8.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.3...v0.8.6) - [github.com/pre-commit/pre-commit-hooks: v4.6.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.6.0...v5.0.0) - [github.com/psf/black: 24.8.0 → 24.10.0](https://github.com/psf/black/compare/24.8.0...24.10.0) - [github.com/pre-commit/mirrors-mypy: v1.11.2 → v1.14.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.2...v1.14.1) - [github.com/MarcoGorelli/cython-lint: v0.16.2 → v0.16.6](https://github.com/MarcoGorelli/cython-lint/compare/v0.16.2...v0.16.6) --- .pre-commit-config.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7d362b58..68a6bfd0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,13 +8,13 @@ ci: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.3 + rev: v0.8.6 hooks: - id: ruff args: [--fix] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-yaml exclude: pymatgen/analysis/vesta_cutoffs.yaml @@ -22,12 +22,12 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 24.8.0 + rev: 24.10.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.11.2 + rev: v1.14.1 hooks: - id: mypy @@ -35,12 +35,12 @@ repos: rev: v2.3.0 hooks: - id: codespell - stages: [commit, commit-msg] + stages: [pre-commit, commit-msg] exclude_types: [html] additional_dependencies: [tomli] # needed to read pyproject.toml below py3.11 - repo: https://github.com/MarcoGorelli/cython-lint - rev: v0.16.2 + rev: v0.16.6 hooks: - id: cython-lint args: [--no-pycodestyle] From 855ba29ef1b40dbd5245e25d1fbf72a4bbbac783 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 23:06:19 +0000 Subject: [PATCH 2/2] pre-commit auto-fixes --- src/maml/apps/bowsr/optimizer.py | 2 +- src/maml/apps/gbe/describer.py | 4 +-- src/maml/apps/pes/__init__.py | 16 +++++------ src/maml/apps/symbolic/__init__.py | 10 +++---- src/maml/base/__init__.py | 8 +++--- src/maml/base/_model.py | 2 +- src/maml/describers/__init__.py | 18 ++++++------ src/maml/describers/_site.py | 4 +-- src/maml/describers/_structure.py | 4 +-- src/maml/models/__init__.py | 2 +- src/maml/models/dl/__init__.py | 2 +- src/maml/models/dl/_keras_utils.py | 4 +-- src/maml/utils/__init__.py | 46 +++++++++++++++--------------- src/maml/utils/_lammps.py | 2 +- src/maml/utils/_preprocessing.py | 2 +- src/maml/utils/_stats.py | 12 ++++---- src/maml/utils/_value_profile.py | 2 +- 17 files changed, 70 insertions(+), 70 deletions(-) diff --git a/src/maml/apps/bowsr/optimizer.py b/src/maml/apps/bowsr/optimizer.py index ae5a798f..bdd08693 100644 --- a/src/maml/apps/bowsr/optimizer.py +++ b/src/maml/apps/bowsr/optimizer.py @@ -392,7 +392,7 @@ def as_dict(self): def serialize(t) -> tuple: """ - serialize the object. + Serialize the object. Args: t: object diff --git a/src/maml/apps/gbe/describer.py b/src/maml/apps/gbe/describer.py index 8a9ba5a7..bbdc8b30 100644 --- a/src/maml/apps/gbe/describer.py +++ b/src/maml/apps/gbe/describer.py @@ -37,7 +37,7 @@ def convert_hcp_direction(rotation_axis: list, lat_type: str) -> np.ndarray: """ - four index notion to three index notion for hcp and rhombohedral axis + Four index notion to three index notion for hcp and rhombohedral axis Args: rotation_axis (list): four index notion of axis lat_type(str): the @@ -66,7 +66,7 @@ def convert_hcp_direction(rotation_axis: list, lat_type: str) -> np.ndarray: def convert_hcp_plane(plane: list) -> np.ndarray: """ - four index notion to three index notion for hcp and rhombohedral plane + Four index notion to three index notion for hcp and rhombohedral plane Args: plane (list): four index notion. diff --git a/src/maml/apps/pes/__init__.py b/src/maml/apps/pes/__init__.py index dcf47ecd..78eca345 100644 --- a/src/maml/apps/pes/__init__.py +++ b/src/maml/apps/pes/__init__.py @@ -23,17 +23,17 @@ from ._snap import SNAPotential __all__ = [ - "Potential", + "DefectFormation", + "ElasticConstant", + "EnergyForceStress", "GAPotential", - "MTPotential", - "SNAPotential", - "NNPotential", "LMPStaticCalculator", - "EnergyForceStress", - "SpectralNeighborAnalysis", - "ElasticConstant", "LatticeConstant", + "MTPotential", + "NNPotential", "NudgedElasticBand", - "DefectFormation", + "Potential", + "SNAPotential", + "SpectralNeighborAnalysis", "get_default_lmp_exe", ] diff --git a/src/maml/apps/symbolic/__init__.py b/src/maml/apps/symbolic/__init__.py index 86792c76..b3837fa6 100644 --- a/src/maml/apps/symbolic/__init__.py +++ b/src/maml/apps/symbolic/__init__.py @@ -20,13 +20,13 @@ from ._selectors_cvxpy import LassoCP as Lasso # type: ignore __all__ = [ - "DantzigSelector", - "AdaptiveLasso", + "ISIS", "SCAD", - "Lasso", "SIS", - "ISIS", - "L0BrutalForce", + "AdaptiveLasso", + "DantzigSelector", "FeatureGenerator", + "L0BrutalForce", + "Lasso", "Operator", ] diff --git a/src/maml/base/__init__.py b/src/maml/base/__init__.py index ca640da7..5312b505 100644 --- a/src/maml/base/__init__.py +++ b/src/maml/base/__init__.py @@ -13,14 +13,14 @@ __all__ = [ "BaseDataSource", "BaseDescriber", - "SequentialDescriber", - "DummyDescriber", "BaseModel", + "DummyDescriber", "KerasModel", "SKLModel", - "get_feature_batch", + "SequentialDescriber", + "TargetScalerMixin", "describer_type", + "get_feature_batch", "is_keras_model", "is_sklearn_model", - "TargetScalerMixin", ] diff --git a/src/maml/base/_model.py b/src/maml/base/_model.py index 7adcbd1f..0fa5b4ac 100644 --- a/src/maml/base/_model.py +++ b/src/maml/base/_model.py @@ -336,7 +336,7 @@ def fit( @staticmethod def _get_validation_data(val_features, val_targets, **val_kwargs): """ - construct validation data, the default is just returning a list of + Construct validation data, the default is just returning a list of val_features and val_targets. """ return val_features, val_targets diff --git a/src/maml/describers/__init__.py b/src/maml/describers/__init__.py index e392a5ff..270cfcc1 100644 --- a/src/maml/describers/__init__.py +++ b/src/maml/describers/__init__.py @@ -20,21 +20,21 @@ ) __all__ = [ - "BispectrumCoefficients", - "SmoothOverlapAtomicPosition", "BPSymmetryFunctions", - "DistinctSiteProperty", + "BispectrumCoefficients", + "CoulombEigenSpectrum", "CoulombMatrix", - "SortedCoulombMatrix", - "RandomizedCoulombMatrix", + "DistinctSiteProperty", "ElementProperty", "ElementStats", + "M3GNetSite", + "M3GNetStructure", "MEGNetSite", "MEGNetStructure", - "CoulombEigenSpectrum", + "RadialDistributionFunction", + "RandomizedCoulombMatrix", "SiteElementProperty", + "SmoothOverlapAtomicPosition", + "SortedCoulombMatrix", "wrap_matminer_describer", - "M3GNetStructure", - "M3GNetSite", - "RadialDistributionFunction", ] diff --git a/src/maml/describers/_site.py b/src/maml/describers/_site.py index 29c0577e..2010f40c 100644 --- a/src/maml/describers/_site.py +++ b/src/maml/describers/_site.py @@ -19,10 +19,10 @@ from maml.utils import pool_from, to_composition __all__ = [ - "BispectrumCoefficients", - "SmoothOverlapAtomicPosition", "BPSymmetryFunctions", + "BispectrumCoefficients", "SiteElementProperty", + "SmoothOverlapAtomicPosition", ] diff --git a/src/maml/describers/_structure.py b/src/maml/describers/_structure.py index 2f69055c..de0010ff 100644 --- a/src/maml/describers/_structure.py +++ b/src/maml/describers/_structure.py @@ -20,11 +20,11 @@ __all__ = [ - "DistinctSiteProperty", + "CoulombEigenSpectrum", "CoulombMatrix", + "DistinctSiteProperty", "RandomizedCoulombMatrix", "SortedCoulombMatrix", - "CoulombEigenSpectrum", ] diff --git a/src/maml/models/__init__.py b/src/maml/models/__init__.py index 9f2c5732..6d8fbb81 100644 --- a/src/maml/models/__init__.py +++ b/src/maml/models/__init__.py @@ -6,4 +6,4 @@ from .dl import MLP, AtomSets, WeightedAverageLayer, WeightedSet2Set -__all__ = ["SKLModel", "KerasModel", "AtomSets", "MLP", "WeightedSet2Set", "WeightedAverageLayer"] +__all__ = ["MLP", "AtomSets", "KerasModel", "SKLModel", "WeightedAverageLayer", "WeightedSet2Set"] diff --git a/src/maml/models/dl/__init__.py b/src/maml/models/dl/__init__.py index c8b2fd5f..1dd335a4 100644 --- a/src/maml/models/dl/__init__.py +++ b/src/maml/models/dl/__init__.py @@ -6,4 +6,4 @@ from ._layers import WeightedAverageLayer, WeightedSet2Set from ._mlp import MLP -__all__ = ["WeightedAverageLayer", "WeightedSet2Set", "AtomSets", "MLP"] +__all__ = ["MLP", "AtomSets", "WeightedAverageLayer", "WeightedSet2Set"] diff --git a/src/maml/models/dl/_keras_utils.py b/src/maml/models/dl/_keras_utils.py index 0962b871..136852ca 100644 --- a/src/maml/models/dl/_keras_utils.py +++ b/src/maml/models/dl/_keras_utils.py @@ -5,7 +5,7 @@ def deserialize_keras_activation(activation): """ - serialize keras activation. + Serialize keras activation. Args: activation (str, dict, or Activation object): activation to serialize @@ -28,7 +28,7 @@ def deserialize_keras_activation(activation): def deserialize_keras_optimizer(optimizer): """ - serialize keras activation. + Serialize keras activation. Args: optimizer (str, dict, or optimizer object): optimizer to serialize diff --git a/src/maml/utils/__init__.py b/src/maml/utils/__init__.py index f5bc3b3d..6d187034 100644 --- a/src/maml/utils/__init__.py +++ b/src/maml/utils/__init__.py @@ -23,36 +23,36 @@ from ._value_profile import ConstantValue, LinearProfile, ValueProfile __all__ = [ - "pool_from", - "convert_docs", - "to_array", - "ValueProfile", + "STATS_KWARGS", "ConstantValue", + "DataSplitter", + "DummyScaler", "LinearProfile", - "njit", "MultiScratchDir", - "DataSplitter", + "Scaler", "ShuffleSplitter", - "write_data_from_structure", - "check_structures_forces_stresses", - "stress_format_change", - "stress_list_to_matrix", - "stress_matrix_to_list", - "get_lammps_lattice_and_rotation", + "StandardScaler", "Stats", - "STATS_KWARGS", - "stats_list_conversion", - "get_full_stats_and_funcs", - "spectrogram", + "ValueProfile", + "check_structures_forces_stresses", + "convert_docs", "cwt", - "wvd", + "feature_dim_from_test_system", "fft_magnitude", + "get_describer_dummy_obj", + "get_full_args", + "get_full_stats_and_funcs", + "get_lammps_lattice_and_rotation", "get_sp_method", + "njit", + "pool_from", + "spectrogram", + "stats_list_conversion", + "stress_format_change", + "stress_list_to_matrix", + "stress_matrix_to_list", + "to_array", "to_composition", - "get_full_args", - "get_describer_dummy_obj", - "feature_dim_from_test_system", - "StandardScaler", - "Scaler", - "DummyScaler", + "write_data_from_structure", + "wvd", ] diff --git a/src/maml/utils/_lammps.py b/src/maml/utils/_lammps.py index ab0f2343..3a4b2ab9 100644 --- a/src/maml/utils/_lammps.py +++ b/src/maml/utils/_lammps.py @@ -136,7 +136,7 @@ def stress_matrix_to_list(stress_matrix: np.ndarray, stress_format: str = "VASP" def stress_list_to_matrix(stress: np.ndarray | list[float], stress_format: str = "VASP") -> np.ndarray: """ - convert a length-6 stress list to stress matrix 3x3. + Convert a length-6 stress list to stress matrix 3x3. Args: stress (list of float): list of stress diff --git a/src/maml/utils/_preprocessing.py b/src/maml/utils/_preprocessing.py index b2618ec9..2b84087f 100644 --- a/src/maml/utils/_preprocessing.py +++ b/src/maml/utils/_preprocessing.py @@ -136,7 +136,7 @@ def transform(target: float, n: int = 1) -> float: @staticmethod def inverse_transform(transformed_target: float, n: int = 1) -> float: """ - return as it is + Return as it is Args: transformed_target (float): transformed target n (int): number of atoms diff --git a/src/maml/utils/_stats.py b/src/maml/utils/_stats.py index 2c631a40..4240b629 100644 --- a/src/maml/utils/_stats.py +++ b/src/maml/utils/_stats.py @@ -59,7 +59,7 @@ def max(data: list[float], weights: list[float] | None = None) -> float: @staticmethod def min(data: list[float], weights: list[float] | None = None) -> float: """ - min of value + Min of value Args: data (list): list of float data weights (list): optional weights. @@ -114,7 +114,7 @@ def mode(data: list[float], weights: list[float] | None = None) -> float: @staticmethod def mean_absolute_deviation(data: list[float], weights: list[float] | None = None) -> float: """ - mean absolute deviation. + Mean absolute deviation. Args: data (list): list of float data @@ -129,7 +129,7 @@ def mean_absolute_deviation(data: list[float], weights: list[float] | None = Non @staticmethod def mean_absolute_error(data: list[float], weights: list[float] | None = None) -> float: """ - mean absolute error. + Mean absolute error. Args: data (list): list of float data @@ -199,7 +199,7 @@ def mean(data: list[float], weights: list[float] | None = None) -> float: @staticmethod def inverse_mean(data: list[float], weights: list[float] | None = None) -> float: """ - inverse mean. + Inverse mean. Args: data (list): list of float data @@ -291,7 +291,7 @@ def geometric_mean(data: list[float], weights: list[float] | None = None) -> flo @staticmethod def power_mean(data: list[float], weights: list[float] | None = None, p: int = 1) -> float: """ - power mean https://en.wikipedia.org/wiki/Generalized_mean. + Power mean https://en.wikipedia.org/wiki/Generalized_mean. Args: data (list): list of float data @@ -335,7 +335,7 @@ def shifted_geometric_mean(data: list[float], weights: list[float] | None = None @staticmethod def harmonic_mean(data: list[float], weights: list[float] | None = None) -> float: """ - harmonic mean of the data. + Harmonic mean of the data. Args: data (list): list of float data diff --git a/src/maml/utils/_value_profile.py b/src/maml/utils/_value_profile.py index 36c7d9cc..ed0eda21 100644 --- a/src/maml/utils/_value_profile.py +++ b/src/maml/utils/_value_profile.py @@ -37,7 +37,7 @@ def increment_step(self): def get_value(self) -> float: """ - abstract method that returns the current value + Abstract method that returns the current value Returns: value float. """