diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 77acd8311..7a006c2fa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,23 +9,9 @@ on: jobs: lint: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.9'] - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install -U pip setuptools wheel - pip install -r ./requirements.txt - - - name: Run pre-commit - run: pre-commit install && pre-commit run --all-files + uses: less-action/reusables/.github/workflows/pre-commit.yaml@459cad5ac9877a76911718423b348249a20ce75d + with: + python-version: '3.9' test: runs-on: ubuntu-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d1ab93c84..425a2a485 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,28 +11,29 @@ repos: - id: check-merge-conflict - id: end-of-file-fixer - repo: https://github.com/asottile/pyupgrade - rev: v2.29.1 + rev: v2.31.0 hooks: - id: pyupgrade args: ["--py36-plus"] - repo: https://github.com/pre-commit/mirrors-isort - rev: v5.9.3 + rev: v5.10.1 hooks: - id: isort - repo: https://github.com/psf/black - rev: 21.12b0 + rev: 22.1.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 rev: 3.9.2 hooks: - id: flake8 - - repo: local + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.931 hooks: - id: mypy - name: mypy - entry: mypy - language: system - types: [ python ] - exclude: "scripts/*" args: [ "--cache-dir=/dev/null", "--no-incremental" ] + exclude: "scripts/" + types: [python] + additional_dependencies: + - djangorestframework + - django-stubs diff --git a/rest_framework-stubs/compat.pyi b/rest_framework-stubs/compat.pyi index 4e151eec2..a036ee1b3 100644 --- a/rest_framework-stubs/compat.pyi +++ b/rest_framework-stubs/compat.pyi @@ -38,6 +38,7 @@ except ImportError: if markdown is not None and pygments is not None: from markdown.preprocessors import Preprocessor + class CodeBlockPreprocessor(Preprocessor): pattern: Any = ... formatter: Any = ... diff --git a/rest_framework-stubs/serializers.pyi b/rest_framework-stubs/serializers.pyi index 2f6d8c7c2..e4a1f3454 100644 --- a/rest_framework-stubs/serializers.pyi +++ b/rest_framework-stubs/serializers.pyi @@ -219,6 +219,7 @@ class ModelSerializer(Serializer, BaseSerializer[_MT]): serializer_choice_field: Type[Field] = ... url_field_name: Optional[str] = ... instance: Optional[Union[_MT, Sequence[_MT]]] # type: ignore[override] + class Meta: model: Type[_MT] # type: ignore fields: Union[Sequence[str], Literal["__all__"]]