Skip to content

Commit

Permalink
Pyflakes pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
p1c2u committed Nov 26, 2023
1 parent 840bfbd commit 8e2c5a8
Show file tree
Hide file tree
Showing 63 changed files with 84 additions and 332 deletions.
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,10 @@ repos:
language: system
require_serial: true
types: [python]

- id: pyflakes
name: pyflakes
entry: pyflakes
language: system
require_serial: true
types: [python]
11 changes: 0 additions & 11 deletions openapi_core/app.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
"""OpenAPI core app module"""
import warnings
from dataclasses import dataclass
from dataclasses import field
from functools import lru_cache
from pathlib import Path
from typing import Any
from typing import Hashable
from typing import Mapping
from typing import Optional
from typing import Type
from typing import TypeVar
from typing import Union

from jsonschema._utils import Unset
from jsonschema.validators import _UNSET
Expand All @@ -19,7 +9,6 @@
from jsonschema_path.typing import Schema
from openapi_spec_validator import validate
from openapi_spec_validator.validation.exceptions import ValidatorDetectError
from openapi_spec_validator.validation.types import SpecValidatorType
from openapi_spec_validator.versions.datatypes import SpecVersion
from openapi_spec_validator.versions.exceptions import OpenAPIVersionNotFound
from openapi_spec_validator.versions.shortcuts import get_spec_version
Expand Down
3 changes: 0 additions & 3 deletions openapi_core/casting/schemas/casters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from typing import TYPE_CHECKING
from typing import Any
from typing import Callable
from typing import Generic
from typing import Iterable
from typing import List
Expand All @@ -12,7 +10,6 @@

from jsonschema_path import SchemaPath

from openapi_core.casting.schemas.datatypes import CasterCallable
from openapi_core.casting.schemas.exceptions import CastError
from openapi_core.schema.schemas import get_properties
from openapi_core.util import forcebool
Expand Down
3 changes: 0 additions & 3 deletions openapi_core/casting/schemas/factories.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
from typing import Dict
from typing import Optional

from jsonschema_path import SchemaPath

from openapi_core.casting.schemas.casters import SchemaCaster
from openapi_core.casting.schemas.casters import TypesCaster
from openapi_core.casting.schemas.datatypes import CasterCallable
from openapi_core.util import forcebool
from openapi_core.validation.schemas.datatypes import FormatValidatorsDict
from openapi_core.validation.schemas.factories import SchemaValidatorsFactory

Expand Down
58 changes: 0 additions & 58 deletions openapi_core/configurations.py
Original file line number Diff line number Diff line change
@@ -1,79 +1,21 @@
import warnings
from dataclasses import dataclass
from dataclasses import field
from functools import lru_cache
from pathlib import Path
from typing import Any
from typing import Hashable
from typing import Mapping
from typing import Optional
from typing import Type
from typing import TypeVar
from typing import Union

from jsonschema._utils import Unset
from jsonschema.validators import _UNSET
from jsonschema_path import SchemaPath
from jsonschema_path.handlers.protocols import SupportsRead
from jsonschema_path.typing import Schema
from openapi_spec_validator import validate
from openapi_spec_validator.validation.types import SpecValidatorType
from openapi_spec_validator.versions.datatypes import SpecVersion
from openapi_spec_validator.versions.exceptions import OpenAPIVersionNotFound
from openapi_spec_validator.versions.shortcuts import get_spec_version

from openapi_core.exceptions import SpecError
from openapi_core.protocols import Request
from openapi_core.protocols import Response
from openapi_core.protocols import WebhookRequest
from openapi_core.types import AnyRequest
from openapi_core.unmarshalling.configurations import UnmarshallerConfig
from openapi_core.unmarshalling.request import (
UNMARSHALLERS as REQUEST_UNMARSHALLERS,
)
from openapi_core.unmarshalling.request import (
WEBHOOK_UNMARSHALLERS as WEBHOOK_REQUEST_UNMARSHALLERS,
)
from openapi_core.unmarshalling.request.datatypes import RequestUnmarshalResult
from openapi_core.unmarshalling.request.protocols import RequestUnmarshaller
from openapi_core.unmarshalling.request.protocols import (
WebhookRequestUnmarshaller,
)
from openapi_core.unmarshalling.request.types import RequestUnmarshallerType
from openapi_core.unmarshalling.request.types import (
WebhookRequestUnmarshallerType,
)
from openapi_core.unmarshalling.response import (
UNMARSHALLERS as RESPONSE_UNMARSHALLERS,
)
from openapi_core.unmarshalling.response import (
WEBHOOK_UNMARSHALLERS as WEBHOOK_RESPONSE_UNMARSHALLERS,
)
from openapi_core.unmarshalling.response.datatypes import (
ResponseUnmarshalResult,
)
from openapi_core.unmarshalling.response.protocols import ResponseUnmarshaller
from openapi_core.unmarshalling.response.protocols import (
WebhookResponseUnmarshaller,
)
from openapi_core.unmarshalling.response.types import ResponseUnmarshallerType
from openapi_core.unmarshalling.response.types import (
WebhookResponseUnmarshallerType,
)
from openapi_core.validation.request import VALIDATORS as REQUEST_VALIDATORS
from openapi_core.validation.request import (
WEBHOOK_VALIDATORS as WEBHOOK_REQUEST_VALIDATORS,
)
from openapi_core.validation.request.protocols import RequestValidator
from openapi_core.validation.request.protocols import WebhookRequestValidator
from openapi_core.validation.request.types import RequestValidatorType
from openapi_core.validation.request.types import WebhookRequestValidatorType
from openapi_core.validation.response import VALIDATORS as RESPONSE_VALIDATORS
from openapi_core.validation.response import (
WEBHOOK_VALIDATORS as WEBHOOK_RESPONSE_VALIDATORS,
)
from openapi_core.validation.response.protocols import ResponseValidator
from openapi_core.validation.response.protocols import WebhookResponseValidator
from openapi_core.validation.response.types import ResponseValidatorType
from openapi_core.validation.response.types import WebhookResponseValidatorType

