Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update pre-commit hooks #557

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.13
rev: v0.3.4
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand All @@ -33,7 +33,7 @@ repos:
types_or: [python, pyi, jupyter]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.9.0
hooks:
- id: mypy
files: ^src
Expand All @@ -56,6 +56,6 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
rev: v0.10.0.1
hooks:
- id: shellcheck
3 changes: 1 addition & 2 deletions src/hist/axis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ class AxisProtocol(Protocol):
metadata: Any

@property
def name(self) -> str:
...
def name(self) -> str: ...

label: str
_ax: CoreAxisProtocol
Expand Down
3 changes: 1 addition & 2 deletions src/hist/basehist.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@


class SupportsLessThan(Protocol):
def __lt__(self, __other: Any) -> bool:
...
def __lt__(self, __other: Any) -> bool: ...


InnerIndexing = Union[
Expand Down
6 changes: 2 additions & 4 deletions src/hist/interop.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@


class HistogramModuleProtocol(Protocol[T_contra, U]):
def unpack(self, obj: T_contra) -> dict[str, U] | None:
...
def unpack(self, obj: T_contra) -> dict[str, U] | None: ...

def broadcast_and_flatten(
self, objects: Sequence[U | ArrayLike]
) -> tuple[np.typing.NDArray[Any], ...]:
...
) -> tuple[np.typing.NDArray[Any], ...]: ...


_histogram_modules: dict[type, HistogramModuleProtocol[Any, Any]] = {}
Expand Down
2 changes: 1 addition & 1 deletion src/hist/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def _expr_to_lambda(expr: str) -> Callable[..., Any]:
varnames = list(OrderedDict.fromkeys([name for name in varnames if name != "x"]))
lambdastr = f"lambda x,{','.join(varnames)}: {expr}"
# pylint: disable-next=eval-used
return eval(lambdastr) # type: ignore[no-any-return] # noqa: PGH001
return eval(lambdastr) # type: ignore[no-any-return]


def _curve_fit_wrapper(
Expand Down
6 changes: 2 additions & 4 deletions src/hist/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,10 @@ def _get_index(self, name: str | int) -> int:
raise IndexError(f"Name not found: {name}")

@typing.overload
def __getitem__(self, val: int | str) -> BaseHist:
...
def __getitem__(self, val: int | str) -> BaseHist: ...

@typing.overload
def __getitem__(self, val: slice) -> Self:
...
def __getitem__(self, val: slice) -> Self: ...

def __getitem__(self, val: int | slice | str) -> BaseHist | Self:
if isinstance(val, str):
Expand Down
3 changes: 1 addition & 2 deletions src/hist/svgutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@


class SupportsStr(Protocol):
def __str__(self) -> str:
...
def __str__(self) -> str: ...


class XML:
Expand Down
Loading