From ee213d4341f51da264340aef9416cfff84083a65 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Jan 2026 18:41:11 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.0.1 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.0.1...v6.0.0) - [github.com/asottile/pyupgrade: v2.26.0 → v3.21.2](https://github.com/asottile/pyupgrade/compare/v2.26.0...v3.21.2) - https://github.com/asottile/reorder_python_imports → https://github.com/asottile/reorder-python-imports - [github.com/asottile/reorder-python-imports: v2.6.0 → v3.16.0](https://github.com/asottile/reorder-python-imports/compare/v2.6.0...v3.16.0) - https://github.com/psf/black → https://github.com/psf/black-pre-commit-mirror - [github.com/psf/black-pre-commit-mirror: 22.3.0 → 26.1.0](https://github.com/psf/black-pre-commit-mirror/compare/22.3.0...26.1.0) - [github.com/asottile/blacken-docs: v1.12.1 → 1.20.0](https://github.com/asottile/blacken-docs/compare/v1.12.1...1.20.0) - [github.com/PyCQA/flake8: 3.9.2 → 7.3.0](https://github.com/PyCQA/flake8/compare/3.9.2...7.3.0) - [github.com/PyCQA/doc8: 0.9.0 → v2.0.0](https://github.com/PyCQA/doc8/compare/0.9.0...v2.0.0) --- .pre-commit-config.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index db41843d4..48e163ed8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v6.0.0 hooks: - id: check-added-large-files args: ['--maxkb=100'] @@ -10,25 +10,25 @@ repos: - id: debug-statements - id: end-of-file-fixer - repo: https://github.com/asottile/pyupgrade - rev: v2.26.0 + rev: v3.21.2 hooks: - id: pyupgrade args: [--py36-plus] -- repo: https://github.com/asottile/reorder_python_imports - rev: v2.6.0 +- repo: https://github.com/asottile/reorder-python-imports + rev: v3.16.0 hooks: - id: reorder-python-imports -- repo: https://github.com/psf/black - rev: 22.3.0 +- repo: https://github.com/psf/black-pre-commit-mirror + rev: 26.1.0 hooks: - id: black - repo: https://github.com/asottile/blacken-docs - rev: v1.12.1 + rev: 1.20.0 hooks: - id: blacken-docs additional_dependencies: [black] - repo: https://github.com/PyCQA/flake8 - rev: 3.9.2 + rev: 7.3.0 hooks: - id: flake8 additional_dependencies: [ @@ -47,7 +47,7 @@ repos: Pygments, ] - repo: https://github.com/PyCQA/doc8 - rev: 0.9.0 + rev: v2.0.0 hooks: - id: doc8 # - repo: https://github.com/codespell-project/codespell From e455fdbb5e54546ade8fd2afe1405065ad7c6af2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Jan 2026 18:41:36 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- development/testing/regression.py | 1 + development/testing/testing_pull_request.py | 1 + docs/conf.py | 1 - docs/projects/_numerical_integration.py | 1 + respy/__init__.py | 2 +- respy/_numba.py | 1 + respy/conditional_draws.py | 1 + respy/config.py | 1 + respy/conftest.py | 1 + respy/data.py | 1 + respy/exogenous_processes.py | 1 + respy/interface.py | 1 + respy/interpolate.py | 1 + respy/likelihood.py | 1 + respy/method_of_simulated_moments.py | 1 + respy/parallelization.py | 1 + respy/pre_processing/data_checking.py | 1 + respy/pre_processing/model_checking.py | 1 + respy/pre_processing/model_processing.py | 7 ++++--- respy/pre_processing/process_covariates.py | 1 + respy/shared.py | 1 + respy/simulate.py | 1 + respy/solve.py | 1 + respy/state_space.py | 1 + respy/tests/random_model.py | 2 +- respy/tests/test_flexible_choices.py | 1 + respy/tests/test_method_of_simulated_moments.py | 1 + respy/tests/test_model_processing.py | 9 +++------ respy/tests/test_process_covariates.py | 8 ++------ respy/tests/test_randomness.py | 1 + respy/tests/test_regression.py | 1 + respy/tests/test_replication_kw_94.py | 2 +- respy/tests/test_simulate.py | 1 + setup.py | 2 +- 34 files changed, 39 insertions(+), 20 deletions(-) diff --git a/development/testing/regression.py b/development/testing/regression.py index 05c5e6102..1b0103933 100644 --- a/development/testing/regression.py +++ b/development/testing/regression.py @@ -1,4 +1,5 @@ """Create, run or investigate regression checks.""" + import pickle import socket diff --git a/development/testing/testing_pull_request.py b/development/testing/testing_pull_request.py index b0bc92def..e39b7eff8 100644 --- a/development/testing/testing_pull_request.py +++ b/development/testing/testing_pull_request.py @@ -1,4 +1,5 @@ """Run a series of tests that are required for any pull request to be merged.""" + import socket import click diff --git a/docs/conf.py b/docs/conf.py index d0d8d5e7b..43f1a5403 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -2,7 +2,6 @@ import os import sys - # Set variable so that todos are shown in local build on_rtd = os.environ.get("READTHEDOCS") == "True" diff --git a/docs/projects/_numerical_integration.py b/docs/projects/_numerical_integration.py index b1bfadc26..bb7bed46b 100644 --- a/docs/projects/_numerical_integration.py +++ b/docs/projects/_numerical_integration.py @@ -1,4 +1,5 @@ """Auxiliary and plotting functions for the respy tutorial numerical integration.""" + import matplotlib.pyplot as plt from matplotlib import ticker diff --git a/respy/__init__.py b/respy/__init__.py index 343dad74a..27e059ef4 100755 --- a/respy/__init__.py +++ b/respy/__init__.py @@ -9,6 +9,7 @@ rp. """ + import pytest from respy.config import ROOT_DIR @@ -22,7 +23,6 @@ from respy.solve import get_solve_func # noqa: F401 from respy.tests.random_model import add_noise_to_params # noqa: F401 - __all__ = [ "get_example_model", "get_parameter_constraints", diff --git a/respy/_numba.py b/respy/_numba.py index 93b9d50fd..bb55d9d31 100644 --- a/respy/_numba.py +++ b/respy/_numba.py @@ -1,4 +1,5 @@ """Special functions for using numba.""" + import warnings import numba as nb diff --git a/respy/conditional_draws.py b/respy/conditional_draws.py index 52b313391..fd25832f1 100644 --- a/respy/conditional_draws.py +++ b/respy/conditional_draws.py @@ -1,4 +1,5 @@ """Everything related to conditional draws for the maximum likelihood estimation.""" + import numpy as np from estimagic.utilities import robust_cholesky from numba import guvectorize diff --git a/respy/config.py b/respy/config.py index daf66830d..447d2bea1 100644 --- a/respy/config.py +++ b/respy/config.py @@ -1,4 +1,5 @@ """General configuration for respy.""" + from pathlib import Path import numpy as np diff --git a/respy/conftest.py b/respy/conftest.py index d85201eb4..bbe244b07 100644 --- a/respy/conftest.py +++ b/respy/conftest.py @@ -1,4 +1,5 @@ """This module includes code to configure pytest.""" + import os import numpy as np diff --git a/respy/data.py b/respy/data.py index 78642c4f7..979be88d1 100644 --- a/respy/data.py +++ b/respy/data.py @@ -1,4 +1,5 @@ """Everything related to the original data from Keane and Wolpin (1997).""" + import numpy as np import pandas as pd diff --git a/respy/exogenous_processes.py b/respy/exogenous_processes.py index f34b03c38..61a8c62ea 100644 --- a/respy/exogenous_processes.py +++ b/respy/exogenous_processes.py @@ -1,4 +1,5 @@ """Utils for the inclusion of exogenous processes.""" + import functools import numpy as np diff --git a/respy/interface.py b/respy/interface.py index 1287e1296..39ed6cdbe 100644 --- a/respy/interface.py +++ b/respy/interface.py @@ -1,4 +1,5 @@ """General interface functions for respy.""" + import warnings import pandas as pd diff --git a/respy/interpolate.py b/respy/interpolate.py index fb7977076..616231e87 100644 --- a/respy/interpolate.py +++ b/respy/interpolate.py @@ -1,4 +1,5 @@ """This module contains the code for approximate solutions to the DCDP.""" + import warnings import numba as nb diff --git a/respy/likelihood.py b/respy/likelihood.py index 8c8947abf..944e9f746 100644 --- a/respy/likelihood.py +++ b/respy/likelihood.py @@ -1,4 +1,5 @@ """Everything related to the estimation with maximum likelihood.""" + import warnings from functools import partial diff --git a/respy/method_of_simulated_moments.py b/respy/method_of_simulated_moments.py index 0d259f569..dd5d9680b 100644 --- a/respy/method_of_simulated_moments.py +++ b/respy/method_of_simulated_moments.py @@ -15,6 +15,7 @@ of Asset Prices. Econometrica, 61(4), 929-952. """ + import copy import functools diff --git a/respy/parallelization.py b/respy/parallelization.py index b3cf7400a..09111e955 100644 --- a/respy/parallelization.py +++ b/respy/parallelization.py @@ -1,4 +1,5 @@ """This module contains the code to control parallel execution.""" + import functools import joblib diff --git a/respy/pre_processing/data_checking.py b/respy/pre_processing/data_checking.py index 59f3f6a0b..bc361fcd2 100644 --- a/respy/pre_processing/data_checking.py +++ b/respy/pre_processing/data_checking.py @@ -1,4 +1,5 @@ """Test functions to ensure the validity of data.""" + import numpy as np from respy.shared import generate_column_dtype_dict_for_estimation diff --git a/respy/pre_processing/model_checking.py b/respy/pre_processing/model_checking.py index 97ce3d90e..e0bf8baa0 100644 --- a/respy/pre_processing/model_checking.py +++ b/respy/pre_processing/model_checking.py @@ -1,4 +1,5 @@ """Everything related to validate the model.""" + import numba as nb import numpy as np diff --git a/respy/pre_processing/model_processing.py b/respy/pre_processing/model_processing.py index fc6d08be7..0b764b99f 100644 --- a/respy/pre_processing/model_processing.py +++ b/respy/pre_processing/model_processing.py @@ -1,4 +1,5 @@ """Process model specification files or objects.""" + import copy import itertools import os @@ -802,9 +803,9 @@ def _convert_labels_in_formulas_to_codes(options, optim_paras): for choice in optim_paras["choices"]: for i, formula in enumerate(options["negative_choice_set"].get(choice, [])): - options["negative_choice_set"][choice][ - i - ] = _replace_choices_and_observables_in_formula(formula, optim_paras) + options["negative_choice_set"][choice][i] = ( + _replace_choices_and_observables_in_formula(formula, optim_paras) + ) return options diff --git a/respy/pre_processing/process_covariates.py b/respy/pre_processing/process_covariates.py index b15b79534..036d3d638 100644 --- a/respy/pre_processing/process_covariates.py +++ b/respy/pre_processing/process_covariates.py @@ -1,4 +1,5 @@ """This module comprises all functions which process the definition of covariates.""" + import copy diff --git a/respy/shared.py b/respy/shared.py index d49722083..7562db8dc 100644 --- a/respy/shared.py +++ b/respy/shared.py @@ -4,6 +4,7 @@ import from respy itself. This is to prevent circular imports. """ + import shutil import numba as nb diff --git a/respy/simulate.py b/respy/simulate.py index 680e95cd9..f396f5236 100644 --- a/respy/simulate.py +++ b/respy/simulate.py @@ -1,4 +1,5 @@ """Everything related to the simulation of data with structural models.""" + import functools import warnings diff --git a/respy/solve.py b/respy/solve.py index 76550da14..f6f505902 100644 --- a/respy/solve.py +++ b/respy/solve.py @@ -1,4 +1,5 @@ """Everything related to the solution of a structural model.""" + import functools import numpy as np diff --git a/respy/state_space.py b/respy/state_space.py index dd7133b9c..75e76e798 100644 --- a/respy/state_space.py +++ b/respy/state_space.py @@ -1,4 +1,5 @@ """Everything related to the state space of a structural model.""" + import itertools import numba as nb diff --git a/respy/tests/random_model.py b/respy/tests/random_model.py index 0af2a3237..4fbd225e9 100644 --- a/respy/tests/random_model.py +++ b/respy/tests/random_model.py @@ -1,4 +1,5 @@ """This module contains the functions for the generation of random requests.""" + import collections import copy @@ -26,7 +27,6 @@ from respy.simulate import _random_choice from respy.simulate import get_simulate_func - _BASE_COVARIATES = { "not_any_exp_a": "exp_a == 0", "not_any_exp_b": "exp_b == 0", diff --git a/respy/tests/test_flexible_choices.py b/respy/tests/test_flexible_choices.py index 5200f1f79..cb3e72255 100644 --- a/respy/tests/test_flexible_choices.py +++ b/respy/tests/test_flexible_choices.py @@ -1,4 +1,5 @@ """Contains code for testing for flexible choices.""" + import pandas as pd import pytest diff --git a/respy/tests/test_method_of_simulated_moments.py b/respy/tests/test_method_of_simulated_moments.py index 53f7698a5..d22e19f70 100644 --- a/respy/tests/test_method_of_simulated_moments.py +++ b/respy/tests/test_method_of_simulated_moments.py @@ -1,4 +1,5 @@ """Test the msm interface of respy.""" + import copy import numpy as np diff --git a/respy/tests/test_model_processing.py b/respy/tests/test_model_processing.py index 60425d4c0..daa10e95c 100644 --- a/respy/tests/test_model_processing.py +++ b/respy/tests/test_model_processing.py @@ -1,4 +1,5 @@ """Test model generation.""" + import io import textwrap @@ -144,17 +145,13 @@ def test_convert_labels_in_covariates_to_codes(): @pytest.mark.precise def test_parse_observables(): params = pd.read_csv( - io.StringIO( - textwrap.dedent( - """ + io.StringIO(textwrap.dedent(""" category,name,value observable_fishing_grounds_rich_grounds,probability,0.5 observable_fishing_grounds_poor_grounds,probability,0.5 observable_ability_low_middle,probability,0.5 observable_ability_high,probability,0.5 - """ - ) - ), + """)), index_col=["category", "name"], )["value"] optim_paras = _parse_exogenous_processes({}, params) diff --git a/respy/tests/test_process_covariates.py b/respy/tests/test_process_covariates.py index a9c9580d9..e419837c6 100644 --- a/respy/tests/test_process_covariates.py +++ b/respy/tests/test_process_covariates.py @@ -11,16 +11,12 @@ @pytest.mark.precise def test_identify_relevant_covariates(): params = pd.read_csv( - io.StringIO( - dedent( - """ + io.StringIO(dedent(""" category,name,value wage_a,constant,1 nonpec_b,upper_upper,1 wage_c,upper_upper_with_spacing_problem,1 - """ - ) - ), + """)), index_col=["category", "name"], ) diff --git a/respy/tests/test_randomness.py b/respy/tests/test_randomness.py index 7d3cd0e63..ab413d0f2 100644 --- a/respy/tests/test_randomness.py +++ b/respy/tests/test_randomness.py @@ -1,4 +1,5 @@ """This module includes test to specifically test that randomness is held constant.""" + import numpy as np import pytest diff --git a/respy/tests/test_regression.py b/respy/tests/test_regression.py index e442446c3..92bb64f09 100644 --- a/respy/tests/test_regression.py +++ b/respy/tests/test_regression.py @@ -1,4 +1,5 @@ """Run a few regression tests.""" + import pickle import numpy as np diff --git a/respy/tests/test_replication_kw_94.py b/respy/tests/test_replication_kw_94.py index 19a3dc372..d81e4889c 100644 --- a/respy/tests/test_replication_kw_94.py +++ b/respy/tests/test_replication_kw_94.py @@ -23,6 +23,7 @@ 181. """ + import numpy as np import pandas as pd import pytest @@ -30,7 +31,6 @@ import respy as rp from respy.config import TEST_RESOURCES_DIR - pytestmark = pytest.mark.slow diff --git a/respy/tests/test_simulate.py b/respy/tests/test_simulate.py index b5a5421a0..f62ecb06d 100644 --- a/respy/tests/test_simulate.py +++ b/respy/tests/test_simulate.py @@ -1,4 +1,5 @@ """Test the simulation routine.""" + import numpy as np import pandas as pd import pytest diff --git a/setup.py b/setup.py index eb7a57bd7..1246ca2e2 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,10 @@ """The general package information for respy.""" + from pathlib import Path from setuptools import find_packages from setuptools import setup - DESCRIPTION = ( "respy is a Python package for the simulation and estimation of a prototypical " "finite-horizon dynamic discrete choice model."