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

[pre-commit.ci] pre-commit autoupdate #869

Merged
merged 10 commits into from
Nov 10, 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
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.8 # Same as RTD
python-version: 3.12 # Same as RTD
- name: Cache multiple paths
uses: actions/cache@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
tox:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.12", "3.13"]
os: [ubuntu-latest, windows-latest]

runs-on: ${{ matrix.os }}
Expand Down
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: end-of-file-fixer
exclude: ^tests/data/
- id: requirements-txt-fixer
- id: trailing-whitespace
- id: debug-statements
- repo: https://github.com/pre-commit/pre-commit
rev: v3.8.0
rev: v4.0.1
hooks:
- id: validate_manifest
- repo: https://github.com/hauntsaninja/black-pre-commit-mirror
# black compiled with mypyc
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/PyCQA/pylint
rev: v3.2.7
rev: v3.3.1
hooks:
- id: pylint
files: ^(nbqa|tests)/
Expand All @@ -38,13 +38,13 @@ repos:
- id: pydocstyle
files: ^nbqa/
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.13.0
hooks:
- id: mypy
exclude: ^docs/
additional_dependencies: [types-setuptools, types-toml]
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
rev: v3.19.0
hooks:
- id: pyupgrade
args: [--py38-plus]
Expand All @@ -68,7 +68,7 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
rev: v2.7.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/PyCQA/autoflake
Expand All @@ -81,7 +81,7 @@ repos:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
rev: 0.8.0
hooks:
- id: nbstripout
exclude: ^tests/data/(databricks_notebook|notebook_for_testing)\.ipynb$
2 changes: 1 addition & 1 deletion nbqa/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def _save_markdown_sources(
SAVE_SOURCES = {False: _save_code_sources, True: _save_markdown_sources}


def _post_process_notebooks( # pylint: disable=R0913
def _post_process_notebooks( # pylint: disable=R0913,R0917
saved_sources: SavedSources,
nb_to_py_mapping: Mapping[str, TemporaryFile],
mutated: bool,
Expand Down
8 changes: 4 additions & 4 deletions nbqa/handle_magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def _get_node_args(func: ast.Call) -> List[str]:
"""
args = []
for arg in func.args:
if isinstance(arg, ast.Str):
args.append(arg.s)
if isinstance(arg, ast.Constant):
args.append(arg.value)
else:
raise AssertionError(
"Please report a bug at https://github.com/nbQA-dev/nbQA/issues"
Expand Down Expand Up @@ -158,8 +158,8 @@ def visit_Call(self, node: ast.Call) -> None:
if node.func.attr == "run_cell_magic":
args = []
for arg in node.args:
if isinstance(arg, ast.Str):
args.append(arg.s)
if isinstance(arg, ast.Constant):
args.append(arg.value)
else:
raise AssertionError(
"Please report a bug at https://github.com/nbQA-dev/nbQA/issues"
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ install_requires =
ipython>=7.8.0
tokenize-rt>=3.2.0
tomli
python_requires = >=3.8.0
python_requires = >=3.9

[options.packages.find]
exclude =
Expand Down
15 changes: 3 additions & 12 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,8 @@

import shutil
import sys
import warnings

# distutils is deprecated, but this is just a test, so not urgent to update
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message=r"The distutils package",
category=DeprecationWarning,
)
from distutils.dir_util import copy_tree # pylint: disable=E0611,W4901
from pathlib import Path
from shutil import copytree # pylint: disable=E0611,W4901
from typing import TYPE_CHECKING, Iterator

import pytest
Expand Down Expand Up @@ -140,9 +131,9 @@ def tmp_test_data(tmpdir: "LocalPath") -> Iterator[Path]:
"""
dirname = Path("tests/data")
temp_dir = Path(tmpdir)
copy_tree(str(dirname), str(temp_dir / dirname))
copytree(str(dirname), str(temp_dir / dirname))
yield dirname
copy_tree(str(temp_dir / dirname), str(dirname))
copytree(str(temp_dir / dirname), str(dirname), dirs_exist_ok=True)


@pytest.fixture
Expand Down
4 changes: 4 additions & 0 deletions tests/tools/test_doctest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Check that running :code:`doctest` works."""

import os
import sys
from typing import TYPE_CHECKING

from nbqa.__main__ import main
Expand Down Expand Up @@ -51,6 +52,9 @@ def test_doctest_works(capsys: "CaptureFixture") -> None:
" 1 of 2 in notebook_for_testing_copy.hello\n"
"***Test Failed*** 1 failures.\n"
)
if sys.version_info >= (3, 13):
expected_out = expected_out.replace("1 failures", "1 failure")
expected_out = expected_out.replace("1 items", "1 item")

try:
assert out.replace("\r\n", "\n") == expected_out
Expand Down
2 changes: 1 addition & 1 deletion tests/tools/test_pylint_works.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ def test_pylint_works(capsys: "CaptureFixture") -> None:
horizontal_bar = "-----------------------------------"
assert (
out.replace("\r\n", "\n").split(horizontal_bar)[0]
== expected_out.split(horizontal_bar)[0]
== expected_out.split(horizontal_bar, maxsplit=1)[0]
)
Loading