Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (pymc-devs#7191)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.2.2 → v0.3.2](astral-sh/ruff-pre-commit@v0.2.2...v0.3.2)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Mar 13, 2024
1 parent 244fb97 commit 5d4f469
Show file tree
Hide file tree
Showing 22 changed files with 26 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:
- --exclude=binder/
- --exclude=versioneer.py
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
rev: v0.3.2
hooks:
- id: ruff
args: ["--fix", "--output-format=full"]
Expand Down
4 changes: 1 addition & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
""" Sphinx configuration file.
"""
"""Sphinx configuration file."""
#!/usr/bin/env python3
#
# pymc documentation build configuration file, created by
Expand Down
1 change: 1 addition & 0 deletions pymc/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
Saved backends can be loaded using `arviz.from_netcdf`
"""

from collections.abc import Mapping, Sequence
from copy import copy
from typing import Optional, Union
Expand Down
1 change: 1 addition & 0 deletions pymc/backends/arviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""PyMC-ArviZ conversion code."""

import logging
import warnings

Expand Down
1 change: 1 addition & 0 deletions pymc/backends/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
See the docstring for pymc.backends for more information
"""

import itertools as itl
import logging
import warnings
Expand Down
1 change: 0 additions & 1 deletion pymc/backends/ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
Store sampling values in memory as a NumPy array.
"""


from typing import Any, Optional

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions pymc/blocking.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
Classes for working with subsets of parameters.
"""

from __future__ import annotations

from collections.abc import Sequence
Expand Down
1 change: 1 addition & 0 deletions pymc/distributions/dist_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
@author: johnsalvatier
"""

import warnings

from collections.abc import Iterable
Expand Down
1 change: 1 addition & 0 deletions pymc/distributions/shape_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
A collection of common shape operations needed for broadcasting
samples from probability distributions for stochastic nodes in PyMC.
"""

import warnings

from collections.abc import Sequence
Expand Down
6 changes: 2 additions & 4 deletions pymc/model/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,9 @@ def __init__(self, mean=0, sigma=1, name=''):

if TYPE_CHECKING:

def __enter__(self: Self) -> Self:
...
def __enter__(self: Self) -> Self: ...

def __exit__(self, exc_type: None, exc_val: None, exc_tb: None) -> None:
...
def __exit__(self, exc_type: None, exc_val: None, exc_tb: None) -> None: ...

def __new__(cls, *args, **kwargs):
# resolves the parent instance
Expand Down
1 change: 1 addition & 0 deletions pymc/plots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"exploratory analysis of Bayesian models."
See https://arviz-devs.github.io/arviz/ for details on plots.
"""

import functools
import sys
import warnings
Expand Down
6 changes: 2 additions & 4 deletions pymc/sampling/mcmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,7 @@ def sample(
callback=None,
mp_ctx=None,
**kwargs,
) -> InferenceData:
...
) -> InferenceData: ...


@overload
Expand Down Expand Up @@ -416,8 +415,7 @@ def sample(
mp_ctx=None,
model: Optional[Model] = None,
**kwargs,
) -> MultiTrace:
...
) -> MultiTrace: ...


def sample(
Expand Down
4 changes: 1 addition & 3 deletions pymc/sampling/population.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ def warn_population_size(
if has_demcmc and chains < 3:
raise ValueError(
"DEMetropolis requires at least 3 chains. "
"For this {}-dimensional model you should use ≥{} chains".format(
initial_point_model_size, initial_point_model_size + 1
)
f"For this {initial_point_model_size}-dimensional model you should use ≥{initial_point_model_size + 1} chains"
)
if has_demcmc and chains <= initial_point_model_size:
warnings.warn(
Expand Down
1 change: 1 addition & 0 deletions pymc/stats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
purpose library for "exploratory analysis of Bayesian models."
See https://arviz-devs.github.io/arviz/ for details.
"""

import sys

import arviz as az
Expand Down
6 changes: 2 additions & 4 deletions pymc/step_methods/hmc/quadpotential.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,10 @@ class QuadPotential:
dtype: np.dtype

@overload
def velocity(self, x: np.ndarray, out: None) -> np.ndarray:
...
def velocity(self, x: np.ndarray, out: None) -> np.ndarray: ...

@overload
def velocity(self, x: np.ndarray, out: np.ndarray) -> None:
...
def velocity(self, x: np.ndarray, out: np.ndarray) -> None: ...

def velocity(self, x: np.ndarray, out: np.ndarray | None = None) -> np.ndarray | None:
"""Compute the current velocity at a position in parameter space."""
Expand Down
1 change: 1 addition & 0 deletions pymc/tuning/starting.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
@author: johnsalvatier
"""

import sys
import warnings

Expand Down
11 changes: 4 additions & 7 deletions pymc/variational/opvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,9 +708,8 @@ def group_for_params(cls, params):
def group_for_short_name(cls, name):
if name.lower() not in cls.__name_registry:
raise KeyError(
"No such group: {!r}, " "only the following are supported\n\n{}".format(
name, cls.__name_registry
)
f"No such group: {name!r}, "
f"only the following are supported\n\n{cls.__name_registry}"
)
return cls.__name_registry[name.lower()]

Expand Down Expand Up @@ -983,14 +982,12 @@ def symbolic_random(self):
@overload
def set_size_and_deterministic(
self, node: Variable, s, d: bool, more_replacements: dict | None = None
) -> Variable:
...
) -> Variable: ...

@overload
def set_size_and_deterministic(
self, node: list[Variable], s, d: bool, more_replacements: dict | None = None
) -> list[Variable]:
...
) -> list[Variable]: ...

@pytensor.config.change_flags(compute_test_value="off")
def set_size_and_deterministic(
Expand Down
1 change: 1 addition & 0 deletions pymc/variational/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
Taken from the Lasagne project: http://lasagne.readthedocs.io/en/latest/
"""

from collections import OrderedDict
from functools import partial

Expand Down
1 change: 1 addition & 0 deletions scripts/check_all_tests_are_covered.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
This is intended to be used as a pre-commit hook, see `.pre-commit-config.yaml`.
You can run it manually with `pre-commit run check-no-tests-are-ignored --all`.
"""

import itertools
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions scripts/generate_pip_deps_from_conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
This is intended to be used as a pre-commit hook, see `.pre-commit-config.yaml`.
You can run it manually with `pre-commit run pip-from-conda --all`.
"""

import argparse
import re

Expand Down
1 change: 1 addition & 0 deletions scripts/run_mypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-----
python scripts/run_mypy.py [--verbose]
"""

import argparse
import importlib
import os
Expand Down
1 change: 0 additions & 1 deletion setupegg.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@
A setup.py script to use setuptools, which gives egg goodness, etc.
"""


with open("setup.py") as s:
exec(s.read())

0 comments on commit 5d4f469

Please sign in to comment.