Skip to content

Commit f2b31e0

Browse files
committed
Add pyupgrade and refurb rulesets to linting
1 parent 8eaa7a6 commit f2b31e0

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ test = [
3434
]
3535
lint = [
3636
"ruff",
37-
"refurb",
3837
"mypy",
3938
]
4039

@@ -60,6 +59,8 @@ select = [
6059
"W", # pycodestyle warning
6160
"I", # isort
6261
"PT", # flake8-pytest-style
62+
"UP", # pyupgrade
63+
"FURB", # refurb
6364
"RUF", # ruff specific
6465
]
6566

src/pyloidal/cocos.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import itertools
1919
from dataclasses import dataclass
20-
from typing import Optional, Tuple
2120

2221
import numpy as np
2322
from numpy.typing import NDArray
@@ -99,9 +98,9 @@ def identify_cocos(
9998
plasma_current: float,
10099
safety_factor: FloatArray,
101100
poloidal_flux: FloatArray,
102-
clockwise_phi: Optional[bool] = None,
103-
minor_radii: Optional[FloatArray] = None,
104-
) -> Tuple[int, ...]:
101+
clockwise_phi: bool | None = None,
102+
minor_radii: FloatArray | None = None,
103+
) -> tuple[int, ...]:
105104
r"""
106105
Determine which COCOS coordinate system is in use. Returns all possible conventions.
107106

tests/test_cocos.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from itertools import product
2-
from typing import Any, Dict, List, Tuple
2+
from typing import Any
33

44
import numpy as np
55
import pytest
@@ -14,16 +14,16 @@ def _identify_cocos_inputs(
1414
antiparallel_field_and_current: bool,
1515
use_minor_radii: bool,
1616
use_clockwise_phi: bool,
17-
) -> Tuple[Dict[str, Any], Tuple[int, ...]]:
17+
) -> tuple[dict[str, Any], tuple[int, ...]]:
1818
"""Generates inputs for ``identify_cocos`` for a given COCOS"""
1919
# Set up cocos 1 kwargs and modify accordingly
20-
kwargs: Dict[str, Any] = dict(
20+
kwargs: dict[str, Any] = dict(
2121
b_toroidal=2.5,
2222
plasma_current=1e6,
2323
poloidal_flux=np.linspace(0, 2, 3),
2424
safety_factor=np.linspace(0.5, 1.5, 3),
2525
)
26-
expected: List[int] = [cocos]
26+
expected: list[int] = [cocos]
2727

2828
even_cocos = not bool(cocos % 2)
2929
base_cocos = (cocos % 10) - even_cocos

0 commit comments

Comments
 (0)