Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Agriya Khetarpal <[email protected]>
  • Loading branch information
santacodes and agriyakhetarpal authored Jul 7, 2024
1 parent 72b9d25 commit 7096ca7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/pybamm_cookiecutter/parameters/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from __future__ import annotations

__all__ = ["parameter_sets", ]
__all__ = ["parameter_sets",]
2 changes: 1 addition & 1 deletion src/pybamm_cookiecutter/parameters/input/Chen2020.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
7 changes: 3 additions & 4 deletions src/pybamm_cookiecutter/parameters/parameter_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_entry_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 7096ca7

Please sign in to comment.