Skip to content

Commit e2b83a0

Browse files
committed
Add various miscellaneous linter rulesets
1 parent f2b31e0 commit e2b83a0

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

pyproject.toml

+10
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,19 @@ select = [
5959
"W", # pycodestyle warning
6060
"I", # isort
6161
"PT", # flake8-pytest-style
62+
"B", # flake8-bugbear
63+
"A", # flake8-builtins
64+
"C4", # flake8-comprehensions
65+
"EM", # flake8-errmsg
66+
"T10", # flake8-debugger
67+
"PTH", # flake8-use-pathlib
68+
"SIM", # flake8-simplify
69+
"TCH", # flake8-type-checking
6270
"UP", # pyupgrade
6371
"FURB", # refurb
72+
"PERF", # perflint
6473
"RUF", # ruff specific
74+
"NPY", # NumPy specific
6575
]
6676

6777
[tool.coverage.run]

src/pyloidal/cocos.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,14 @@ class Sigma:
3434

3535
def __post_init__(self):
3636
if self.B_poloidal not in (-1, 1):
37-
raise ValueError(
38-
f"B_poloidal should be either 1 or -1, found {self.B_poloidal}"
39-
)
37+
msg = f"B_poloidal should be either 1 or -1, found {self.B_poloidal}"
38+
raise ValueError(msg)
4039
if self.r_phi_z not in (-1, 1):
41-
raise ValueError(f"r_phi_z should be either 1 or -1, found {self.r_phi_z}")
40+
msg = f"r_phi_z should be either 1 or -1, found {self.r_phi_z}"
41+
raise ValueError(msg)
4242
if self.r_theta_phi not in (-1, 1):
43-
raise ValueError(
44-
f"r_theta_phi should be either 1 or -1, found {self.r_theta_phi}"
45-
)
43+
msg = f"r_theta_phi should be either 1 or -1, found {self.r_theta_phi}"
44+
raise ValueError(msg)
4645

4746

4847
SIGMA_TO_COCOS = {

tests/test_cocos.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ def _identify_cocos_inputs(
1717
) -> 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(
21-
b_toroidal=2.5,
22-
plasma_current=1e6,
23-
poloidal_flux=np.linspace(0, 2, 3),
24-
safety_factor=np.linspace(0.5, 1.5, 3),
25-
)
20+
kwargs: dict[str, Any] = {
21+
"b_toroidal": 2.5,
22+
"plasma_current": 1e6,
23+
"poloidal_flux": np.linspace(0, 2, 3),
24+
"safety_factor": np.linspace(0.5, 1.5, 3),
25+
}
2626
expected: list[int] = [cocos]
2727

2828
even_cocos = not bool(cocos % 2)

0 commit comments

Comments
 (0)