Skip to content

Commit

Permalink
Add exception for unknown method
Browse files Browse the repository at this point in the history
  • Loading branch information
kjmeagher committed Aug 20, 2024
1 parent cdd1376 commit 88f5b02
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ repos:
hooks:
- id: prettier
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.0
rev: v0.6.1
hooks:
- id: ruff
args: [--fix, --show-fixes]
- id: ruff-format
- repo: https://github.com/pycqa/pylint
rev: v3.2.4
rev: v3.2.6
hooks:
- id: pylint
files: ehist
args: [--ignore=E401]
additional_dependencies: [numpy, matplotlib]
- repo: https://github.com/fsfe/reuse-tool
rev: v3.1.0a1
rev: v4.0.3
hooks:
- id: reuse
- repo: https://github.com/codespell-project/codespell
Expand Down
3 changes: 3 additions & 0 deletions ehist/hist1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ def fit(self, func, p0=None, mask=None, method="points", **kwargs):
)
elif method == "quad":
fit = optimize.minimize(self._integrate, p0, args=(func, self.x.edges, self.N), **kwargs)
else:
msg = f"Unknown value for method: `{method}`"
raise ValueError(msg)
return fit

# y, yerr = self._get_hist("area")
Expand Down
8 changes: 2 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,11 @@ test = ["pytest", "pytest-cov"]
testpaths = ["tests"]
addopts = ["--cov"]

[tool.black]
line-length = 108
target-version = ["py38"]

[tool.pylint.messages_control]
disable = "C0103,C0104,C0114,C0115,C0116,W0603,R0902,R0903,R0912,R0913,R0914,W0201,W0622"

[tool.pylint.format]
max-line-length = "108"
max-line-length = "128"

[tool.ruff]
select = ["ALL"]
Expand All @@ -61,7 +57,7 @@ ignore = [
"PLR0912", # Too many branches
"ERA001", # Found commented-out code
]
line-length = 108
line-length = 128
target-version = "py38"
fixable = ["I"]

Expand Down

0 comments on commit 88f5b02

Please sign in to comment.