diff --git a/openapi_core/__init__.py b/openapi_core/__init__.py index c3a58c25..45b529d3 100644 --- a/openapi_core/__init__.py +++ b/openapi_core/__init__.py @@ -1,4 +1,5 @@ """OpenAPI core module""" + from openapi_core.app import OpenAPI from openapi_core.configurations import Config from openapi_core.shortcuts import unmarshal_apicall_request diff --git a/openapi_core/app.py b/openapi_core/app.py index db80564c..5a2c5588 100644 --- a/openapi_core/app.py +++ b/openapi_core/app.py @@ -1,4 +1,5 @@ """OpenAPI core app module""" + from pathlib import Path from typing import Optional diff --git a/openapi_core/contrib/aiohttp/requests.py b/openapi_core/contrib/aiohttp/requests.py index 73ad0f76..eac7965e 100644 --- a/openapi_core/contrib/aiohttp/requests.py +++ b/openapi_core/contrib/aiohttp/requests.py @@ -1,4 +1,5 @@ """OpenAPI core contrib aiohttp requests module""" + from __future__ import annotations from aiohttp import web @@ -6,8 +7,7 @@ from openapi_core.datatypes import RequestParameters -class Empty: - ... +class Empty: ... _empty = Empty() diff --git a/openapi_core/contrib/django/__init__.py b/openapi_core/contrib/django/__init__.py index bffcc03a..ff65549b 100644 --- a/openapi_core/contrib/django/__init__.py +++ b/openapi_core/contrib/django/__init__.py @@ -1,4 +1,5 @@ """OpenAPI core contrib django module""" + from openapi_core.contrib.django.requests import DjangoOpenAPIRequest from openapi_core.contrib.django.responses import DjangoOpenAPIResponse diff --git a/openapi_core/contrib/django/handlers.py b/openapi_core/contrib/django/handlers.py index 4a0df1a3..a3618ab8 100644 --- a/openapi_core/contrib/django/handlers.py +++ b/openapi_core/contrib/django/handlers.py @@ -1,4 +1,5 @@ """OpenAPI core contrib django handlers module""" + from typing import Any from typing import Callable from typing import Dict diff --git a/openapi_core/contrib/django/middlewares.py b/openapi_core/contrib/django/middlewares.py index bfdb5474..35b865bd 100644 --- a/openapi_core/contrib/django/middlewares.py +++ b/openapi_core/contrib/django/middlewares.py @@ -1,4 +1,5 @@ """OpenAPI core contrib django middlewares module""" + import warnings from typing import Callable diff --git a/openapi_core/contrib/django/requests.py b/openapi_core/contrib/django/requests.py index 8b4f1987..10fb821d 100644 --- a/openapi_core/contrib/django/requests.py +++ b/openapi_core/contrib/django/requests.py @@ -1,4 +1,5 @@ """OpenAPI core contrib django requests module""" + import re from typing import Optional diff --git a/openapi_core/contrib/django/responses.py b/openapi_core/contrib/django/responses.py index 19a58943..a1e245a4 100644 --- a/openapi_core/contrib/django/responses.py +++ b/openapi_core/contrib/django/responses.py @@ -1,4 +1,5 @@ """OpenAPI core contrib django responses module""" + from itertools import tee from django.http.response import HttpResponse diff --git a/openapi_core/contrib/falcon/handlers.py b/openapi_core/contrib/falcon/handlers.py index ccbbe657..d390d46a 100644 --- a/openapi_core/contrib/falcon/handlers.py +++ b/openapi_core/contrib/falcon/handlers.py @@ -1,4 +1,5 @@ """OpenAPI core contrib falcon handlers module""" + from json import dumps from typing import Any from typing import Dict diff --git a/openapi_core/contrib/falcon/middlewares.py b/openapi_core/contrib/falcon/middlewares.py index ae3173ef..13e4c5e8 100644 --- a/openapi_core/contrib/falcon/middlewares.py +++ b/openapi_core/contrib/falcon/middlewares.py @@ -1,4 +1,5 @@ """OpenAPI core contrib falcon middlewares module""" + from typing import Any from typing import Type from typing import Union @@ -24,9 +25,9 @@ class FalconOpenAPIMiddleware(FalconIntegration): valid_request_handler_cls = FalconOpenAPIValidRequestHandler - errors_handler_cls: Type[ + errors_handler_cls: Type[FalconOpenAPIErrorsHandler] = ( FalconOpenAPIErrorsHandler - ] = FalconOpenAPIErrorsHandler + ) def __init__( self, diff --git a/openapi_core/contrib/falcon/requests.py b/openapi_core/contrib/falcon/requests.py index af08b7b7..6ef5033e 100644 --- a/openapi_core/contrib/falcon/requests.py +++ b/openapi_core/contrib/falcon/requests.py @@ -1,4 +1,5 @@ """OpenAPI core contrib falcon responses module""" + import warnings from json import dumps from typing import Any diff --git a/openapi_core/contrib/falcon/responses.py b/openapi_core/contrib/falcon/responses.py index 1eddb7c2..2a3e7470 100644 --- a/openapi_core/contrib/falcon/responses.py +++ b/openapi_core/contrib/falcon/responses.py @@ -1,4 +1,5 @@ """OpenAPI core contrib falcon responses module""" + from itertools import tee from falcon.response import Response diff --git a/openapi_core/contrib/flask/decorators.py b/openapi_core/contrib/flask/decorators.py index 4d573596..4dc949e9 100644 --- a/openapi_core/contrib/flask/decorators.py +++ b/openapi_core/contrib/flask/decorators.py @@ -1,4 +1,5 @@ """OpenAPI core contrib flask decorators module""" + from functools import wraps from typing import Any from typing import Callable @@ -20,9 +21,9 @@ class FlaskOpenAPIViewDecorator(FlaskIntegration): valid_request_handler_cls = FlaskOpenAPIValidRequestHandler - errors_handler_cls: Type[ + errors_handler_cls: Type[FlaskOpenAPIErrorsHandler] = ( FlaskOpenAPIErrorsHandler - ] = FlaskOpenAPIErrorsHandler + ) def __init__( self, diff --git a/openapi_core/contrib/flask/handlers.py b/openapi_core/contrib/flask/handlers.py index e1a20fc4..3a207112 100644 --- a/openapi_core/contrib/flask/handlers.py +++ b/openapi_core/contrib/flask/handlers.py @@ -1,4 +1,5 @@ """OpenAPI core contrib flask handlers module""" + from typing import Any from typing import Callable from typing import Dict diff --git a/openapi_core/contrib/flask/providers.py b/openapi_core/contrib/flask/providers.py index 47729d25..48f39825 100644 --- a/openapi_core/contrib/flask/providers.py +++ b/openapi_core/contrib/flask/providers.py @@ -1,4 +1,5 @@ """OpenAPI core contrib flask providers module""" + from typing import Any from flask.globals import request diff --git a/openapi_core/contrib/flask/requests.py b/openapi_core/contrib/flask/requests.py index dfc21bdd..9a9d5e5c 100644 --- a/openapi_core/contrib/flask/requests.py +++ b/openapi_core/contrib/flask/requests.py @@ -1,4 +1,5 @@ """OpenAPI core contrib flask requests module""" + from flask.wrappers import Request from werkzeug.datastructures import Headers from werkzeug.datastructures import ImmutableMultiDict diff --git a/openapi_core/contrib/flask/views.py b/openapi_core/contrib/flask/views.py index 0f72a018..5b1d0da2 100644 --- a/openapi_core/contrib/flask/views.py +++ b/openapi_core/contrib/flask/views.py @@ -1,4 +1,5 @@ """OpenAPI core contrib flask views module""" + from typing import Any from flask.views import MethodView diff --git a/openapi_core/contrib/requests/requests.py b/openapi_core/contrib/requests/requests.py index 2e33f02d..2a686fcc 100644 --- a/openapi_core/contrib/requests/requests.py +++ b/openapi_core/contrib/requests/requests.py @@ -1,4 +1,5 @@ """OpenAPI core contrib requests requests module""" + from typing import Optional from typing import Union from urllib.parse import parse_qs diff --git a/openapi_core/contrib/requests/responses.py b/openapi_core/contrib/requests/responses.py index b0dacc78..4570ba79 100644 --- a/openapi_core/contrib/requests/responses.py +++ b/openapi_core/contrib/requests/responses.py @@ -1,4 +1,5 @@ """OpenAPI core contrib requests responses module""" + from requests import Response from werkzeug.datastructures import Headers diff --git a/openapi_core/contrib/starlette/handlers.py b/openapi_core/contrib/starlette/handlers.py index 47e68739..daed2c42 100644 --- a/openapi_core/contrib/starlette/handlers.py +++ b/openapi_core/contrib/starlette/handlers.py @@ -1,4 +1,5 @@ """OpenAPI core contrib starlette handlers module""" + from typing import Any from typing import Dict from typing import Iterable diff --git a/openapi_core/contrib/starlette/integrations.py b/openapi_core/contrib/starlette/integrations.py index 340ff870..02bfc5f1 100644 --- a/openapi_core/contrib/starlette/integrations.py +++ b/openapi_core/contrib/starlette/integrations.py @@ -29,9 +29,11 @@ async def get_openapi_response( response.body_iterator = body_iter2 data = b"".join( [ - chunk.encode(response.charset) - if not isinstance(chunk, bytes) - else chunk + ( + chunk.encode(response.charset) + if not isinstance(chunk, bytes) + else chunk + ) async for chunk in body_iter1 ] ) diff --git a/openapi_core/contrib/starlette/middlewares.py b/openapi_core/contrib/starlette/middlewares.py index d1d80304..2b0b9368 100644 --- a/openapi_core/contrib/starlette/middlewares.py +++ b/openapi_core/contrib/starlette/middlewares.py @@ -1,4 +1,5 @@ """OpenAPI core contrib starlette middlewares module""" + from starlette.middleware.base import BaseHTTPMiddleware from starlette.middleware.base import RequestResponseEndpoint from starlette.requests import Request diff --git a/openapi_core/contrib/starlette/requests.py b/openapi_core/contrib/starlette/requests.py index fdbf486f..2e3494ba 100644 --- a/openapi_core/contrib/starlette/requests.py +++ b/openapi_core/contrib/starlette/requests.py @@ -1,4 +1,5 @@ """OpenAPI core contrib starlette requests module""" + from typing import Optional from starlette.requests import Request diff --git a/openapi_core/contrib/starlette/responses.py b/openapi_core/contrib/starlette/responses.py index 3070b6ec..9944663d 100644 --- a/openapi_core/contrib/starlette/responses.py +++ b/openapi_core/contrib/starlette/responses.py @@ -1,4 +1,5 @@ """OpenAPI core contrib starlette responses module""" + from typing import Optional from starlette.datastructures import Headers diff --git a/openapi_core/contrib/werkzeug/requests.py b/openapi_core/contrib/werkzeug/requests.py index cd23c67d..4b979c13 100644 --- a/openapi_core/contrib/werkzeug/requests.py +++ b/openapi_core/contrib/werkzeug/requests.py @@ -1,4 +1,5 @@ """OpenAPI core contrib werkzeug requests module""" + import re from typing import Optional diff --git a/openapi_core/contrib/werkzeug/responses.py b/openapi_core/contrib/werkzeug/responses.py index e3d229f9..b8afeea4 100644 --- a/openapi_core/contrib/werkzeug/responses.py +++ b/openapi_core/contrib/werkzeug/responses.py @@ -1,4 +1,5 @@ """OpenAPI core contrib werkzeug responses module""" + from itertools import tee from werkzeug.datastructures import Headers diff --git a/openapi_core/datatypes.py b/openapi_core/datatypes.py index d3ed7500..38746aff 100644 --- a/openapi_core/datatypes.py +++ b/openapi_core/datatypes.py @@ -1,4 +1,5 @@ """OpenAPI core validation request datatypes module""" + from __future__ import annotations from dataclasses import dataclass diff --git a/openapi_core/extensions/models/factories.py b/openapi_core/extensions/models/factories.py index 158318a3..0f33b3cf 100644 --- a/openapi_core/extensions/models/factories.py +++ b/openapi_core/extensions/models/factories.py @@ -1,4 +1,5 @@ """OpenAPI X-Model extension factories module""" + from dataclasses import make_dataclass from pydoc import locate from typing import Any diff --git a/openapi_core/protocols.py b/openapi_core/protocols.py index 82bf1532..ba4a27c5 100644 --- a/openapi_core/protocols.py +++ b/openapi_core/protocols.py @@ -1,4 +1,5 @@ """OpenAPI core protocols module""" + from typing import Any from typing import Mapping from typing import Optional @@ -13,16 +14,13 @@ class BaseRequest(Protocol): parameters: RequestParameters @property - def method(self) -> str: - ... + def method(self) -> str: ... @property - def body(self) -> Optional[bytes]: - ... + def body(self) -> Optional[bytes]: ... @property - def content_type(self) -> str: - ... + def content_type(self) -> str: ... @runtime_checkable @@ -54,12 +52,10 @@ class Request(BaseRequest, Protocol): """ @property - def host_url(self) -> str: - ... + def host_url(self) -> str: ... @property - def path(self) -> str: - ... + def path(self) -> str: ... @runtime_checkable @@ -82,8 +78,7 @@ class WebhookRequest(BaseRequest, Protocol): """ @property - def name(self) -> str: - ... + def name(self) -> str: ... @runtime_checkable @@ -100,8 +95,7 @@ class SupportsPathPattern(Protocol): """ @property - def path_pattern(self) -> str: - ... + def path_pattern(self) -> str: ... @runtime_checkable @@ -120,17 +114,13 @@ class Response(Protocol): """ @property - def data(self) -> Optional[bytes]: - ... + def data(self) -> Optional[bytes]: ... @property - def status_code(self) -> int: - ... + def status_code(self) -> int: ... @property - def content_type(self) -> str: - ... + def content_type(self) -> str: ... @property - def headers(self) -> Mapping[str, Any]: - ... + def headers(self) -> Mapping[str, Any]: ... diff --git a/openapi_core/schema/protocols.py b/openapi_core/schema/protocols.py index 6880754e..72ee2e31 100644 --- a/openapi_core/schema/protocols.py +++ b/openapi_core/schema/protocols.py @@ -6,11 +6,9 @@ @runtime_checkable class SuportsGetAll(Protocol): - def getall(self, name: str) -> List[Any]: - ... + def getall(self, name: str) -> List[Any]: ... @runtime_checkable class SuportsGetList(Protocol): - def getlist(self, name: str) -> List[Any]: - ... + def getlist(self, name: str) -> List[Any]: ... diff --git a/openapi_core/shortcuts.py b/openapi_core/shortcuts.py index 35e3783b..be5c69f9 100644 --- a/openapi_core/shortcuts.py +++ b/openapi_core/shortcuts.py @@ -1,4 +1,5 @@ """OpenAPI core shortcuts module""" + from typing import Any from typing import Optional from typing import Union diff --git a/openapi_core/templating/media_types/finders.py b/openapi_core/templating/media_types/finders.py index ee7ae989..5c0cd4c3 100644 --- a/openapi_core/templating/media_types/finders.py +++ b/openapi_core/templating/media_types/finders.py @@ -1,4 +1,5 @@ """OpenAPI core templating media types finders module""" + import fnmatch from typing import Mapping from typing import Tuple diff --git a/openapi_core/templating/paths/datatypes.py b/openapi_core/templating/paths/datatypes.py index 56093afe..fd32702d 100644 --- a/openapi_core/templating/paths/datatypes.py +++ b/openapi_core/templating/paths/datatypes.py @@ -1,4 +1,5 @@ """OpenAPI core templating paths datatypes module""" + from collections import namedtuple Path = namedtuple("Path", ["path", "path_result"]) diff --git a/openapi_core/templating/paths/finders.py b/openapi_core/templating/paths/finders.py index e0173637..4c0c04d0 100644 --- a/openapi_core/templating/paths/finders.py +++ b/openapi_core/templating/paths/finders.py @@ -1,4 +1,5 @@ """OpenAPI core templating paths finders module""" + from typing import Iterator from typing import List from typing import Optional diff --git a/openapi_core/testing/__init__.py b/openapi_core/testing/__init__.py index d8334449..32a89814 100644 --- a/openapi_core/testing/__init__.py +++ b/openapi_core/testing/__init__.py @@ -1,4 +1,5 @@ """OpenAPI core testing module""" + from openapi_core.testing.requests import MockRequest from openapi_core.testing.responses import MockResponse diff --git a/openapi_core/testing/requests.py b/openapi_core/testing/requests.py index 8590f9ca..942e7ba0 100644 --- a/openapi_core/testing/requests.py +++ b/openapi_core/testing/requests.py @@ -1,4 +1,5 @@ """OpenAPI core testing requests module""" + from typing import Any from typing import Dict from typing import Optional diff --git a/openapi_core/testing/responses.py b/openapi_core/testing/responses.py index ddd068a4..f7cf41da 100644 --- a/openapi_core/testing/responses.py +++ b/openapi_core/testing/responses.py @@ -1,4 +1,5 @@ """OpenAPI core testing responses module""" + from typing import Any from typing import Dict from typing import Optional diff --git a/openapi_core/unmarshalling/datatypes.py b/openapi_core/unmarshalling/datatypes.py index 78036dda..8c009c5f 100644 --- a/openapi_core/unmarshalling/datatypes.py +++ b/openapi_core/unmarshalling/datatypes.py @@ -1,4 +1,5 @@ """OpenAPI core validation datatypes module""" + from dataclasses import dataclass from typing import Iterable diff --git a/openapi_core/unmarshalling/integrations.py b/openapi_core/unmarshalling/integrations.py index e850d57f..293ce7dd 100644 --- a/openapi_core/unmarshalling/integrations.py +++ b/openapi_core/unmarshalling/integrations.py @@ -1,4 +1,5 @@ """OpenAPI core unmarshalling processors module""" + from typing import Generic from openapi_core.app import OpenAPI diff --git a/openapi_core/unmarshalling/processors.py b/openapi_core/unmarshalling/processors.py index 0ac14574..12374089 100644 --- a/openapi_core/unmarshalling/processors.py +++ b/openapi_core/unmarshalling/processors.py @@ -1,4 +1,5 @@ """OpenAPI core unmarshalling processors module""" + from openapi_core.typing import RequestType from openapi_core.typing import ResponseType from openapi_core.unmarshalling.integrations import ( diff --git a/openapi_core/unmarshalling/request/__init__.py b/openapi_core/unmarshalling/request/__init__.py index fc2a08a4..1b41432e 100644 --- a/openapi_core/unmarshalling/request/__init__.py +++ b/openapi_core/unmarshalling/request/__init__.py @@ -1,4 +1,5 @@ """OpenAPI core unmarshalling request module""" + from typing import Mapping from openapi_spec_validator.versions import consts as versions diff --git a/openapi_core/unmarshalling/request/datatypes.py b/openapi_core/unmarshalling/request/datatypes.py index 739d2bf8..9e82ccab 100644 --- a/openapi_core/unmarshalling/request/datatypes.py +++ b/openapi_core/unmarshalling/request/datatypes.py @@ -1,4 +1,5 @@ """OpenAPI core unmarshalling request datatypes module""" + from __future__ import annotations from dataclasses import dataclass diff --git a/openapi_core/unmarshalling/request/protocols.py b/openapi_core/unmarshalling/request/protocols.py index 32d653ff..0c725191 100644 --- a/openapi_core/unmarshalling/request/protocols.py +++ b/openapi_core/unmarshalling/request/protocols.py @@ -1,4 +1,5 @@ """OpenAPI core validation request protocols module""" + from typing import Optional from typing import Protocol from typing import runtime_checkable @@ -57,14 +58,12 @@ def __init__( ] = None, format_unmarshallers: Optional[FormatUnmarshallersDict] = None, extra_format_unmarshallers: Optional[FormatUnmarshallersDict] = None, - ): - ... + ): ... def unmarshal( self, request: Request, - ) -> RequestUnmarshalResult: - ... + ) -> RequestUnmarshalResult: ... @runtime_checkable @@ -89,11 +88,9 @@ def __init__( ] = None, format_unmarshallers: Optional[FormatUnmarshallersDict] = None, extra_format_unmarshallers: Optional[FormatUnmarshallersDict] = None, - ): - ... + ): ... def unmarshal( self, request: WebhookRequest, - ) -> RequestUnmarshalResult: - ... + ) -> RequestUnmarshalResult: ... diff --git a/openapi_core/unmarshalling/response/__init__.py b/openapi_core/unmarshalling/response/__init__.py index 2c7094f1..e1ebf5d5 100644 --- a/openapi_core/unmarshalling/response/__init__.py +++ b/openapi_core/unmarshalling/response/__init__.py @@ -1,4 +1,5 @@ """OpenAPI core unmarshalling response module""" + from typing import Mapping from openapi_spec_validator.versions import consts as versions diff --git a/openapi_core/unmarshalling/response/datatypes.py b/openapi_core/unmarshalling/response/datatypes.py index 5a27d1fa..bb92d3db 100644 --- a/openapi_core/unmarshalling/response/datatypes.py +++ b/openapi_core/unmarshalling/response/datatypes.py @@ -1,4 +1,5 @@ """OpenAPI core unmarshalling response datatypes module""" + from dataclasses import dataclass from dataclasses import field from typing import Any diff --git a/openapi_core/unmarshalling/response/processors.py b/openapi_core/unmarshalling/response/processors.py index cb0d219e..9218a054 100644 --- a/openapi_core/unmarshalling/response/processors.py +++ b/openapi_core/unmarshalling/response/processors.py @@ -23,9 +23,9 @@ def __init__( self.response_unmarshaller_cls = response_unmarshaller_cls self.unmarshaller_kwargs = unmarshaller_kwargs - self._response_unmarshaller_cached: Optional[ - ResponseUnmarshaller - ] = None + self._response_unmarshaller_cached: Optional[ResponseUnmarshaller] = ( + None + ) @property def response_unmarshaller(self) -> ResponseUnmarshaller: diff --git a/openapi_core/unmarshalling/response/protocols.py b/openapi_core/unmarshalling/response/protocols.py index 00e9e5aa..edb6fde4 100644 --- a/openapi_core/unmarshalling/response/protocols.py +++ b/openapi_core/unmarshalling/response/protocols.py @@ -1,4 +1,5 @@ """OpenAPI core validation response protocols module""" + from typing import Optional from typing import Protocol from typing import runtime_checkable @@ -57,15 +58,13 @@ def __init__( ] = None, format_unmarshallers: Optional[FormatUnmarshallersDict] = None, extra_format_unmarshallers: Optional[FormatUnmarshallersDict] = None, - ): - ... + ): ... def unmarshal( self, request: Request, response: Response, - ) -> ResponseUnmarshalResult: - ... + ) -> ResponseUnmarshalResult: ... @runtime_checkable @@ -89,12 +88,10 @@ def __init__( ] = None, format_unmarshallers: Optional[FormatUnmarshallersDict] = None, extra_format_unmarshallers: Optional[FormatUnmarshallersDict] = None, - ): - ... + ): ... def unmarshal( self, request: WebhookRequest, response: Response, - ) -> ResponseUnmarshalResult: - ... + ) -> ResponseUnmarshalResult: ... diff --git a/openapi_core/unmarshalling/schemas/util.py b/openapi_core/unmarshalling/schemas/util.py index f0a3138b..6efc8e60 100644 --- a/openapi_core/unmarshalling/schemas/util.py +++ b/openapi_core/unmarshalling/schemas/util.py @@ -1,4 +1,5 @@ """OpenAPI core schemas util module""" + from base64 import b64decode from datetime import date from datetime import datetime diff --git a/openapi_core/util.py b/openapi_core/util.py index cf551e24..d8c5da16 100644 --- a/openapi_core/util.py +++ b/openapi_core/util.py @@ -1,4 +1,5 @@ """OpenAPI core util module""" + from itertools import chain from typing import Any from typing import Iterable diff --git a/openapi_core/validation/exceptions.py b/openapi_core/validation/exceptions.py index 229714bd..95b87cda 100644 --- a/openapi_core/validation/exceptions.py +++ b/openapi_core/validation/exceptions.py @@ -1,4 +1,5 @@ """OpenAPI core validation exceptions module""" + from dataclasses import dataclass from openapi_core.exceptions import OpenAPIError diff --git a/openapi_core/validation/integrations.py b/openapi_core/validation/integrations.py index 3541d20c..1926b932 100644 --- a/openapi_core/validation/integrations.py +++ b/openapi_core/validation/integrations.py @@ -1,4 +1,5 @@ """OpenAPI core unmarshalling processors module""" + from typing import Generic from openapi_core.app import OpenAPI diff --git a/openapi_core/validation/processors.py b/openapi_core/validation/processors.py index ab789819..0fecc265 100644 --- a/openapi_core/validation/processors.py +++ b/openapi_core/validation/processors.py @@ -1,4 +1,5 @@ """OpenAPI core validation processors module""" + from openapi_core.typing import RequestType from openapi_core.typing import ResponseType from openapi_core.validation.integrations import ValidationIntegration diff --git a/openapi_core/validation/request/__init__.py b/openapi_core/validation/request/__init__.py index e94adeda..fdde7767 100644 --- a/openapi_core/validation/request/__init__.py +++ b/openapi_core/validation/request/__init__.py @@ -1,4 +1,5 @@ """OpenAPI core validation request module""" + from typing import Mapping from openapi_spec_validator.versions import consts as versions diff --git a/openapi_core/validation/request/protocols.py b/openapi_core/validation/request/protocols.py index d775ad54..2554e59e 100644 --- a/openapi_core/validation/request/protocols.py +++ b/openapi_core/validation/request/protocols.py @@ -1,4 +1,5 @@ """OpenAPI core validation request protocols module""" + from typing import Iterator from typing import Optional from typing import Protocol @@ -46,20 +47,17 @@ def __init__( MediaTypeDeserializersDict ] = None, security_provider_factory: SecurityProviderFactory = security_provider_factory, - ): - ... + ): ... def iter_errors( self, request: Request, - ) -> Iterator[Exception]: - ... + ) -> Iterator[Exception]: ... def validate( self, request: Request, - ) -> None: - ... + ) -> None: ... @runtime_checkable @@ -79,17 +77,14 @@ def __init__( MediaTypeDeserializersDict ] = None, security_provider_factory: SecurityProviderFactory = security_provider_factory, - ): - ... + ): ... def iter_errors( self, request: WebhookRequest, - ) -> Iterator[Exception]: - ... + ) -> Iterator[Exception]: ... def validate( self, request: WebhookRequest, - ) -> None: - ... + ) -> None: ... diff --git a/openapi_core/validation/request/validators.py b/openapi_core/validation/request/validators.py index 2d89b529..4d205416 100644 --- a/openapi_core/validation/request/validators.py +++ b/openapi_core/validation/request/validators.py @@ -1,4 +1,5 @@ """OpenAPI core validation request validators module""" + import warnings from typing import Any from typing import Dict diff --git a/openapi_core/validation/response/__init__.py b/openapi_core/validation/response/__init__.py index 2210d613..94694360 100644 --- a/openapi_core/validation/response/__init__.py +++ b/openapi_core/validation/response/__init__.py @@ -1,4 +1,5 @@ """OpenAPI core validation response module""" + from typing import Mapping from openapi_spec_validator.versions import consts as versions diff --git a/openapi_core/validation/response/protocols.py b/openapi_core/validation/response/protocols.py index 4948ae03..168c6483 100644 --- a/openapi_core/validation/response/protocols.py +++ b/openapi_core/validation/response/protocols.py @@ -1,4 +1,5 @@ """OpenAPI core validation response protocols module""" + from typing import Iterator from typing import Optional from typing import Protocol @@ -44,22 +45,19 @@ def __init__( extra_media_type_deserializers: Optional[ MediaTypeDeserializersDict ] = None, - ): - ... + ): ... def iter_errors( self, request: Request, response: Response, - ) -> Iterator[Exception]: - ... + ) -> Iterator[Exception]: ... def validate( self, request: Request, response: Response, - ) -> None: - ... + ) -> None: ... @runtime_checkable @@ -78,19 +76,16 @@ def __init__( extra_media_type_deserializers: Optional[ MediaTypeDeserializersDict ] = None, - ): - ... + ): ... def iter_errors( self, request: WebhookRequest, response: Response, - ) -> Iterator[Exception]: - ... + ) -> Iterator[Exception]: ... def validate( self, request: WebhookRequest, response: Response, - ) -> None: - ... + ) -> None: ... diff --git a/openapi_core/validation/response/validators.py b/openapi_core/validation/response/validators.py index 02af9d46..cd4d4350 100644 --- a/openapi_core/validation/response/validators.py +++ b/openapi_core/validation/response/validators.py @@ -1,4 +1,5 @@ """OpenAPI core validation response validators module""" + import warnings from typing import Any from typing import Dict diff --git a/openapi_core/validation/validators.py b/openapi_core/validation/validators.py index f885913e..4389e118 100644 --- a/openapi_core/validation/validators.py +++ b/openapi_core/validation/validators.py @@ -1,4 +1,5 @@ """OpenAPI core validation validators module""" + import warnings from functools import cached_property from typing import Any diff --git a/poetry.lock b/poetry.lock index e141c490..97b268a6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -275,29 +275,33 @@ tzdata = ["tzdata"] [[package]] name = "black" -version = "23.11.0" +version = "24.1.1" description = "The uncompromising code formatter." optional = false python-versions = ">=3.8" files = [ - {file = "black-23.11.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:dbea0bb8575c6b6303cc65017b46351dc5953eea5c0a59d7b7e3a2d2f433a911"}, - {file = "black-23.11.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:412f56bab20ac85927f3a959230331de5614aecda1ede14b373083f62ec24e6f"}, - {file = "black-23.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d136ef5b418c81660ad847efe0e55c58c8208b77a57a28a503a5f345ccf01394"}, - {file = "black-23.11.0-cp310-cp310-win_amd64.whl", hash = "sha256:6c1cac07e64433f646a9a838cdc00c9768b3c362805afc3fce341af0e6a9ae9f"}, - {file = "black-23.11.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cf57719e581cfd48c4efe28543fea3d139c6b6f1238b3f0102a9c73992cbb479"}, - {file = "black-23.11.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:698c1e0d5c43354ec5d6f4d914d0d553a9ada56c85415700b81dc90125aac244"}, - {file = "black-23.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:760415ccc20f9e8747084169110ef75d545f3b0932ee21368f63ac0fee86b221"}, - {file = "black-23.11.0-cp311-cp311-win_amd64.whl", hash = "sha256:58e5f4d08a205b11800332920e285bd25e1a75c54953e05502052738fe16b3b5"}, - {file = "black-23.11.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:45aa1d4675964946e53ab81aeec7a37613c1cb71647b5394779e6efb79d6d187"}, - {file = "black-23.11.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:4c44b7211a3a0570cc097e81135faa5f261264f4dfaa22bd5ee2875a4e773bd6"}, - {file = "black-23.11.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2a9acad1451632021ee0d146c8765782a0c3846e0e0ea46659d7c4f89d9b212b"}, - {file = "black-23.11.0-cp38-cp38-win_amd64.whl", hash = "sha256:fc7f6a44d52747e65a02558e1d807c82df1d66ffa80a601862040a43ec2e3142"}, - {file = "black-23.11.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:7f622b6822f02bfaf2a5cd31fdb7cd86fcf33dab6ced5185c35f5db98260b055"}, - {file = "black-23.11.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:250d7e60f323fcfc8ea6c800d5eba12f7967400eb6c2d21ae85ad31c204fb1f4"}, - {file = "black-23.11.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5133f5507007ba08d8b7b263c7aa0f931af5ba88a29beacc4b2dc23fcefe9c06"}, - {file = "black-23.11.0-cp39-cp39-win_amd64.whl", hash = "sha256:421f3e44aa67138ab1b9bfbc22ee3780b22fa5b291e4db8ab7eee95200726b07"}, - {file = "black-23.11.0-py3-none-any.whl", hash = "sha256:54caaa703227c6e0c87b76326d0862184729a69b73d3b7305b6288e1d830067e"}, - {file = "black-23.11.0.tar.gz", hash = "sha256:4c68855825ff432d197229846f971bc4d6666ce90492e5b02013bcaca4d9ab05"}, + {file = "black-24.1.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2588021038bd5ada078de606f2a804cadd0a3cc6a79cb3e9bb3a8bf581325a4c"}, + {file = "black-24.1.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1a95915c98d6e32ca43809d46d932e2abc5f1f7d582ffbe65a5b4d1588af7445"}, + {file = "black-24.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2fa6a0e965779c8f2afb286f9ef798df770ba2b6cee063c650b96adec22c056a"}, + {file = "black-24.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:5242ecd9e990aeb995b6d03dc3b2d112d4a78f2083e5a8e86d566340ae80fec4"}, + {file = "black-24.1.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:fc1ec9aa6f4d98d022101e015261c056ddebe3da6a8ccfc2c792cbe0349d48b7"}, + {file = "black-24.1.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:0269dfdea12442022e88043d2910429bed717b2d04523867a85dacce535916b8"}, + {file = "black-24.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b3d64db762eae4a5ce04b6e3dd745dcca0fb9560eb931a5be97472e38652a161"}, + {file = "black-24.1.1-cp311-cp311-win_amd64.whl", hash = "sha256:5d7b06ea8816cbd4becfe5f70accae953c53c0e53aa98730ceccb0395520ee5d"}, + {file = "black-24.1.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:e2c8dfa14677f90d976f68e0c923947ae68fa3961d61ee30976c388adc0b02c8"}, + {file = "black-24.1.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a21725862d0e855ae05da1dd25e3825ed712eaaccef6b03017fe0853a01aa45e"}, + {file = "black-24.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:07204d078e25327aad9ed2c64790d681238686bce254c910de640c7cc4fc3aa6"}, + {file = "black-24.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:a83fe522d9698d8f9a101b860b1ee154c1d25f8a82ceb807d319f085b2627c5b"}, + {file = "black-24.1.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:08b34e85170d368c37ca7bf81cf67ac863c9d1963b2c1780c39102187ec8dd62"}, + {file = "black-24.1.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7258c27115c1e3b5de9ac6c4f9957e3ee2c02c0b39222a24dc7aa03ba0e986f5"}, + {file = "black-24.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40657e1b78212d582a0edecafef133cf1dd02e6677f539b669db4746150d38f6"}, + {file = "black-24.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:e298d588744efda02379521a19639ebcd314fba7a49be22136204d7ed1782717"}, + {file = "black-24.1.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:34afe9da5056aa123b8bfda1664bfe6fb4e9c6f311d8e4a6eb089da9a9173bf9"}, + {file = "black-24.1.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:854c06fb86fd854140f37fb24dbf10621f5dab9e3b0c29a690ba595e3d543024"}, + {file = "black-24.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3897ae5a21ca132efa219c029cce5e6bfc9c3d34ed7e892113d199c0b1b444a2"}, + {file = "black-24.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:ecba2a15dfb2d97105be74bbfe5128bc5e9fa8477d8c46766505c1dda5883aac"}, + {file = "black-24.1.1-py3-none-any.whl", hash = "sha256:5cdc2e2195212208fbcae579b931407c1fa9997584f0a415421748aeafff1168"}, + {file = "black-24.1.1.tar.gz", hash = "sha256:48b5760dcbfe5cf97fd4fba23946681f3a81514c6ab8a45b50da67ac8fbc6c7b"}, ] [package.dependencies] @@ -311,7 +315,7 @@ typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""} [package.extras] colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.7.4)"] +d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] @@ -1858,6 +1862,7 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, @@ -2528,4 +2533,4 @@ starlette = ["aioitertools", "starlette"] [metadata] lock-version = "2.0" python-versions = "^3.8.0" -content-hash = "0b7486855d27fa1dad46f0729514628cf9b91f119e79707dae5b2841a4ce1d14" +content-hash = "bea92fa6d46b6f60220cad52e9ff6dbe8dd493e75011174f073d99491777d803" diff --git a/pyproject.toml b/pyproject.toml index d9f44756..5cf6c021 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,7 +86,7 @@ aiohttp = ["aiohttp", "multidict"] starlette = ["starlette", "aioitertools"] [tool.poetry.group.dev.dependencies] -black = "^23.3.0" +black = ">=23.3,<25.0" django = ">=3.0" djangorestframework = "^3.11.2" falcon = ">=3.0" diff --git a/tests/integration/contrib/django/data/v3.0/djangoproject/urls.py b/tests/integration/contrib/django/data/v3.0/djangoproject/urls.py index bfd93fbd..ff987972 100644 --- a/tests/integration/contrib/django/data/v3.0/djangoproject/urls.py +++ b/tests/integration/contrib/django/data/v3.0/djangoproject/urls.py @@ -13,6 +13,7 @@ 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ + from django.contrib import admin from django.urls import include from django.urls import path