Skip to content

Commit

Permalink
chore: repo review updates (#408)
Browse files Browse the repository at this point in the history
* chore: touch up Ruff config

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* chore: remove uneeded MyPy config line

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* ci: grouped dependabot updates

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii authored Dec 23, 2023
1 parent 6d4e866 commit d3a760d
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 69 deletions.
6 changes: 5 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
groups:
actions:
patterns:
- "*"
25 changes: 10 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ version.source = "vcs"
build.hooks.vcs.version-file = "src/vector/_version.py"

[tool.ruff]
select = [
"E", "F", "W", # flake8
"B", "B904", # flake8-bugbear
src = ["src"]

[tool.ruff.lint]
extend-select = [
"B", # flake8-bugbear
"I", # isort
"C4", # flake8-comprehensions
"ISC", # flake8-implicit-str-concat
Expand All @@ -103,24 +105,18 @@ select = [
"UP", # pyupgrade
"YTT", # flake8-2020
]
extend-ignore = [
"PLR", # Design related pylint codes
"E501", # Line too long
ignore = [
"PLR09", # Too many X
"PLR2004", # Magic values
]
typing-modules = ["vector._typeutils"]
src = ["src"]
unfixable = [
"T20", # Removes print statements
"F841", # Removes unused variables
]
exclude = []
isort.required-imports = ["from __future__ import annotations"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"noxfile.py" = ["T20"]
"tests/*" = ["T20"]
"src/vector/backends/_numba_object.py" = ["PGH003"]
"tests/backends/test_operators.py" = ["SIM201", "SIM202"]
"tests/backends/test_operators.py" = ["SIM201", "SIM202", "PLR0124"]

[tool.pylint]
master.py-version = "3.8"
Expand Down Expand Up @@ -212,7 +208,6 @@ files = [
python_version = "3.8"
strict = true
warn_return_any = false
show_error_codes = true
enable_error_code = [
"ignore-without-code",
"truthy-bool",
Expand Down
87 changes: 43 additions & 44 deletions src/vector/backends/_numba_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -1538,55 +1538,54 @@ def overloader_impl(v1, v2):
coord24(v2),
)

else:
if groupname == "planar":
instance_class = flavor_of(v1, v2).ProjectionClass2D
azcoords = _coord_object_type[returns[0]]
elif groupname == "planar":
instance_class = flavor_of(v1, v2).ProjectionClass2D
azcoords = _coord_object_type[returns[0]]

def overloader_impl(v1, v2):
out1, out2 = function(
numpy, coord11(v1), coord12(v1), coord21(v2), coord22(v2)
)
return instance_class(azcoords(out1, out2))
def overloader_impl(v1, v2):
out1, out2 = function(
numpy, coord11(v1), coord12(v1), coord21(v2), coord22(v2)
)
return instance_class(azcoords(out1, out2))

elif groupname == "spatial":
instance_class = flavor_of(v1, v2).ProjectionClass3D
azcoords = _coord_object_type[returns[0]]
lcoords = _coord_object_type[returns[1]]
elif groupname == "spatial":
instance_class = flavor_of(v1, v2).ProjectionClass3D
azcoords = _coord_object_type[returns[0]]
lcoords = _coord_object_type[returns[1]]

def overloader_impl(v1, v2):
out1, out2, out3 = function(
numpy,
coord11(v1),
coord12(v1),
coord13(v1),
coord21(v2),
coord22(v2),
coord23(v2),
)
return instance_class(azcoords(out1, out2), lcoords(out3))
def overloader_impl(v1, v2):
out1, out2, out3 = function(
numpy,
coord11(v1),
coord12(v1),
coord13(v1),
coord21(v2),
coord22(v2),
coord23(v2),
)
return instance_class(azcoords(out1, out2), lcoords(out3))

elif groupname == "lorentz":
instance_class = flavor_of(v1, v2).ProjectionClass4D
azcoords = _coord_object_type[returns[0]]
lcoords = _coord_object_type[returns[1]]
tcoords = _coord_object_type[returns[2]]
elif groupname == "lorentz":
instance_class = flavor_of(v1, v2).ProjectionClass4D
azcoords = _coord_object_type[returns[0]]
lcoords = _coord_object_type[returns[1]]
tcoords = _coord_object_type[returns[2]]

def overloader_impl(v1, v2):
out1, out2, out3, out4 = function(
numpy,
coord11(v1),
coord12(v1),
coord13(v1),
coord14(v1),
coord21(v2),
coord22(v2),
coord23(v2),
coord24(v2),
)
return instance_class(
azcoords(out1, out2), lcoords(out3), tcoords(out4)
)
def overloader_impl(v1, v2):
out1, out2, out3, out4 = function(
numpy,
coord11(v1),
coord12(v1),
coord13(v1),
coord14(v1),
coord21(v2),
coord22(v2),
coord23(v2),
coord24(v2),
)
return instance_class(
azcoords(out1, out2), lcoords(out3), tcoords(out4)
)

return overloader_impl

Expand Down
17 changes: 8 additions & 9 deletions src/vector/backends/awkward.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,17 +580,16 @@ def _class_to_name(cls: type[VectorProtocol]) -> str:
if issubclass(cls, Momentum):
if issubclass(cls, Vector2D):
return "Momentum2D"
elif issubclass(cls, Vector3D):
if issubclass(cls, Vector3D):
return "Momentum3D"
elif issubclass(cls, Vector4D):
if issubclass(cls, Vector4D):
return "Momentum4D"
else:
if issubclass(cls, Vector2D):
return "Vector2D"
elif issubclass(cls, Vector3D):
return "Vector3D"
elif issubclass(cls, Vector4D):
return "Vector4D"
if issubclass(cls, Vector2D):
return "Vector2D"
if issubclass(cls, Vector3D):
return "Vector3D"
if issubclass(cls, Vector4D):
return "Vector4D"

raise AssertionError(repr(cls))

Expand Down

0 comments on commit d3a760d

Please sign in to comment.