Skip to content

Commit

Permalink
chore: appease pylint (#2890)
Browse files Browse the repository at this point in the history
* chore: bump py-version

* fix: import `final` from typing

* style: pre-commit fixes

* chore: bump pylint, appease inheritance

We use this heirarchy internally and it feels sensible

* chore: more appease!

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
agoose77 and pre-commit-ci[bot] authored Dec 11, 2023
1 parent e2510ca commit b32c86a
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def pylint(session):
Run the pylint process.
"""

session.install("pylint==2.12.2")
session.install("pylint==3.0.2")
session.run("pylint", "src", *session.posargs)


Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ filterwarnings = [
log_cli_level = "info"

[tool.pylint.master]
py-version = "3.7"
py-version = "3.8"
jobs = "0"
ignore-paths = [
"src/awkward/_typeparser/generated_parser.py",
Expand All @@ -154,6 +154,7 @@ disable = [
"consider-using-f-string",
"consider-using-max-builtin",
"consider-using-min-builtin",
"cyclic-import",
"duplicate-code",
"exec-used",
"fixme",
Expand All @@ -174,7 +175,6 @@ disable = [
"no-else-return",
"no-member",
"no-name-in-module",
"no-self-use",
"no-value-for-parameter",
"property-with-parameters",
"protected-access",
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/_nplikes/cupy.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


@register_nplike
class Cupy(ArrayModuleNumpyLike):
class Cupy(ArrayModuleNumpyLike): # pylint: disable=too-many-ancestors
is_eager: Final = False
supports_structured_dtypes: Final = False

Expand Down
2 changes: 1 addition & 1 deletion src/awkward/_nplikes/jax.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


@register_nplike
class Jax(ArrayModuleNumpyLike):
class Jax(ArrayModuleNumpyLike): # pylint: disable=too-many-ancestors
is_eager: Final = True
supports_structured_dtypes: Final = False

Expand Down
2 changes: 1 addition & 1 deletion src/awkward/_nplikes/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


@register_nplike
class Numpy(ArrayModuleNumpyLike["NDArray"]):
class Numpy(ArrayModuleNumpyLike["NDArray"]): # pylint: disable=too-many-ancestors
is_eager: Final = True
supports_structured_dtypes: Final = True

Expand Down
2 changes: 1 addition & 1 deletion src/awkward/_nplikes/typetracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ def derive_slice_for_length(
return start, stop, step, self.index_as_shape_item(slice_length)

def broadcast_shapes(self, *shapes: tuple[ShapeItem, ...]) -> tuple[ShapeItem, ...]:
ndim = max([len(s) for s in shapes], default=0)
ndim = max((len(s) for s in shapes), default=0)
result: list[ShapeItem] = [1] * ndim

for shape in shapes:
Expand Down
4 changes: 2 additions & 2 deletions src/awkward/_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def parameters_intersect(
if result is None:
result = {key: left_value}
else:
result[key] = left_value # pylint: disable-msg=E1137
result[key] = left_value
return result


Expand Down Expand Up @@ -151,7 +151,7 @@ def parameters_union(
if parameters is None:
parameters = {key: value}
else:
parameters[key] = value # pylint: disable-msg=E1137
parameters[key] = value

return parameters

Expand Down
2 changes: 1 addition & 1 deletion src/awkward/_singleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def _new(cls) -> Self:
)

self = super().__new__(cls)
self.__init__()
self.__init__() # pylint: disable=unnecessary-dunder-call
cls._instance = self

return self
Expand Down
3 changes: 1 addition & 2 deletions src/awkward/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
AxisMaybeNone = TypeVar("AxisMaybeNone", int, None) # noqa: F405

if sys.version_info < (3, 11):
from typing import ClassVar, Final, SupportsIndex, runtime_checkable
from typing import ClassVar, Final, SupportsIndex, final, runtime_checkable

from typing_extensions import (
Literal,
Expand All @@ -45,7 +45,6 @@
TypedDict,
TypeGuard,
Unpack,
final,
)
else:
from typing import (
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_concatenate.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def concatenate(
def _merge_as_union(
contents: Sequence[Content], parameters=None
) -> ak.contents.UnionArray:
length = sum([c.length for c in contents])
length = sum(c.length for c in contents)
first = contents[0]
tags = ak.index.Index8.empty(length, first.backend.index_nplike)
index = ak.index.Index64.empty(length, first.backend.index_nplike)
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_from_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def _build_assembly(schema, container, instructions):
if not isinstance(schema, dict):
raise TypeError(f"unrecognized JSONSchema: expected dict, got {schema!r}")

if "type" not in schema is None:
if "type" not in schema:
raise TypeError(f"unrecognized JSONSchema: no 'type' in {schema!r}")

tpe = schema["type"]
Expand Down

0 comments on commit b32c86a

Please sign in to comment.