Skip to content

Commit 789eb4e

Browse files
[pre-commit.ci] pre-commit autoupdate (#205)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.11.4](astral-sh/ruff-pre-commit@v0.8.6...v0.11.4) - [github.com/psf/black: 24.10.0 → 25.1.0](psf/black@24.10.0...25.1.0) - [github.com/pre-commit/mirrors-mypy: v1.14.1 → v1.15.0](pre-commit/mirrors-mypy@v1.14.1...v1.15.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * ci: fix config --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Nathaniel Starkman <[email protected]>
1 parent c14e44f commit 789eb4e

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ repos:
3535
- id: text-unicode-replacement-char
3636

3737
- repo: https://github.com/astral-sh/ruff-pre-commit
38-
rev: "v0.8.6"
38+
rev: "v0.11.4"
3939
hooks:
4040
- id: ruff
4141
args:
4242
- --fix
4343

4444
- repo: https://github.com/psf/black
45-
rev: 24.10.0
45+
rev: 25.1.0
4646
hooks:
4747
- id: black
4848
additional_dependencies: [toml]
@@ -54,7 +54,7 @@ repos:
5454
additional_dependencies: [black]
5555

5656
- repo: https://github.com/pre-commit/mirrors-mypy
57-
rev: "v1.14.1"
57+
rev: "v1.15.0"
5858
hooks:
5959
- id: mypy
6060
additional_dependencies:

pyproject.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,11 @@ where = ["src"]
143143
[tool.ruff]
144144
target-version = "py310"
145145
line-length = 88
146+
147+
[tool.ruff.lint]
146148
select = ["ALL"]
147149
ignore = [
148-
"ANN101", "ANN102", "ANN401",
150+
"ANN401",
149151
"ARG001", "ARG002",
150152
"D105", "D107", "D203", "D213",
151153
"ERA001",
@@ -169,14 +171,14 @@ ignore = [
169171
"TD",
170172
]
171173

172-
[tool.ruff.flake8-tidy-imports]
174+
[tool.ruff.lint.flake8-tidy-imports]
173175
ban-relative-imports = "all"
174176

175-
[tool.ruff.isort]
177+
[tool.ruff.lint.isort]
176178
force-sort-within-sections = true
177179
known-third-party = ["numpy", "pytest", "torch"]
178180
known-first-party = ["stream_mapper.core"]
179181
known-local-folder = ["stream_mapper.pytorch"]
180182

181-
[tool.ruff.pylint]
183+
[tool.ruff.lint.pylint]
182184
max-args = 6

src/stream_mapper/pytorch/_base.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
__all__: tuple[str, ...] = ()
66

77
from dataclasses import KW_ONLY, dataclass
8-
from typing import TYPE_CHECKING, Any, TypeVar
8+
from typing import TYPE_CHECKING, Any
99

1010
import torch as xp
1111
from torch import nn
12+
from typing_extensions import Self
1213

1314
from stream_mapper.core import ModelBase as CoreModelBase
1415
from stream_mapper.core._connect.nn_namespace import NN_NAMESPACE
@@ -22,8 +23,6 @@
2223
if TYPE_CHECKING:
2324
from stream_mapper.core import Data
2425

25-
Self = TypeVar("Self", bound="ModelBase")
26-
2726

2827
@dataclass(unsafe_hash=True, repr=False)
2928
class ModelBase(nn.Module, CoreModelBase[Array, NNModel]):

src/stream_mapper/pytorch/_multi.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
__all__: tuple[str, ...] = ()
66

77
from dataclasses import dataclass
8-
from typing import TYPE_CHECKING, Any, TypeVar
8+
from typing import TYPE_CHECKING, Any
99

1010
from torch import nn
11+
from typing_extensions import Self
1112

1213
from stream_mapper.core import BACKGROUND_KEY, NNField
1314
from stream_mapper.core import IndependentModels as CoreIndependentModels
@@ -23,8 +24,6 @@
2324
if TYPE_CHECKING:
2425
from stream_mapper.core import Data
2526

26-
Self = TypeVar("Self", bound="MixtureModel")
27-
2827

2928
@dataclass
3029
class ModelsBase(nn.Module, CoreModelsBase[Array, NNModel]):
@@ -122,7 +121,7 @@ class MixtureModel(ModelsBase, CoreMixtureModel[Array, NNModel]):
122121

123122
net: NNField[NNModel, NNModel] = NNField(default=MISSING)
124123

125-
def __new__(cls: type[Self], *args: Any, **kwargs: Any) -> Self: # noqa: ARG003
124+
def __new__(cls: type[Self], *_: Any, **__: Any) -> Self:
126125
"""Initialize the model. This is needed for PyTorch."""
127126
self: Self = super().__new__(cls)
128127
# PyTorch needs to be initialized before attributes are assigned.

0 commit comments

Comments
 (0)