Skip to content

Commit

Permalink
Merge pull request #901 from python-openapi/dependabot/pip/mypy-1.11.2
Browse files Browse the repository at this point in the history
Bump mypy from 1.8.0 to 1.11.2
  • Loading branch information
p1c2u authored Sep 3, 2024
2 parents 9f27406 + afabfe5 commit 8e92c42
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 39 deletions.
23 changes: 14 additions & 9 deletions openapi_core/deserializing/media_types/util.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from email.message import Message
from email.parser import Parser
from json import loads
from typing import Any
from typing import Iterator
from typing import Mapping
from typing import Tuple
from urllib.parse import parse_qsl
from xml.etree.ElementTree import Element
from xml.etree.ElementTree import fromstring
Expand Down Expand Up @@ -57,12 +60,14 @@ def data_form_loads(value: bytes, **parameters: str) -> Mapping[str, Any]:
header = f'Content-Type: {mimetype}; boundary="{boundary}"'
text = "\n\n".join([header, decoded])
parts = parser.parsestr(text, headersonly=False)
return ImmutableMultiDict(
[
(
part.get_param("name", header="content-disposition"),
part.get_payload(decode=True),
)
for part in parts.get_payload()
]
)
return ImmutableMultiDict(list(iter_payloads(parts)))


def iter_payloads(parts: Message) -> Iterator[Tuple[str, bytes]]:
for part in parts.get_payload():
assert isinstance(part, Message)
name = part.get_param("name", header="content-disposition")
assert isinstance(name, str)
payload = part.get_payload(decode=True)
assert isinstance(payload, bytes)
yield name, payload
2 changes: 1 addition & 1 deletion openapi_core/validation/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def __init__(
"schema_validators_factory is not assigned"
)
self.path_finder_cls = path_finder_cls or self.path_finder_cls
if self.path_finder_cls is NotImplemented: # type: ignore[comparison-overlap]
if self.path_finder_cls is NotImplemented:
raise NotImplementedError("path_finder_cls is not assigned")
self.spec_validator_cls = spec_validator_cls or self.spec_validator_cls
self.format_validators = format_validators
Expand Down
58 changes: 29 additions & 29 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8e92c42

Please sign in to comment.