From b04a6ea65698662eab7a212a8238366e35b56e6b Mon Sep 17 00:00:00 2001 From: Brewster Malevich Date: Wed, 3 Apr 2024 17:01:05 -0700 Subject: [PATCH 1/3] Minor ruff config cleanup, avoid deprecation --- .github/workflows/pythonpackage.yaml | 2 +- pyproject.toml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yaml b/.github/workflows/pythonpackage.yaml index 53349f1..a0eade6 100644 --- a/.github/workflows/pythonpackage.yaml +++ b/.github/workflows/pythonpackage.yaml @@ -34,7 +34,7 @@ jobs: pip install -r requirements.txt - name: Format check with ruff run: | - ruff check . + ruff check . --diff test: runs-on: ubuntu-latest diff --git a/pyproject.toml b/pyproject.toml index e584b97..baa41e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,6 +53,8 @@ exclude = [ ".eggs", "docs", ] + +[tool.ruff.lint] # E402: module level import not at top of file ignore = [ "E402", @@ -65,4 +67,4 @@ select = [ "W", # Pyupgrade "UP", -] +] \ No newline at end of file From 97fa5b5d0c734e6759337306f658efa3990075ef Mon Sep 17 00:00:00 2001 From: Brewster Malevich Date: Wed, 3 Apr 2024 17:04:28 -0700 Subject: [PATCH 2/3] Cleanup, ruff bump to v0.3.5 --- requirements.txt | 2 +- src/parameterize_jobs/parameterize_jobs.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index 1018c5e..d514fe1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ numpy==1.26.4 pytest==8.1.1 pytest-cov==5.0.0 -ruff==0.3.0 +ruff==0.3.5 diff --git a/src/parameterize_jobs/parameterize_jobs.py b/src/parameterize_jobs/parameterize_jobs.py index d9868d7..7f2d854 100644 --- a/src/parameterize_jobs/parameterize_jobs.py +++ b/src/parameterize_jobs/parameterize_jobs.py @@ -50,9 +50,10 @@ def __getitem__(self, idx): elif isinstance(idx, int): if (idx >= len(self)) or (idx < -1 * len(self)): + name = self.__class__.__name__ + n = len(self) raise KeyError( - 'index {} out of bounds for {} with length {}' - .format(idx, self.__class__.__name__, len(self))) + f'index {idx} out of bounds for {name} with length {n}') lens = list(map(len, self._sets.values())) cplens = list(_cumprod(list( @@ -137,9 +138,10 @@ def __len__(self): def __getitem__(self, idx): if (idx >= len(self)) or (idx < -1 * len(self)): + name = self.__class__.__name__ + n = len(self) raise KeyError( - 'index {} out of bounds for {} with length {}' - .format(idx, self.__class__.__name__, len(self))) + f'index {idx} out of bounds for {name} with length {n}') idx = idx % len(self) From 5ec602be6481e5dcaf79290dceca076ba878af1a Mon Sep 17 00:00:00 2001 From: Brewster Malevich Date: Wed, 3 Apr 2024 17:04:37 -0700 Subject: [PATCH 3/3] Entry for HISTORY --- HISTORY.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 9ff9892..e7cf487 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,7 +6,7 @@ History Unreleased ---------- -* +* Minor code format cleanup, ruff config update. 0.2.0 (2023-09-01)