Skip to content

Commit d3a760d

Browse files
authored
chore: repo review updates (#408)
* chore: touch up Ruff config Signed-off-by: Henry Schreiner <[email protected]> * chore: remove uneeded MyPy config line Signed-off-by: Henry Schreiner <[email protected]> * ci: grouped dependabot updates Signed-off-by: Henry Schreiner <[email protected]> --------- Signed-off-by: Henry Schreiner <[email protected]>
1 parent 6d4e866 commit d3a760d

File tree

4 files changed

+66
-69
lines changed

4 files changed

+66
-69
lines changed

.github/dependabot.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@ updates:
44
- package-ecosystem: "github-actions"
55
directory: "/"
66
schedule:
7-
interval: "daily"
7+
interval: "weekly"
8+
groups:
9+
actions:
10+
patterns:
11+
- "*"

pyproject.toml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,11 @@ version.source = "vcs"
8787
build.hooks.vcs.version-file = "src/vector/_version.py"
8888

8989
[tool.ruff]
90-
select = [
91-
"E", "F", "W", # flake8
92-
"B", "B904", # flake8-bugbear
90+
src = ["src"]
91+
92+
[tool.ruff.lint]
93+
extend-select = [
94+
"B", # flake8-bugbear
9395
"I", # isort
9496
"C4", # flake8-comprehensions
9597
"ISC", # flake8-implicit-str-concat
@@ -103,24 +105,18 @@ select = [
103105
"UP", # pyupgrade
104106
"YTT", # flake8-2020
105107
]
106-
extend-ignore = [
107-
"PLR", # Design related pylint codes
108-
"E501", # Line too long
108+
ignore = [
109+
"PLR09", # Too many X
110+
"PLR2004", # Magic values
109111
]
110112
typing-modules = ["vector._typeutils"]
111-
src = ["src"]
112-
unfixable = [
113-
"T20", # Removes print statements
114-
"F841", # Removes unused variables
115-
]
116-
exclude = []
117113
isort.required-imports = ["from __future__ import annotations"]
118114

119-
[tool.ruff.per-file-ignores]
115+
[tool.ruff.lint.per-file-ignores]
120116
"noxfile.py" = ["T20"]
121117
"tests/*" = ["T20"]
122118
"src/vector/backends/_numba_object.py" = ["PGH003"]
123-
"tests/backends/test_operators.py" = ["SIM201", "SIM202"]
119+
"tests/backends/test_operators.py" = ["SIM201", "SIM202", "PLR0124"]
124120

125121
[tool.pylint]
126122
master.py-version = "3.8"
@@ -212,7 +208,6 @@ files = [
212208
python_version = "3.8"
213209
strict = true
214210
warn_return_any = false
215-
show_error_codes = true
216211
enable_error_code = [
217212
"ignore-without-code",
218213
"truthy-bool",

src/vector/backends/_numba_object.py

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,55 +1538,54 @@ def overloader_impl(v1, v2):
15381538
coord24(v2),
15391539
)
15401540

1541-
else:
1542-
if groupname == "planar":
1543-
instance_class = flavor_of(v1, v2).ProjectionClass2D
1544-
azcoords = _coord_object_type[returns[0]]
1541+
elif groupname == "planar":
1542+
instance_class = flavor_of(v1, v2).ProjectionClass2D
1543+
azcoords = _coord_object_type[returns[0]]
15451544

1546-
def overloader_impl(v1, v2):
1547-
out1, out2 = function(
1548-
numpy, coord11(v1), coord12(v1), coord21(v2), coord22(v2)
1549-
)
1550-
return instance_class(azcoords(out1, out2))
1545+
def overloader_impl(v1, v2):
1546+
out1, out2 = function(
1547+
numpy, coord11(v1), coord12(v1), coord21(v2), coord22(v2)
1548+
)
1549+
return instance_class(azcoords(out1, out2))
15511550

1552-
elif groupname == "spatial":
1553-
instance_class = flavor_of(v1, v2).ProjectionClass3D
1554-
azcoords = _coord_object_type[returns[0]]
1555-
lcoords = _coord_object_type[returns[1]]
1551+
elif groupname == "spatial":
1552+
instance_class = flavor_of(v1, v2).ProjectionClass3D
1553+
azcoords = _coord_object_type[returns[0]]
1554+
lcoords = _coord_object_type[returns[1]]
15561555

1557-
def overloader_impl(v1, v2):
1558-
out1, out2, out3 = function(
1559-
numpy,
1560-
coord11(v1),
1561-
coord12(v1),
1562-
coord13(v1),
1563-
coord21(v2),
1564-
coord22(v2),
1565-
coord23(v2),
1566-
)
1567-
return instance_class(azcoords(out1, out2), lcoords(out3))
1556+
def overloader_impl(v1, v2):
1557+
out1, out2, out3 = function(
1558+
numpy,
1559+
coord11(v1),
1560+
coord12(v1),
1561+
coord13(v1),
1562+
coord21(v2),
1563+
coord22(v2),
1564+
coord23(v2),
1565+
)
1566+
return instance_class(azcoords(out1, out2), lcoords(out3))
15681567

1569-
elif groupname == "lorentz":
1570-
instance_class = flavor_of(v1, v2).ProjectionClass4D
1571-
azcoords = _coord_object_type[returns[0]]
1572-
lcoords = _coord_object_type[returns[1]]
1573-
tcoords = _coord_object_type[returns[2]]
1568+
elif groupname == "lorentz":
1569+
instance_class = flavor_of(v1, v2).ProjectionClass4D
1570+
azcoords = _coord_object_type[returns[0]]
1571+
lcoords = _coord_object_type[returns[1]]
1572+
tcoords = _coord_object_type[returns[2]]
15741573

1575-
def overloader_impl(v1, v2):
1576-
out1, out2, out3, out4 = function(
1577-
numpy,
1578-
coord11(v1),
1579-
coord12(v1),
1580-
coord13(v1),
1581-
coord14(v1),
1582-
coord21(v2),
1583-
coord22(v2),
1584-
coord23(v2),
1585-
coord24(v2),
1586-
)
1587-
return instance_class(
1588-
azcoords(out1, out2), lcoords(out3), tcoords(out4)
1589-
)
1574+
def overloader_impl(v1, v2):
1575+
out1, out2, out3, out4 = function(
1576+
numpy,
1577+
coord11(v1),
1578+
coord12(v1),
1579+
coord13(v1),
1580+
coord14(v1),
1581+
coord21(v2),
1582+
coord22(v2),
1583+
coord23(v2),
1584+
coord24(v2),
1585+
)
1586+
return instance_class(
1587+
azcoords(out1, out2), lcoords(out3), tcoords(out4)
1588+
)
15901589

15911590
return overloader_impl
15921591

src/vector/backends/awkward.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -580,17 +580,16 @@ def _class_to_name(cls: type[VectorProtocol]) -> str:
580580
if issubclass(cls, Momentum):
581581
if issubclass(cls, Vector2D):
582582
return "Momentum2D"
583-
elif issubclass(cls, Vector3D):
583+
if issubclass(cls, Vector3D):
584584
return "Momentum3D"
585-
elif issubclass(cls, Vector4D):
585+
if issubclass(cls, Vector4D):
586586
return "Momentum4D"
587-
else:
588-
if issubclass(cls, Vector2D):
589-
return "Vector2D"
590-
elif issubclass(cls, Vector3D):
591-
return "Vector3D"
592-
elif issubclass(cls, Vector4D):
593-
return "Vector4D"
587+
if issubclass(cls, Vector2D):
588+
return "Vector2D"
589+
if issubclass(cls, Vector3D):
590+
return "Vector3D"
591+
if issubclass(cls, Vector4D):
592+
return "Vector4D"
594593

595594
raise AssertionError(repr(cls))
596595

0 commit comments

Comments
 (0)