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

codespell 2.3.0, ruff 0.4.10, pyright 1.1.368, and more #252

Merged
merged 5 commits into from
Jun 24, 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
20 changes: 14 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
ci:
autoupdate_branch: "dev"
autoupdate_commit_msg: "update pre-commit hooks"
skip: [markdownlint, poetry-check, codespell, ruff, pyright]
skip:
- markdownlint
- poetry-check
- poetry-lock
- codespell
- ruff
- pyright

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down Expand Up @@ -29,29 +35,31 @@ repos:
exclude_types: [svg]

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.40.0
rev: v0.41.0
hooks:
- id: markdownlint

- repo: https://github.com/python-poetry/poetry
rev: 1.8.3
hooks:
- id: poetry-check
- id: poetry-lock
args: [--no-update]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
- tomli

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.5
rev: v0.4.10
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
args: [--fix, --show-fixes]

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.364
rev: v1.1.368
hooks:
- id: pyright
4 changes: 4 additions & 0 deletions lmo/diagnostic.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
_MIN_RHO: Final[float] = 1e-5


# workaround for: https://github.com/microsoft/pyright/issues/8184
# pyright: reportUninitializedInstanceVariable=false


class HypothesisTestResult(NamedTuple):
r"""
Results of a hypothesis test.
Expand Down
5 changes: 5 additions & 0 deletions lmo/inference.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Parametric inference using the (Generalized) Method of L-Moments, L-(G)MM.
"""

from __future__ import annotations

from typing import TYPE_CHECKING, Any, NamedTuple, TypeAlias, cast
Expand Down Expand Up @@ -36,6 +37,10 @@
_ArrF8: TypeAlias = npt.NDArray[np.float64]


# workaround for: https://github.com/microsoft/pyright/issues/8184
# pyright: reportUninitializedInstanceVariable=false


class GMMResult(NamedTuple):
"""
Represents the Generalized Method of L-Moments (L-GMM) results.
Expand Down
2 changes: 1 addition & 1 deletion lmo/ostats.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def weights(
_fn = _weights_cached if cached else _weights
# this return type incosnsitency is due to the first `np.ndarray` type
# parameter not being covariant, which is incorrect, but is being worked on
return _fn(i, n, N) # pyright: ignore[reportReturnType]
return _fn(i, n, N)


@overload
Expand Down
6 changes: 4 additions & 2 deletions lmo/theoretical.py
Original file line number Diff line number Diff line change
Expand Up @@ -1615,14 +1615,16 @@ class _VectorizedPPF(Protocol):
@overload
def __call__(
self,
__u: lnpt.AnyArrayInt | lnpt.AnyArrayFloat,
u: lnpt.AnyArrayInt | lnpt.AnyArrayFloat,
/,
*,
r_max: int = ...,
) -> _ArrF8: ...
@overload
def __call__(
self,
__u: lnpt.AnyScalarInt | lnpt.AnyScalarFloat,
u: lnpt.AnyScalarInt | lnpt.AnyScalarFloat,
/,
*,
r_max: int = ...,
) -> float: ...
Expand Down
7 changes: 4 additions & 3 deletions lmo/typing/_scipy.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,8 @@ class RVFrozen(Protocol[_RV_co]):

def __init__(
self,
__dist: _RV_co,
dist: _RV_co,
/,
*args: _Real0D,
**kwds: _Real0D,
) -> None: ...
Expand All @@ -660,7 +661,7 @@ def b(self) -> float: ...
@property
def random_state(self) -> _RNG: ...
@random_state.setter
def random_state(self, __seed: _Seed) -> None: ...
def random_state(self, seed: _Seed, /) -> None: ...

@overload
def rvs(self, size: None = ..., random_state: _Seed = ...) -> _F8: ...
Expand All @@ -686,7 +687,7 @@ def cdf(
) -> lnpt.Array[_ND1, _F8]: ...

@overload
def logcdf(self, __x: _Real0D) -> _F8: ...
def logcdf(self, x: _Real0D) -> _F8: ...
@overload
def logcdf(
self,
Expand Down
2 changes: 1 addition & 1 deletion lmo/typing/np.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# Some handy scalar type aliases

if NP_V2:
Bool: TypeAlias = np.bool # noqa: NPY001
Bool: TypeAlias = np.bool
else:
Bool: TypeAlias = np.bool_
UInt: TypeAlias = np.unsignedinteger[Any]
Expand Down
497 changes: 251 additions & 246 deletions poetry.lock

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,28 @@ pandas = {version = ">=1.5", optional = true}
optype = "^0.4.0"

[tool.poetry.group.dev.dependencies]
codespell = "^2.2.6"
hypothesis = {version = "^6.102.4", extras = ["numpy"]}
codespell = "^2.3.0"
hypothesis = {version = "^6.103.5", extras = ["numpy"]}
pre-commit = "^3.7.1"
pyright = "^1.1.364"
pytest = "^8.2.1"
pyright = "^1.1.368"
pytest = "^8.2.2"
pytest-doctestplus = "^1.2.1"
ruff = "^0.4.5"
ruff = "^0.4.10"
tomli = {version = "^2.0.1", python = "<3.11"}

[tool.poetry.group.docs.dependencies]
mkdocs = "^1.6.0"
mkdocs-material = "^9.5.24"
mkdocs-include-markdown-plugin = "^6.0.6"
mkdocs-material = "^9.5.27"
mkdocs-include-markdown-plugin = "^6.2.1"
mkdocstrings = {version = "^0.25.1", extras = ["python"]}
mkdocs-git-revision-date-localized-plugin = "^1.2.5"
mkdocs-git-revision-date-localized-plugin = "^1.2.6"
mkdocs-minify-plugin = "^0.8.0"

[tool.poetry.group.debug.dependencies]
ipython = "^8.24.0"
ipython = "^8.25.0"
ipykernel = "^6.29.4"
matplotlib = "^3.9.0"
typing-extensions = "^4.11.0"
typing-extensions = "^4.12.2"

[tool.poetry.group.pandas.dependencies]
pandas = "*"
Expand All @@ -87,7 +87,7 @@ numpy = "<=2"
optional = true
[tool.poetry.group.numpy2.dependencies]
numpy = {version = ">=2.0.0rc2", allow-prereleases = true}
scipy = ">=1.13.1"
scipy = ">=1.14.0"

[tool.poetry.extras]
pandas = ["pandas"]
Expand Down