Expand Down
3 changes: 0 additions & 3 deletions openapi_core/contrib/aiohttp/requests.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
"""OpenAPI core contrib aiohttp requests module"""
from __future__ import annotations

from typing import cast

from aiohttp import web
from asgiref.sync import AsyncToSync

from openapi_core.datatypes import RequestParameters

Expand Down
1 change: 0 additions & 1 deletion openapi_core/contrib/django/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import Callable
from typing import Dict
from typing import Iterable
from typing import Optional
from typing import Type

from django.http import JsonResponse
Expand Down
3 changes: 0 additions & 3 deletions openapi_core/contrib/django/middlewares.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
DjangoOpenAPIValidRequestHandler,
)
from openapi_core.contrib.django.integrations import DjangoIntegration
from openapi_core.contrib.django.requests import DjangoOpenAPIRequest
from openapi_core.contrib.django.responses import DjangoOpenAPIResponse
from openapi_core.unmarshalling.processors import UnmarshallingProcessor


class DjangoOpenAPIMiddleware(DjangoIntegration):
Expand Down
2 changes: 0 additions & 2 deletions openapi_core/contrib/falcon/middlewares.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""OpenAPI core contrib falcon middlewares module"""
from typing import Any
from typing import Optional
from typing import Type
from typing import Union

Expand All @@ -19,7 +18,6 @@
from openapi_core.contrib.falcon.integrations import FalconIntegration
from openapi_core.contrib.falcon.requests import FalconOpenAPIRequest
from openapi_core.contrib.falcon.responses import FalconOpenAPIResponse
from openapi_core.unmarshalling.processors import UnmarshallingProcessor
from openapi_core.unmarshalling.request.types import RequestUnmarshallerType
from openapi_core.unmarshalling.response.types import ResponseUnmarshallerType

Expand Down
4 changes: 0 additions & 4 deletions openapi_core/contrib/flask/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from functools import wraps
from typing import Any
from typing import Callable
from typing import Optional
from typing import Type

from flask.globals import request
Expand All @@ -17,9 +16,6 @@
from openapi_core.contrib.flask.providers import FlaskRequestProvider
from openapi_core.contrib.flask.requests import FlaskOpenAPIRequest
from openapi_core.contrib.flask.responses import FlaskOpenAPIResponse
from openapi_core.unmarshalling.processors import UnmarshallingProcessor
from openapi_core.unmarshalling.request.types import RequestUnmarshallerType
from openapi_core.unmarshalling.response.types import ResponseUnmarshallerType


class FlaskOpenAPIViewDecorator(FlaskIntegration):
Expand Down
2 changes: 0 additions & 2 deletions openapi_core/contrib/starlette/handlers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"""OpenAPI core contrib starlette handlers module"""
from typing import Any
from typing import Callable
from typing import Dict
from typing import Iterable
from typing import Optional
from typing import Type

from starlette.middleware.base import RequestResponseEndpoint
Expand Down
3 changes: 0 additions & 3 deletions openapi_core/contrib/starlette/integrations.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from typing import Callable

from aioitertools.builtins import list as alist
from aioitertools.itertools import tee as atee
from starlette.requests import Request
from starlette.responses import Response
Expand Down
4 changes: 0 additions & 4 deletions openapi_core/contrib/starlette/middlewares.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from starlette.middleware.base import RequestResponseEndpoint
from starlette.requests import Request
from starlette.responses import Response
from starlette.responses import StreamingResponse
from starlette.types import ASGIApp

from openapi_core import OpenAPI
Expand All @@ -14,9 +13,6 @@
StarletteOpenAPIValidRequestHandler,
)
from openapi_core.contrib.starlette.integrations import StarletteIntegration
from openapi_core.contrib.starlette.requests import StarletteOpenAPIRequest
from openapi_core.contrib.starlette.responses import StarletteOpenAPIResponse
from openapi_core.unmarshalling.processors import AsyncUnmarshallingProcessor


class StarletteOpenAPIMiddleware(StarletteIntegration, BaseHTTPMiddleware):
Expand Down
1 change: 0 additions & 1 deletion openapi_core/contrib/starlette/requests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""OpenAPI core contrib starlette requests module"""
from typing import Optional

