Skip to content

Commit

Permalink
update pre-commit (#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli authored Mar 3, 2024
1 parent 83d43db commit 6bdff1d
Show file tree
Hide file tree
Showing 29 changed files with 46 additions and 18 deletions.
24 changes: 11 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
default_language_version:
# force all unspecified python hooks to run python3
python: python3.8
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand All @@ -11,32 +8,33 @@ repos:
- id: trailing-whitespace
- id: debug-statements
- repo: https://github.com/pre-commit/pre-commit
rev: v3.5.0
rev: v3.6.2
hooks:
- id: validate_manifest
- repo: https://github.com/hauntsaninja/black-pre-commit-mirror
# black compiled with mypyc
rev: 23.11.0
rev: 24.2.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
rev: v4.0.0-alpha.8
hooks:
- id: prettier
exclude: ^README\.md$
- repo: https://github.com/PyCQA/pylint
rev: v3.0.1
rev: v3.1.0
hooks:
- id: pylint
files: ^(nbqa|tests)/
exclude: ^tests/data/
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies: [flake8-typing-imports==1.14.0]
exclude: tests/data
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/PyCQA/pydocstyle
Expand All @@ -51,13 +49,13 @@ repos:
args: [-v, --fail-under=100]
files: ^nbqa/
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
rev: v1.8.0
hooks:
- id: mypy
exclude: ^docs/
additional_dependencies: [types-setuptools, types-toml]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
rev: v3.15.1
hooks:
- id: pyupgrade
args: [--py38-plus]
Expand Down Expand Up @@ -85,7 +83,7 @@ repos:
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
rev: v2.3.0
hooks:
- id: autoflake
args: [--remove-all-unused-imports, -i]
Expand All @@ -94,7 +92,7 @@ repos:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
rev: 0.7.1
hooks:
- id: nbstripout
exclude: ^tests/data/(databricks_notebook|notebook_for_testing)\.ipynb$
1 change: 1 addition & 0 deletions docs/clean_build_artifacts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Cross platform way to call 'rm -rf docs/_build/ docs/api/' """

from pathlib import Path
from shutil import rmtree

Expand Down
1 change: 1 addition & 0 deletions nbqa/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Run third-party tool (e.g. :code:`mypy`) against notebook or directory."""

from __future__ import annotations

import itertools
Expand Down
1 change: 1 addition & 0 deletions nbqa/cmdline.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Parses the command line arguments provided."""

import argparse
import sys
from textwrap import dedent
Expand Down
1 change: 1 addition & 0 deletions nbqa/handle_magics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Detect ipython magics and provide python code replacements for those magics."""

import ast
import secrets
from collections import defaultdict
Expand Down
1 change: 1 addition & 0 deletions nbqa/output_parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Parse output from code quality tools."""

import re
from functools import partial
from typing import Callable, Mapping, Match, NamedTuple, Sequence, Tuple, Union
Expand Down
1 change: 1 addition & 0 deletions nbqa/path_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions to deal with paths."""

import json
import os
import string
Expand Down
1 change: 1 addition & 0 deletions nbqa/replace_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
The converted file will have had the third-party tool run against it by now.
"""

from __future__ import annotations

import copy
Expand Down
1 change: 1 addition & 0 deletions nbqa/save_code_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Markdown cells, output, and metadata are ignored.
"""

from __future__ import annotations

import ast
Expand Down
11 changes: 10 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@

import shutil
import sys
from distutils.dir_util import copy_tree # pylint: disable=E0611
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 typing import TYPE_CHECKING, Iterator

Expand Down
3 changes: 1 addition & 2 deletions tests/data/t.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
class A:
...
class A: ...
1 change: 1 addition & 0 deletions tests/local_script.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Local module with subcommand."""

import argparse
import sys
from typing import Optional, Sequence
Expand Down
1 change: 0 additions & 1 deletion tests/remove_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
This is just so we can check what happens when running nbqa on a tool which causes a failure.
"""


import argparse
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions tests/test_deprecated.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test deprecations."""

import os
from typing import TYPE_CHECKING

Expand Down
1 change: 0 additions & 1 deletion tests/test_file_not_found.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Check what happens when running on non-existent file/directory."""


from typing import TYPE_CHECKING

from nbqa.__main__ import main
Expand Down
1 change: 1 addition & 0 deletions tests/test_find_root.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Check project root is round correctly."""

from pathlib import Path
from typing import Sequence

Expand Down
1 change: 1 addition & 0 deletions tests/test_hash_collision.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Check what happens if cell separator appears in notebook."""

import os

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/test_ipython_magics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Check user can check for other magics."""

import difflib
import os
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/test_jupytext.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test files saved via jupytext."""

import os
import warnings
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/test_local_script.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tets running local script."""

import os
from typing import TYPE_CHECKING

Expand Down
1 change: 1 addition & 0 deletions tests/test_nbqa_shell.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Ensure the --nbqa-shell flag correctly calls the underlying command."""

import os
import sys
from shutil import which
Expand Down
1 change: 1 addition & 0 deletions tests/test_non_python_notebook.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test non-Python notebook."""

import os
from typing import TYPE_CHECKING

Expand Down
1 change: 1 addition & 0 deletions tests/test_running_from_different_dir.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Check configs are picked up when running in different directory."""

import os
from pathlib import Path
from textwrap import dedent
Expand Down
1 change: 1 addition & 0 deletions tests/test_skip_bad_cells.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the skip bad cells flag."""

import os
from typing import TYPE_CHECKING

Expand Down
1 change: 1 addition & 0 deletions tests/test_skip_celltags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the skip_celltags option."""

import os
from typing import TYPE_CHECKING

Expand Down
1 change: 1 addition & 0 deletions tests/test_transformed_magics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the skip_celltags option."""

import os
from typing import TYPE_CHECKING

Expand Down
1 change: 1 addition & 0 deletions tests/tools/test_autoflake.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Check configs from :code:`pyproject.toml` are picked up."""

import difflib
from pathlib import Path
from textwrap import dedent
Expand Down
1 change: 1 addition & 0 deletions tests/tools/test_blacken_docs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Check blacken-docs runs."""

import os
from typing import TYPE_CHECKING

Expand Down
1 change: 1 addition & 0 deletions tests/tools/test_isort_works.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Check :code:`isort` works as intended."""

import difflib
import json
import os
Expand Down

0 comments on commit 6bdff1d

Please sign in to comment.