Skip to content

Commit 3d8f00a

Browse files
authored
[459] Attempt to fix ruff differences (#463)
* changes * debug * changes * changes
1 parent eab4b14 commit 3d8f00a

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ jobs:
2626
- name: Run ruff (black)
2727
# Do not attempt to install the default dependencies, this is much faster.
2828
# Run temporarily on a sub directory before the main restyling.
29-
run: uv run --no-project --with "ruff==0.9.7" ruff format --target-version py312 --check -n src/ scripts/
29+
run: uv run --no-project --with "ruff==0.12.2" ruff format --target-version py312 --check -n src/ scripts/
3030

3131
- name: Run ruff (flake8)
3232
# Do not attempt to install the default dependencies, this is much faster.
33-
run: uv run --no-project --with "ruff==0.9.7" ruff check src/
33+
run: uv run --no-project --verbose --with "ruff==0.12.2" ruff check src/
3434
pr:
3535
name: PR checks
3636
runs-on: ubuntu-latest

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ authors = [
77
{ name = "WeatherGenerator collaboration" }
88
]
99

10-
requires-python = ">=3.11,<3.13"
10+
requires-python = ">=3.12,<3.13"
1111
# TODO: split the plotting dependencies into their own dep groups, they are not required.
1212
dependencies = [
1313
'torch==2.6.0',
@@ -99,7 +99,6 @@ ignore = [
9999
"SIM118",
100100
"SIM102",
101101
"SIM401",
102-
"UP040", # TODO: enable later
103102
# To ignore, not relevant for us
104103
"SIM108" # in case additional norm layer supports are added in future
105104
]

src/weathergen/datasets/data_reader_base.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import logging
1212
from abc import abstractmethod
1313
from dataclasses import dataclass
14-
from typing import TypeAlias
1514

1615
import numpy as np
1716
from numpy import datetime64, timedelta64
@@ -22,16 +21,16 @@
2221
_logger = logging.getLogger(__name__)
2322

2423
# The numpy date time 64 time (nanosecond precision)
25-
NPDT64: TypeAlias = datetime64
24+
type NPDT64 = datetime64
2625
# The numpy delta time 64 time (nanosecond precision)
27-
NPTDel64: TypeAlias = timedelta64
26+
type NPTDel64 = timedelta64
2827

29-
DType: TypeAlias = np.float32 # The type for the data in the datasets.
28+
type DType = np.float32 # The type for the data in the datasets.
3029

3130
"""
3231
The type for indexing into datasets. It is a multiple of hours.
3332
"""
34-
TIndex: TypeAlias = np.int64
33+
type TIndex = np.int64
3534

3635

3736
_DT_ZERO = np.datetime64("1850-01-01T00:00")

src/weathergen/utils/better_abc.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,14 @@
1010

1111
from abc import ABCMeta as NativeABCMeta
1212
from collections.abc import Callable
13-
from typing import Any, TypeVar, cast
14-
15-
R = TypeVar("R")
13+
from typing import Any, cast
1614

1715

1816
class DummyAttribute:
1917
pass
2018

2119

22-
def abstract_attribute(obj: Callable[[Any], R] | None = None) -> R:
20+
def abstract_attribute[R](obj: Callable[[Any], R] | None = None) -> R:
2321
_obj = cast(Any, obj)
2422
if obj is None:
2523
_obj = DummyAttribute()

0 commit comments

Comments
 (0)