From 7096ca77b949fd06d555e81360953ac914c1e1d5 Mon Sep 17 00:00:00 2001 From: Santhosh <52504160+santacodes@users.noreply.github.com> Date: Sun, 7 Jul 2024 12:32:52 +0530 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> --- LICENSE | 2 +- src/pybamm_cookiecutter/parameters/__init__.py | 2 +- src/pybamm_cookiecutter/parameters/input/Chen2020.py | 2 +- src/pybamm_cookiecutter/parameters/parameter_sets.py | 7 +++---- tests/test_entry_points.py | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/LICENSE b/LICENSE index 5bc0eb1..74adb19 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2023-2024, PyBaMM Team +Copyright (c) 2024, PyBaMM Team Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/src/pybamm_cookiecutter/parameters/__init__.py b/src/pybamm_cookiecutter/parameters/__init__.py index 03b07dc..6586100 100644 --- a/src/pybamm_cookiecutter/parameters/__init__.py +++ b/src/pybamm_cookiecutter/parameters/__init__.py @@ -1,3 +1,3 @@ from __future__ import annotations -__all__ = ["parameter_sets", ] +__all__ = ["parameter_sets",] diff --git a/src/pybamm_cookiecutter/parameters/input/Chen2020.py b/src/pybamm_cookiecutter/parameters/input/Chen2020.py index f01381d..0b4a8a4 100644 --- a/src/pybamm_cookiecutter/parameters/input/Chen2020.py +++ b/src/pybamm_cookiecutter/parameters/input/Chen2020.py @@ -1,5 +1,5 @@ """ -This code is adopted from the PyBaMM project under the BSD 3-Clause +This code is adopted from the PyBaMM project under the BSD-3-Clause Copyright (c) 2018-2024, the PyBaMM team. All rights reserved. diff --git a/src/pybamm_cookiecutter/parameters/parameter_sets.py b/src/pybamm_cookiecutter/parameters/parameter_sets.py index b317cb7..e970a71 100644 --- a/src/pybamm_cookiecutter/parameters/parameter_sets.py +++ b/src/pybamm_cookiecutter/parameters/parameter_sets.py @@ -63,14 +63,14 @@ class ParameterSets(Mapping): """ def __init__(self): - '''Dict of entry points for parameter sets, lazily load entry points as''' + """Dict of entry points for parameter sets, lazily load entry points as""" self.__all_parameter_sets = dict() for entry_point in self.get_entries("cookie_parameter_sets"): self.__all_parameter_sets[entry_point.name] = entry_point @staticmethod def get_entries(group_name): - '''Wrapper for the importlib version logic''' + """Wrapper for the importlib version logic""" if sys.version_info < (3, 10): # pragma: no cover return importlib.metadata.entry_points()[group_name] else: @@ -87,8 +87,7 @@ def __getitem__(self, key) -> dict: def _load_entry_point(self, key) -> Callable: """Check that ``key`` is a registered ``cookie_parameter_sets``, - and return the entry point for the parameter set, loading it needed. - """ + and return the entry point for the parameter set, loading it needed.""" if key not in self.__all_parameter_sets: raise KeyError(f"Unknown parameter set: {key}") ps = self.__all_parameter_sets[key] diff --git a/tests/test_entry_points.py b/tests/test_entry_points.py index 58cee98..84b4383 100644 --- a/tests/test_entry_points.py +++ b/tests/test_entry_points.py @@ -9,7 +9,7 @@ def test_entry_points(): entry_points = list(pybamm_cookiecutter.parameter_sets) parameter_sets = Path("src/pybamm_cookiecutter/parameters/input/").glob("*.py") - # Making a list Parameter sets in the parameters/input directory + # Making a list of parameter sets in the parameters/input directory parameter_sets = [x.stem for x in parameter_sets] assert parameter_sets == entry_points, "Entry points missing either in pyproject.toml or in the input directory"