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 #487

Merged
merged 4 commits into from
Mar 23, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.255
rev: v0.0.258
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand All @@ -35,7 +35,7 @@ repos:

# Notebook formatting
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.6.3
rev: 1.6.4
hooks:
- id: nbqa-ruff
additional_dependencies: [ruff==0.0.253]
Expand Down
2 changes: 1 addition & 1 deletion src/hist/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ def __dir__() -> tuple[str, ...]:
def __getattr__(name: str) -> ModuleType:
if name == "axes":
msg = f"Misspelling error, '{name}' should be 'axis'"
warnings.warn(msg)
warnings.warn(msg, stacklevel=2)
return axis
raise AttributeError(f"module {__name__} has no attribute {name}")
2 changes: 1 addition & 1 deletion src/hist/axestuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def name(self, values: Iterable[str]) -> None:
disallowed_warning = (
f"{ax.name} is a protected keyword and cannot be used as axis name"
)
warnings.warn(disallowed_warning)
warnings.warn(disallowed_warning, stacklevel=2)

valid_names = [ax.name for ax in self if ax.name]
if len(valid_names) != len(set(valid_names)):
Expand Down
4 changes: 2 additions & 2 deletions src/hist/basehist.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(
storage = getattr(bh.storage, storage_str)()
elif isinstance(storage, type):
msg = f"Please use '{storage.__name__}()' instead of '{storage.__name__}'"
warnings.warn(msg)
warnings.warn(msg, stacklevel=2)
storage = storage()

super().__init__(*args, storage=storage, metadata=metadata) # type: ignore[call-overload]
Expand All @@ -104,7 +104,7 @@ def __init__(
disallowed_warning = (
f"{ax.name} is a protected keyword and cannot be used as axis name"
)
warnings.warn(disallowed_warning)
warnings.warn(disallowed_warning, stacklevel=2)

valid_names = [ax.name for ax in self.axes if ax.name]
if len(valid_names) != len(set(valid_names)):
Expand Down
2 changes: 2 additions & 0 deletions tests/test_stacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

from hist import Hist, NamedHist, Stack, axis

np.random.seed(42)

# different histograms here!
reg_ax = axis.Regular(10, 0, 1)
boo_ax = axis.Boolean()
Expand Down