diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d6975b1b..4376766e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,21 +1,21 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v3.8.0 + rev: v3.10.1 hooks: - id: pyupgrade args: [--py37-plus] - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 23.7.0 hooks: - id: black language_version: python3 - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 + rev: 6.1.0 hooks: - id: flake8 additional_dependencies: [flake8-bugbear==22.12.6] - repo: https://github.com/asottile/blacken-docs - rev: 1.14.0 + rev: 1.15.0 hooks: - id: blacken-docs additional_dependencies: [black==22.3.0] diff --git a/src/apispec/ext/marshmallow/field_converter.py b/src/apispec/ext/marshmallow/field_converter.py index d075aca6..2bf8a9de 100644 --- a/src/apispec/ext/marshmallow/field_converter.py +++ b/src/apispec/ext/marshmallow/field_converter.py @@ -6,6 +6,7 @@ This module is treated as private API. Users should not need to use this module directly. """ +from __future__ import annotations import re import functools import operator @@ -18,7 +19,7 @@ # marshmallow field => (JSON Schema type, format) -DEFAULT_FIELD_MAPPING = { +DEFAULT_FIELD_MAPPING: dict[type, tuple[str | None, str | None]] = { marshmallow.fields.Integer: ("integer", None), marshmallow.fields.Number: ("number", None), marshmallow.fields.Float: ("number", None), @@ -86,7 +87,7 @@ class FieldConverterMixin: """Adds methods for converting marshmallow fields to an OpenAPI properties.""" - field_mapping = DEFAULT_FIELD_MAPPING + field_mapping: dict[type, tuple[str | None, str | None]] = DEFAULT_FIELD_MAPPING openapi_version: Version def init_attribute_functions(self):