{"language": "Python", "id": 3, "repo_owner": "pymc-devs", "repo_name": "pymc", "head_branch": "ruff_linter", "workflow_name": "pre-commit", "workflow_filename": "pre-commit.yml", "workflow_path": ".github/workflows/pre-commit.yml", "contributor": "juanitorduz", "sha_fail": "92937f3e3c898a7c90b04b04341d4f1b75e275cf", "sha_success": "2b3a34a0527b4258f6f18f0187e9116edf412f0e", "workflow": "name: pre-commit\n\non:\n pull_request:\n push:\n branches: [main]\n\njobs:\n pre-commit:\n runs-on: ubuntu-latest\n env:\n SKIP: no-commit-to-branch\n steps:\n - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.9\" # Run pre-commit on oldest supported Python version\n - uses: pre-commit/action@v3.0.0\n mypy:\n runs-on: ubuntu-latest\n defaults:\n run:\n shell: bash -l {0}\n steps:\n - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11\n - name: Cache conda\n uses: actions/cache@v3\n env:\n # Increase this value to reset cache if environment-test.yml has not changed\n CACHE_NUMBER: 0\n with:\n path: ~/conda_pkgs_dir\n key: ${{ runner.os }}-py39-conda-${{ env.CACHE_NUMBER }}-${{\n hashFiles('conda-envs/environment-test.yml') }}\n - name: Cache multiple paths\n uses: actions/cache@v3\n env:\n # Increase this value to reset cache if requirements.txt has not changed\n CACHE_NUMBER: 0\n with:\n path: |\n ~/.cache/pip\n $RUNNER_TOOL_CACHE/Python/*\n ~\\AppData\\Local\\pip\\Cache\n key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{\n hashFiles('requirements.txt') }}\n - uses: conda-incubator/setup-miniconda@v2\n with:\n miniforge-variant: Mambaforge\n miniforge-version: latest\n mamba-version: \"*\"\n activate-environment: pymc-test\n channel-priority: strict\n environment-file: conda-envs/environment-test.yml\n python-version: \"3.9\" # Run pre-commit on oldest supported Python version\n use-mamba: true\n use-only-tar-bz2: false # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267\n - name: Install-pymc and mypy dependencies\n run: |\n conda activate pymc-test\n pip install -e .\n pip install --pre -U polyagamma\n python --version\n - name: Run mypy\n run: |\n conda activate pymc-test\n python ./scripts/run_mypy.py --verbose\n", "logs": [{"step_name": "pre-commit/4_Run pre-commitaction@v3.0.0.txt", "log": "##[group]Run pre-commit/action@v3.0.0\nwith:\n extra_args: --all-files\nenv:\n SKIP: no-commit-to-branch\n pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64\n PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig\n Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib\n##[endgroup]\n##[group]Run python -m pip install pre-commit\n\u001b[36;1mpython -m pip install pre-commit\u001b[0m\nshell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}\nenv:\n SKIP: no-commit-to-branch\n pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64\n PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig\n Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib\n##[endgroup]\nCollecting pre-commit\n Downloading pre_commit-3.6.0-py2.py3-none-any.whl.metadata (1.3 kB)\nCollecting cfgv>=2.0.0 (from pre-commit)\n Downloading cfgv-3.4.0-py2.py3-none-any.whl.metadata (8.5 kB)\nCollecting identify>=1.0.0 (from pre-commit)\n Downloading identify-2.5.33-py2.py3-none-any.whl.metadata (4.4 kB)\nCollecting nodeenv>=0.11.1 (from pre-commit)\n Downloading nodeenv-1.8.0-py2.py3-none-any.whl.metadata (21 kB)\nCollecting pyyaml>=5.1 (from pre-commit)\n Downloading PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)\nCollecting virtualenv>=20.10.0 (from pre-commit)\n Downloading virtualenv-20.25.0-py3-none-any.whl.metadata (4.5 kB)\nRequirement already satisfied: setuptools in /opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages (from nodeenv>=0.11.1->pre-commit) (58.1.0)\nCollecting distlib<1,>=0.3.7 (from virtualenv>=20.10.0->pre-commit)\n Downloading distlib-0.3.8-py2.py3-none-any.whl.metadata (5.1 kB)\nCollecting filelock<4,>=3.12.2 (from virtualenv>=20.10.0->pre-commit)\n Downloading filelock-3.13.1-py3-none-any.whl.metadata (2.8 kB)\nCollecting platformdirs<5,>=3.9.1 (from virtualenv>=20.10.0->pre-commit)\n Downloading platformdirs-4.1.0-py3-none-any.whl.metadata (11 kB)\nDownloading pre_commit-3.6.0-py2.py3-none-any.whl (204 kB)\n \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 204.0/204.0 kB 15.9 MB/s eta 0:00:00\nDownloading cfgv-3.4.0-py2.py3-none-any.whl (7.2 kB)\nDownloading identify-2.5.33-py2.py3-none-any.whl (98 kB)\n \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 98.9/98.9 kB 27.2 MB/s eta 0:00:00\nDownloading nodeenv-1.8.0-py2.py3-none-any.whl (22 kB)\nDownloading PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (738 kB)\n \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 738.9/738.9 kB 52.7 MB/s eta 0:00:00\nDownloading virtualenv-20.25.0-py3-none-any.whl (3.8 MB)\n \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 3.8/3.8 MB 108.7 MB/s eta 0:00:00\nDownloading distlib-0.3.8-py2.py3-none-any.whl (468 kB)\n \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 468.9/468.9 kB 69.4 MB/s eta 0:00:00\nDownloading filelock-3.13.1-py3-none-any.whl (11 kB)\nDownloading platformdirs-4.1.0-py3-none-any.whl (17 kB)\nInstalling collected packages: distlib, pyyaml, platformdirs, nodeenv, identify, filelock, cfgv, virtualenv, pre-commit\nSuccessfully installed cfgv-3.4.0 distlib-0.3.8 filelock-3.13.1 identify-2.5.33 nodeenv-1.8.0 platformdirs-4.1.0 pre-commit-3.6.0 pyyaml-6.0.1 virtualenv-20.25.0\n\n[notice] A new release of pip is available: 23.0.1 -> 23.3.2\n[notice] To update, run: pip install --upgrade pip\n##[group]Run python -m pip freeze --local\n\u001b[36;1mpython -m pip freeze --local\u001b[0m\nshell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}\nenv:\n SKIP: no-commit-to-branch\n pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64\n PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig\n Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib\n##[endgroup]\ncfgv==3.4.0\ndistlib==0.3.8\nfilelock==3.13.1\nidentify==2.5.33\nnodeenv==1.8.0\nplatformdirs==4.1.0\npre-commit==3.6.0\nPyYAML==6.0.1\nvirtualenv==20.25.0\n##[group]Run actions/cache@v3\nwith:\n path: ~/.cache/pre-commit\n key: pre-commit-3|/opt/hostedtoolcache/Python/3.9.18/x64|b69a9ccf7aebb98803ff18cb769a19428ca4b15f855ee813cd0630df2c6b60db\n enableCrossOsArchive: false\n fail-on-cache-miss: false\n lookup-only: false\nenv:\n SKIP: no-commit-to-branch\n pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64\n PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig\n Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib\n##[endgroup]\nCache not found for input keys: pre-commit-3|/opt/hostedtoolcache/Python/3.9.18/x64|b69a9ccf7aebb98803ff18cb769a19428ca4b15f855ee813cd0630df2c6b60db\n##[group]Run pre-commit run --show-diff-on-failure --color=always --all-files\n\u001b[36;1mpre-commit run --show-diff-on-failure --color=always --all-files\u001b[0m\nshell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}\nenv:\n SKIP: no-commit-to-branch\n pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64\n PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig\n Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib\n##[endgroup]\n[INFO]\u001b[m Initializing environment for https://github.com/pre-commit/pre-commit-hooks.\n[INFO]\u001b[m Initializing environment for https://github.com/lucianopaz/head_of_apache.\n[INFO]\u001b[m Initializing environment for https://github.com/astral-sh/ruff-pre-commit.\n[INFO]\u001b[m Initializing environment for https://github.com/PyCQA/pydocstyle.\n[INFO]\u001b[m Initializing environment for https://github.com/MarcoGorelli/madforhooks.\n[INFO]\u001b[m Initializing environment for local:pandas,pyyaml.\n[INFO]\u001b[m Initializing environment for local:pyyaml.\n[INFO]\u001b[m Installing environment for https://github.com/pre-commit/pre-commit-hooks.\n[INFO]\u001b[m Once installed this environment will be reused.\n[INFO]\u001b[m This may take a few minutes...\n[INFO]\u001b[m Installing environment for https://github.com/lucianopaz/head_of_apache.\n[INFO]\u001b[m Once installed this environment will be reused.\n[INFO]\u001b[m This may take a few minutes...\n[INFO]\u001b[m Installing environment for https://github.com/astral-sh/ruff-pre-commit.\n[INFO]\u001b[m Once installed this environment will be reused.\n[INFO]\u001b[m This may take a few minutes...\n[INFO]\u001b[m Installing environment for https://github.com/PyCQA/pydocstyle.\n[INFO]\u001b[m Once installed this environment will be reused.\n[INFO]\u001b[m This may take a few minutes...\n[INFO]\u001b[m Installing environment for https://github.com/MarcoGorelli/madforhooks.\n[INFO]\u001b[m Once installed this environment will be reused.\n[INFO]\u001b[m This may take a few minutes...\n[INFO]\u001b[m Installing environment for local.\n[INFO]\u001b[m Once installed this environment will be reused.\n[INFO]\u001b[m This may take a few minutes...\n[INFO]\u001b[m Installing environment for local.\n[INFO]\u001b[m Once installed this environment will be reused.\n[INFO]\u001b[m This may take a few minutes...\ncheck for merge conflicts............................................................\u001b[42mPassed\u001b[m\ncheck toml...........................................................................\u001b[42mPassed\u001b[m\ncheck yaml...........................................................................\u001b[42mPassed\u001b[m\ndebug statements (python)............................................................\u001b[42mPassed\u001b[m\nfix end of files.....................................................................\u001b[42mPassed\u001b[m\ndon't commit to branch..............................................................\u001b[43;30mSkipped\u001b[m\nfix requirements.txt.................................................................\u001b[42mPassed\u001b[m\ntrim trailing whitespace.............................................................\u001b[42mPassed\u001b[m\nApply Apache 2.0 License.............................................................\u001b[42mPassed\u001b[m\nruff.................................................................................\u001b[41mFailed\u001b[m\n\u001b[2m- hook id: ruff\u001b[m\n\u001b[2m- exit code: 1\u001b[m\n\u001b[2m- files were modified by this hook\u001b[m\n\n\u001b[1mpymc/_version.py\u001b[0m\u001b[36m:\u001b[0m157\u001b[36m:\u001b[0m13\u001b[36m:\u001b[0m \u001b[1;31mUP031\u001b[0m Use format specifiers instead of percent format\n\u001b[1;38;5;12m |\u001b[0m\n\u001b[1;38;5;12m155 |\u001b[0m if verbose:\n\u001b[1;38;5;12m156 |\u001b[0m print(\n\u001b[1;38;5;12m157 |\u001b[0m \"Tried directories %s but none started with prefix %s\"\n\u001b[1;38;5;12m |\u001b[0m \u001b[1;38;5;9m_____________^\u001b[0m\n\u001b[1;38;5;12m158 |\u001b[0m \u001b[1;38;5;9m|\u001b[0m % (str(rootdirs), parentdir_prefix)\n\u001b[1;38;5;12m |\u001b[0m \u001b[1;38;5;9m|\u001b[0m\u001b[1;38;5;9m_______________________________________________^\u001b[0m \u001b[1;38;5;9mUP031\u001b[0m\n\u001b[1;38;5;12m159 |\u001b[0m )\n\u001b[1;38;5;12m160 |\u001b[0m raise NotThisMethod(\"rootdir doesn't start with parentdir_prefix\")\n\u001b[1;38;5;12m |\u001b[0m\n \u001b[1;38;5;12m=\u001b[0m \u001b[1;38;5;14mhelp\u001b[0m: Replace with format specifiers\n\n\u001b[1mpymc/step_methods/hmc/integration.py\u001b[0m\u001b[36m:\u001b[0m47\u001b[36m:\u001b[0m17\u001b[36m:\u001b[0m \u001b[1;31mUP031\u001b[0m Use format specifiers instead of percent format\n\u001b[1;38;5;12m |\u001b[0m\n\u001b[1;38;5;12m45 |\u001b[0m if self._potential.dtype != self._dtype:\n\u001b[1;38;5;12m46 |\u001b[0m raise ValueError(\n\u001b[1;38;5;12m47 |\u001b[0m \"dtypes of potential (%s) and logp function (%s)\"\n\u001b[1;38;5;12m |\u001b[0m \u001b[1;38;5;9m_________________^\u001b[0m\n\u001b[1;38;5;12m48 |\u001b[0m \u001b[1;38;5;9m|\u001b[0m \"don't match.\" % (self._potential.dtype, self._dtype)\n\u001b[1;38;5;12m |\u001b[0m \u001b[1;38;5;9m|\u001b[0m\u001b[1;38;5;9m_____________________________________________________________________^\u001b[0m \u001b[1;38;5;9mUP031\u001b[0m\n\u001b[1;38;5;12m49 |\u001b[0m )\n\u001b[1;38;5;12m |\u001b[0m\n \u001b[1;38;5;12m=\u001b[0m \u001b[1;38;5;14mhelp\u001b[0m: Replace with format specifiers\n\n\u001b[1mpymc/variational/opvi.py\u001b[0m\u001b[36m:\u001b[0m461\u001b[36m:\u001b[0m17\u001b[36m:\u001b[0m \u001b[1;31mUP031\u001b[0m Use format specifiers instead of percent format\n\u001b[1;38;5;12m |\u001b[0m\n\u001b[1;38;5;12m459 |\u001b[0m if self.require_logq and not approx.has_logq:\n\u001b[1;38;5;12m460 |\u001b[0m raise ExplicitInferenceError(\n\u001b[1;38;5;12m461 |\u001b[0m \"%s requires logq, but %s does not implement it\"\n\u001b[1;38;5;12m |\u001b[0m \u001b[1;38;5;9m_________________^\u001b[0m\n\u001b[1;38;5;12m462 |\u001b[0m \u001b[1;38;5;9m|\u001b[0m \"please change inference method\" % (self, approx)\n\u001b[1;38;5;12m |\u001b[0m \u001b[1;38;5;9m|\u001b[0m\u001b[1;38;5;9m_________________________________________________________________^\u001b[0m \u001b[1;38;5;9mUP031\u001b[0m\n\u001b[1;38;5;12m463 |\u001b[0m )\n\u001b[1;38;5;12m |\u001b[0m\n \u001b[1;38;5;12m=\u001b[0m \u001b[1;38;5;14mhelp\u001b[0m: Replace with format specifiers\n\n\u001b[1mpymc/variational/opvi.py\u001b[0m\u001b[36m:\u001b[0m513\u001b[36m:\u001b[0m16\u001b[36m:\u001b[0m \u001b[1;31mUP031\u001b[0m Use format specifiers instead of percent format\n\u001b[1;38;5;12m |\u001b[0m\n\u001b[1;38;5;12m512 |\u001b[0m def __str__(self): # pragma: no cover\n\u001b[1;38;5;12m513 |\u001b[0m return \"%(op)s[%(ap)s]\" % dict(\n\u001b[1;38;5;12m |\u001b[0m \u001b[1;38;5;9m________________^\u001b[0m\n\u001b[1;38;5;12m514 |\u001b[0m \u001b[1;38;5;9m|\u001b[0m op=self.__class__.__name__, ap=self.approx.__class__.__name__\n\u001b[1;38;5;12m515 |\u001b[0m \u001b[1;38;5;9m|\u001b[0m )\n\u001b[1;38;5;12m |\u001b[0m \u001b[1;38;5;9m|\u001b[0m\u001b[1;38;5;9m_________^\u001b[0m \u001b[1;38;5;9mUP031\u001b[0m\n\u001b[1;38;5;12m |\u001b[0m\n \u001b[1;38;5;12m=\u001b[0m \u001b[1;38;5;14mhelp\u001b[0m: Replace with format specifiers\n\n\u001b[1mversioneer.py\u001b[0m\u001b[36m:\u001b[0m328\u001b[36m:\u001b[0m17\u001b[36m:\u001b[0m \u001b[1;31mUP031\u001b[0m Use format specifiers instead of percent format\n\u001b[1;38;5;12m |\u001b[0m\n\u001b[1;38;5;12m326 |\u001b[0m if me_dir != vsr_dir:\n\u001b[1;38;5;12m327 |\u001b[0m print(\n\u001b[1;38;5;12m328 |\u001b[0m \"Warning: build in %s is using versioneer.py from %s\"\n\u001b[1;38;5;12m |\u001b[0m \u001b[1;38;5;9m_________________^\u001b[0m\n\u001b[1;38;5;12m329 |\u001b[0m \u001b[1;38;5;9m|\u001b[0m % (os.path.dirname(my_path), versioneer_py)\n\u001b[1;38;5;12m |\u001b[0m \u001b[1;38;5;9m|\u001b[0m\u001b[1;38;5;9m___________________________________________________________^\u001b[0m \u001b[1;38;5;9mUP031\u001b[0m\n\u001b[1;38;5;12m330 |\u001b[0m )\n\u001b[1;38;5;12m331 |\u001b[0m except NameError:\n\u001b[1;38;5;12m |\u001b[0m\n \u001b[1;38;5;12m=\u001b[0m \u001b[1;38;5;14mhelp\u001b[0m: Replace with format specifiers\n\n\u001b[1mversioneer.py\u001b[0m\u001b[36m:\u001b[0m1388\u001b[36m:\u001b[0m13\u001b[36m:\u001b[0m \u001b[1;31mUP031\u001b[0m Use format specifiers instead of percent format\n\u001b[1;38;5;12m |\u001b[0m\n\u001b[1;38;5;12m1386 |\u001b[0m if verbose:\n\u001b[1;38;5;12m1387 |\u001b[0m print(\n\u001b[1;38;5;12m1388 |\u001b[0m \"Tried directories %s but none started with prefix %s\"\n\u001b[1;38;5;12m |\u001b[0m \u001b[1;38;5;9m_____________^\u001b[0m\n\u001b[1;38;5;12m1389 |\u001b[0m \u001b[1;38;5;9m|\u001b[0m % (str(rootdirs), parentdir_prefix)\n\u001b[1;38;5;12m |\u001b[0m \u001b[1;38;5;9m|\u001b[0m\u001b[1;38;5;9m_______________________________________________^\u001b[0m \u001b[1;38;5;9mUP031\u001b[0m\n\u001b[1;38;5;12m1390 |\u001b[0m )\n\u001b[1;38;5;12m1391 |\u001b[0m raise NotThisMethod(\"rootdir doesn't start with parentdir_prefix\")\n\u001b[1;38;5;12m |\u001b[0m\n \u001b[1;38;5;12m=\u001b[0m \u001b[1;38;5;14mhelp\u001b[0m: Replace with format specifiers\n\nFound 14 errors (8 fixed, 6 remaining).\nNo fixes available (6 hidden fixes can be enabled with the `--unsafe-fixes` option).\n\nruff-format..........................................................................\u001b[41mFailed\u001b[m\n\u001b[2m- hook id: ruff-format\u001b[m\n\u001b[2m- files were modified by this hook\u001b[m\n\n2 files reformatted, 206 files left unchanged\n\npydocstyle...........................................................................\u001b[42mPassed\u001b[m\nDisallow print statements............................................................\u001b[42mPassed\u001b[m\nCheck no tests are ignored...........................................................\u001b[42mPassed\u001b[m\nGenerate pip dependency from conda...................................................\u001b[42mPassed\u001b[m\nNo relative imports..................................................................\u001b[42mPassed\u001b[m\nCheck no links that should be cross-references are in the docs.......................\u001b[42mPassed\u001b[m\npre-commit hook(s) made changes.\nIf you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.\nTo run `pre-commit` as part of git workflow, use `pre-commit install`.\nAll changes made by hooks:\n\u001b[1mdiff --git a/pymc/gp/util.py b/pymc/gp/util.py\u001b[m\n\u001b[1mindex 39eb3b6..3f829ab 100644\u001b[m\n\u001b[1m--- a/pymc/gp/util.py\u001b[m\n\u001b[1m+++ b/pymc/gp/util.py\u001b[m\n\u001b[36m@@ -120,7 +120,7 @@\u001b[m \u001b[mdef kmeans_inducing_points(n_inducing, X, **kmeans_kwargs):\u001b[m\n \"To use K-means initialization, \"\u001b[m\n \"please provide X as a type that \"\u001b[m\n \"can be cast to np.ndarray, instead \"\u001b[m\n\u001b[31m- \"of {}\".format(type(X))\u001b[m\n\u001b[32m+\u001b[m\u001b[32m f\"of {type(X)}\"\u001b[m\n )\u001b[m\n scaling = np.std(X, 0)\u001b[m\n # if std of a column is very small (zero), don't normalize that column\u001b[m\n\u001b[1mdiff --git a/pymc/sampling/population.py b/pymc/sampling/population.py\u001b[m\n\u001b[1mindex 6dbe5cf..5ed98c0 100644\u001b[m\n\u001b[1m--- a/pymc/sampling/population.py\u001b[m\n\u001b[1m+++ b/pymc/sampling/population.py\u001b[m\n\u001b[36m@@ -135,7 +135,7 @@\u001b[m \u001b[mdef warn_population_size(\u001b[m\n if has_demcmc and chains <= initial_point_model_size:\u001b[m\n warnings.warn(\u001b[m\n \"DEMetropolis should be used with more chains than dimensions! \"\u001b[m\n\u001b[31m- \"(The model has {} dimensions.)\".format(initial_point_model_size),\u001b[m\n\u001b[32m+\u001b[m\u001b[32m f\"(The model has {initial_point_model_size} dimensions.)\",\u001b[m\n UserWarning,\u001b[m\n stacklevel=2,\u001b[m\n )\u001b[m\n\u001b[1mdiff --git a/pymc/step_methods/arraystep.py b/pymc/step_methods/arraystep.py\u001b[m\n\u001b[1mindex 4c945ab..35f1443 100644\u001b[m\n\u001b[1m--- a/pymc/step_methods/arraystep.py\u001b[m\n\u001b[1m+++ b/pymc/step_methods/arraystep.py\u001b[m\n\u001b[36m@@ -146,10 +146,8 @@\u001b[m \u001b[mclass PopulationArrayStepShared(ArrayStepShared):\u001b[m\n self.other_chains = [c for c in range(len(population)) if c != chain_index]\u001b[m\n if not len(self.other_chains) > 1:\u001b[m\n raise ValueError(\u001b[m\n\u001b[31m- \"Population is just {} + {}. \"\u001b[m\n\u001b[31m- \"This is too small and the error should have been raised earlier.\".format(\u001b[m\n\u001b[31m- self.this_chain, self.other_chains\u001b[m\n\u001b[31m- )\u001b[m\n\u001b[32m+\u001b[m\u001b[32m f\"Population is just {self.this_chain} + {self.other_chains}. \"\u001b[m\n\u001b[32m+\u001b[m\u001b[32m \"This is too small and the error should have been raised earlier.\"\u001b[m\n )\u001b[m\n return\u001b[m\n \u001b[m\n\u001b[1mdiff --git a/pymc/variational/inference.py b/pymc/variational/inference.py\u001b[m\n\u001b[1mindex ce3bd02..6ee5815 100644\u001b[m\n\u001b[1m--- a/pymc/variational/inference.py\u001b[m\n\u001b[1m+++ b/pymc/variational/inference.py\u001b[m\n\u001b[36m@@ -244,17 +244,11 @@\u001b[m \u001b[mclass Inference:\u001b[m\n if isinstance(e, StopIteration):\u001b[m\n logger.info(str(e))\u001b[m\n if n < 10:\u001b[m\n\u001b[31m- logger.info(\u001b[m\n\u001b[31m- \"Interrupted at {:,d} [{:.0f}%]: Loss = {:,.5g}\".format(\u001b[m\n\u001b[31m- i, 100 * i // n, scores[i]\u001b[m\n\u001b[31m- )\u001b[m\n\u001b[31m- )\u001b[m\n\u001b[32m+\u001b[m\u001b[32m logger.info(f\"Interrupted at {i:,d} [{100 * i // n:.0f}%]: Loss = {scores[i]:,.5g}\")\u001b[m\n else:\u001b[m\n avg_loss = _infmean(scores[min(0, i - 1000) : i + 1])\u001b[m\n logger.info(\u001b[m\n\u001b[31m- \"Interrupted at {:,d} [{:.0f}%]: Average Loss = {:,.5g}\".format(\u001b[m\n\u001b[31m- i, 100 * i // n, avg_loss\u001b[m\n\u001b[31m- )\u001b[m\n\u001b[32m+\u001b[m\u001b[32m f\"Interrupted at {i:,d} [{100 * i // n:.0f}%]: Average Loss = {avg_loss:,.5g}\"\u001b[m\n )\u001b[m\n else:\u001b[m\n if n == 0:\u001b[m\n\u001b[1mdiff --git a/pymc/variational/opvi.py b/pymc/variational/opvi.py\u001b[m\n\u001b[1mindex bd1874f..5d70575 100644\u001b[m\n\u001b[1m--- a/pymc/variational/opvi.py\u001b[m\n\u001b[1m+++ b/pymc/variational/opvi.py\u001b[m\n\u001b[36m@@ -701,8 +701,8 @@\u001b[m \u001b[mclass Group(WithMemoization):\u001b[m\n def group_for_params(cls, params):\u001b[m\n if frozenset(params) not in cls.__param_registry:\u001b[m\n raise KeyError(\u001b[m\n\u001b[31m- \"No such group for the following params: {!r}, \"\u001b[m\n\u001b[31m- \"only the following are supported\\n\\n{}\".format(params, cls.__param_registry)\u001b[m\n\u001b[32m+\u001b[m\u001b[32m f\"No such group for the following params: {params!r}, \"\u001b[m\n\u001b[32m+\u001b[m\u001b[32m f\"only the following are supported\\n\\n{cls.__param_registry}\"\u001b[m\n )\u001b[m\n return cls.__param_registry[frozenset(params)]\u001b[m\n \u001b[m\n\u001b[36m@@ -801,9 +801,7 @@\u001b[m \u001b[mclass Group(WithMemoization):\u001b[m\n if givens != needed:\u001b[m\n raise ParametrizationError(\u001b[m\n \"Passed parameters do not have a needed set of keys, \"\u001b[m\n\u001b[31m- \"they should be equal, got {givens}, needed {needed}\".format(\u001b[m\n\u001b[31m- givens=givens, needed=needed\u001b[m\n\u001b[31m- )\u001b[m\n\u001b[32m+\u001b[m\u001b[32m f\"they should be equal, got {givens}, needed {needed}\"\u001b[m\n )\u001b[m\n self._user_params = dict()\u001b[m\n spec = self.get_param_spec_for(d=self.ddim, **kwargs.pop(\"spec_kw\", {}))\u001b[m\n\u001b[1mdiff --git a/pymc/variational/updates.py b/pymc/variational/updates.py\u001b[m\n\u001b[1mindex fa6e52b..4f46970 100644\u001b[m\n\u001b[1m--- a/pymc/variational/updates.py\u001b[m\n\u001b[1m+++ b/pymc/variational/updates.py\u001b[m\n\u001b[36m@@ -1005,9 +1005,7 @@\u001b[m \u001b[mdef norm_constraint(tensor_var, max_norm, norm_axes=None, epsilon=1e-7):\u001b[m\n elif ndim in [3, 4, 5]: # Conv{1,2,3}DLayer\u001b[m\n sum_over = tuple(range(1, ndim))\u001b[m\n else:\u001b[m\n\u001b[31m- raise ValueError(\u001b[m\n\u001b[31m- \"Unsupported tensor dimensionality {}.\" \"Must specify `norm_axes`\".format(ndim)\u001b[m\n\u001b[31m- )\u001b[m\n\u001b[32m+\u001b[m\u001b[32m raise ValueError(f\"Unsupported tensor dimensionality {ndim}.\" \"Must specify `norm_axes`\")\u001b[m\n \u001b[m\n dtype = np.dtype(pytensor.config.floatX).type\u001b[m\n norms = pt.sqrt(pt.sum(pt.sqr(tensor_var), axis=sum_over, keepdims=True))\u001b[m\n##[error]Process completed with exit code 1.\n"}], "diff": "diff --git a/docs/source/contributing/python_style.md b/docs/source/contributing/python_style.md\nindex def33f053..5bb73d503 100644\n--- a/docs/source/contributing/python_style.md\n+++ b/docs/source/contributing/python_style.md\n@@ -33,7 +33,7 @@ git commit -m \"wip lol\" --no-verify\n To skip one particular hook, you can set the `SKIP` environment variable. E.g. (on Linux):\n \n ```bash\n-SKIP=pyupgrade git commit -m \"<descriptive message>\"\n+SKIP=ruff git commit -m \"<descriptive message>\"\n ```\n \n You can manually run all `pre-commit` hooks on all files with\ndiff --git a/pymc/_version.py b/pymc/_version.py\nindex 24c8e98be..ebbf5a3a2 100644\n--- a/pymc/_version.py\n+++ b/pymc/_version.py\n@@ -153,10 +153,7 @@ def versions_from_parentdir(parentdir_prefix, root, verbose):\n root = os.path.dirname(root) # up a level\n \n if verbose:\n- print(\n- \"Tried directories %s but none started with prefix %s\"\n- % (str(rootdirs), parentdir_prefix)\n- )\n+ print(f\"Tried directories {str(rootdirs)} but none started with prefix {parentdir_prefix}\")\n raise NotThisMethod(\"rootdir doesn't start with parentdir_prefix\")\n \n \ndiff --git a/pymc/gp/util.py b/pymc/gp/util.py\nindex 39eb3b678..3f829ab00 100644\n--- a/pymc/gp/util.py\n+++ b/pymc/gp/util.py\n@@ -120,7 +120,7 @@ def kmeans_inducing_points(n_inducing, X, **kmeans_kwargs):\n \"To use K-means initialization, \"\n \"please provide X as a type that \"\n \"can be cast to np.ndarray, instead \"\n- \"of {}\".format(type(X))\n+ f\"of {type(X)}\"\n )\n scaling = np.std(X, 0)\n # if std of a column is very small (zero), don't normalize that column\ndiff --git a/pymc/sampling/population.py b/pymc/sampling/population.py\nindex 6dbe5cf90..5ed98c0a2 100644\n--- a/pymc/sampling/population.py\n+++ b/pymc/sampling/population.py\n@@ -135,7 +135,7 @@ def warn_population_size(\n if has_demcmc and chains <= initial_point_model_size:\n warnings.warn(\n \"DEMetropolis should be used with more chains than dimensions! \"\n- \"(The model has {} dimensions.)\".format(initial_point_model_size),\n+ f\"(The model has {initial_point_model_size} dimensions.)\",\n UserWarning,\n stacklevel=2,\n )\ndiff --git a/pymc/step_methods/arraystep.py b/pymc/step_methods/arraystep.py\nindex 4c945ab51..35f1443d8 100644\n--- a/pymc/step_methods/arraystep.py\n+++ b/pymc/step_methods/arraystep.py\n@@ -146,10 +146,8 @@ class PopulationArrayStepShared(ArrayStepShared):\n self.other_chains = [c for c in range(len(population)) if c != chain_index]\n if not len(self.other_chains) > 1:\n raise ValueError(\n- \"Population is just {} + {}. \"\n- \"This is too small and the error should have been raised earlier.\".format(\n- self.this_chain, self.other_chains\n- )\n+ f\"Population is just {self.this_chain} + {self.other_chains}. \"\n+ \"This is too small and the error should have been raised earlier.\"\n )\n return\n \ndiff --git a/pymc/step_methods/hmc/integration.py b/pymc/step_methods/hmc/integration.py\nindex 8ca72ecc4..c8defa2e8 100644\n--- a/pymc/step_methods/hmc/integration.py\n+++ b/pymc/step_methods/hmc/integration.py\n@@ -44,8 +44,8 @@ class CpuLeapfrogIntegrator:\n self._dtype = self._logp_dlogp_func.dtype\n if self._potential.dtype != self._dtype:\n raise ValueError(\n- \"dtypes of potential (%s) and logp function (%s)\"\n- \"don't match.\" % (self._potential.dtype, self._dtype)\n+ f\"dtypes of potential ({self._potential.dtype}) and logp function ({self._dtype})\"\n+ \"don't match.\"\n )\n \n def compute_state(self, q: RaveledVars, p: RaveledVars):\ndiff --git a/pymc/variational/inference.py b/pymc/variational/inference.py\nindex ce3bd02e2..6ee5815d1 100644\n--- a/pymc/variational/inference.py\n+++ b/pymc/variational/inference.py\n@@ -244,17 +244,11 @@ class Inference:\n if isinstance(e, StopIteration):\n logger.info(str(e))\n if n < 10:\n- logger.info(\n- \"Interrupted at {:,d} [{:.0f}%]: Loss = {:,.5g}\".format(\n- i, 100 * i // n, scores[i]\n- )\n- )\n+ logger.info(f\"Interrupted at {i:,d} [{100 * i // n:.0f}%]: Loss = {scores[i]:,.5g}\")\n else:\n avg_loss = _infmean(scores[min(0, i - 1000) : i + 1])\n logger.info(\n- \"Interrupted at {:,d} [{:.0f}%]: Average Loss = {:,.5g}\".format(\n- i, 100 * i // n, avg_loss\n- )\n+ f\"Interrupted at {i:,d} [{100 * i // n:.0f}%]: Average Loss = {avg_loss:,.5g}\"\n )\n else:\n if n == 0:\ndiff --git a/pymc/variational/opvi.py b/pymc/variational/opvi.py\nindex bd1874ffe..ae2e20ac8 100644\n--- a/pymc/variational/opvi.py\n+++ b/pymc/variational/opvi.py\n@@ -458,8 +458,8 @@ class Operator:\n self.approx = approx\n if self.require_logq and not approx.has_logq:\n raise ExplicitInferenceError(\n- \"%s requires logq, but %s does not implement it\"\n- \"please change inference method\" % (self, approx)\n+ f\"{self} requires logq, but {approx} does not implement it\"\n+ \"please change inference method\"\n )\n \n inputs = property(lambda self: self.approx.inputs)\n@@ -510,9 +510,7 @@ class Operator:\n return self.objective_class(self, f)\n \n def __str__(self): # pragma: no cover\n- return \"%(op)s[%(ap)s]\" % dict(\n- op=self.__class__.__name__, ap=self.approx.__class__.__name__\n- )\n+ return f\"{self.__class__.__name__}[{self.approx.__class__.__name__}]\"\n \n \n def collect_shared_to_list(params):\n@@ -701,8 +699,8 @@ class Group(WithMemoization):\n def group_for_params(cls, params):\n if frozenset(params) not in cls.__param_registry:\n raise KeyError(\n- \"No such group for the following params: {!r}, \"\n- \"only the following are supported\\n\\n{}\".format(params, cls.__param_registry)\n+ f\"No such group for the following params: {params!r}, \"\n+ f\"only the following are supported\\n\\n{cls.__param_registry}\"\n )\n return cls.__param_registry[frozenset(params)]\n \n@@ -801,9 +799,7 @@ class Group(WithMemoization):\n if givens != needed:\n raise ParametrizationError(\n \"Passed parameters do not have a needed set of keys, \"\n- \"they should be equal, got {givens}, needed {needed}\".format(\n- givens=givens, needed=needed\n- )\n+ f\"they should be equal, got {givens}, needed {needed}\"\n )\n self._user_params = dict()\n spec = self.get_param_spec_for(d=self.ddim, **kwargs.pop(\"spec_kw\", {}))\ndiff --git a/pymc/variational/updates.py b/pymc/variational/updates.py\nindex fa6e52b0e..4f46970d1 100644\n--- a/pymc/variational/updates.py\n+++ b/pymc/variational/updates.py\n@@ -1005,9 +1005,7 @@ def norm_constraint(tensor_var, max_norm, norm_axes=None, epsilon=1e-7):\n elif ndim in [3, 4, 5]: # Conv{1,2,3}DLayer\n sum_over = tuple(range(1, ndim))\n else:\n- raise ValueError(\n- \"Unsupported tensor dimensionality {}.\" \"Must specify `norm_axes`\".format(ndim)\n- )\n+ raise ValueError(f\"Unsupported tensor dimensionality {ndim}.\" \"Must specify `norm_axes`\")\n \n dtype = np.dtype(pytensor.config.floatX).type\n norms = pt.sqrt(pt.sum(pt.sqr(tensor_var), axis=sum_over, keepdims=True))\ndiff --git a/versioneer.py b/versioneer.py\nindex cf8adcc9e..9c8f7b060 100644\n--- a/versioneer.py\n+++ b/versioneer.py\n@@ -325,8 +325,7 @@ def get_root():\n vsr_dir = os.path.normcase(os.path.splitext(versioneer_py)[0])\n if me_dir != vsr_dir:\n print(\n- \"Warning: build in %s is using versioneer.py from %s\"\n- % (os.path.dirname(my_path), versioneer_py)\n+ f\"Warning: build in {os.path.dirname(my_path)} is using versioneer.py from {versioneer_py}\"\n )\n except NameError:\n pass\n@@ -1384,10 +1383,7 @@ def versions_from_parentdir(parentdir_prefix, root, verbose):\n root = os.path.dirname(root) # up a level\n \n if verbose:\n- print(\n- \"Tried directories %s but none started with prefix %s\"\n- % (str(rootdirs), parentdir_prefix)\n- )\n+ print(f\"Tried directories {str(rootdirs)} but none started with prefix {parentdir_prefix}\")\n raise NotThisMethod(\"rootdir doesn't start with parentdir_prefix\")\n \n \n", "difficulty": 3, "changed_files": ["docs/source/contributing/python_style.md", "pymc/_version.py", "pymc/gp/util.py", "pymc/sampling/population.py", "pymc/step_methods/arraystep.py", "pymc/step_methods/hmc/integration.py", "pymc/variational/inference.py", "pymc/variational/opvi.py", "pymc/variational/updates.py", "versioneer.py"], "commit_link": "https://github.com/pymc-devs/pymc/tree/92937f3e3c898a7c90b04b04341d4f1b75e275cf"} |