from asgiref.sync import AsyncToSync
from starlette.requests import Request

from openapi_core.datatypes import RequestParameters
Expand Down
4 changes: 0 additions & 4 deletions openapi_core/deserializing/media_types/deserializers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import warnings
from typing import Any
from typing import Mapping
from typing import Optional
from typing import cast
from xml.etree.ElementTree import ParseError

from jsonschema_path import SchemaPath
Expand Down Expand Up @@ -106,7 +104,6 @@ def evolve(
def decode(self, location: Mapping[str, Any]) -> Mapping[str, Any]:
# schema is required for multipart
assert self.schema is not None
schema_props = self.schema.get("properties")
properties = {}
for prop_name, prop_schema in get_properties(self.schema).items():
try:
Expand All @@ -127,7 +124,6 @@ def decode_property(
location: Mapping[str, Any],
) -> Any:
if self.encoding is None or prop_name not in self.encoding:
prop_schema_type = prop_schema.getkey("type", "")
if self.mimetype == "application/x-www-form-urlencoded":
# default serialization strategy for complex objects
# in the application/x-www-form-urlencoded
Expand Down
3 changes: 0 additions & 3 deletions openapi_core/deserializing/media_types/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

from jsonschema_path import SchemaPath

from openapi_core.deserializing.media_types.datatypes import (
DeserializerCallable,
)
from openapi_core.deserializing.media_types.datatypes import (
MediaTypeDeserializersDict,
)
Expand Down
1 change: 0 additions & 1 deletion openapi_core/deserializing/media_types/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from json import loads
from typing import Any
from typing import Mapping
from typing import Union
from urllib.parse import parse_qsl
from xml.etree.ElementTree import Element
from xml.etree.ElementTree import fromstring
Expand Down
1 change: 0 additions & 1 deletion openapi_core/deserializing/styles/datatypes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Mapping

DeserializerCallable = Callable[[bool, str, str, Mapping[str, Any]], Any]
Expand Down
7 changes: 0 additions & 7 deletions openapi_core/deserializing/styles/deserializers.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import warnings
from typing import Any
from typing import Callable
from typing import List
from typing import Mapping
from typing import Optional

from jsonschema_path import SchemaPath

from openapi_core.deserializing.exceptions import DeserializeError
from openapi_core.deserializing.styles.datatypes import DeserializerCallable
from openapi_core.deserializing.styles.exceptions import (
EmptyQueryParameterValue,
)


class StyleDeserializer:
Expand Down
6 changes: 0 additions & 6 deletions openapi_core/deserializing/styles/factories.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import re
from functools import partial
from typing import Any
from typing import Dict
from typing import Mapping
from typing import Optional

from jsonschema_path import SchemaPath

from openapi_core.deserializing.styles.datatypes import DeserializerCallable
from openapi_core.deserializing.styles.datatypes import StyleDeserializersDict
from openapi_core.deserializing.styles.deserializers import StyleDeserializer

Expand Down
1 change: 0 additions & 1 deletion openapi_core/deserializing/styles/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import Any
from typing import List
from typing import Mapping
from typing import Optional

from openapi_core.schema.protocols import SuportsGetAll
from openapi_core.schema.protocols import SuportsGetList
Expand Down
2 changes: 0 additions & 2 deletions openapi_core/extensions/models/factories.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
"""OpenAPI X-Model extension factories module"""
from dataclasses import make_dataclass
from pydoc import ErrorDuringImport
from pydoc import locate
from typing import Any
from typing import Dict
from typing import Iterable
from typing import Optional
from typing import Type

from jsonschema_path import SchemaPath
Expand Down
2 changes: 0 additions & 2 deletions openapi_core/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
from typing import runtime_checkable

from openapi_core.datatypes import RequestParameters
from openapi_core.typing import RequestType
from openapi_core.typing import ResponseType


@runtime_checkable
Expand Down
7 changes: 0 additions & 7 deletions openapi_core/schema/parameters.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
from typing import Any
from typing import Dict
from typing import Mapping
from typing import Optional
from typing import Tuple

from jsonschema_path import SchemaPath

from openapi_core.schema.protocols import SuportsGetAll
from openapi_core.schema.protocols import SuportsGetList


def get_style(
param_or_header: SchemaPath, default_location: str = "header"
Expand Down
Loading

0 comments on commit 8e2c5a8

Please sign in to comment.