Skip to content

Commit

Permalink
Fix missing format error
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Leontev committed Aug 28, 2023
1 parent b578827 commit 3f4edbb
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions examples/petstore/client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ async def getPetById(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
headers: dict[str, Any] | None = None,
) -> Pet | EmptyBody:
) -> EmptyBody | Pet:
url = self._get_url(f"/pet/{petId}")

params = {}
Expand Down Expand Up @@ -744,7 +744,7 @@ async def getUserByName(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
headers: dict[str, Any] | None = None,
) -> User | EmptyBody:
) -> EmptyBody | User:
url = self._get_url(f"/user/{username}")

params = {}
Expand Down Expand Up @@ -811,7 +811,7 @@ async def addPet(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
headers: dict[str, Any] | None = None,
) -> Pet | EmptyBody:
) -> EmptyBody | Pet:
url = self._get_url(f"/pet")

params = {}
Expand Down Expand Up @@ -880,7 +880,7 @@ async def addPet(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
headers: dict[str, Any] | None = None,
) -> AddpetResponse200 | EmptyBody:
) -> EmptyBody | AddpetResponse200:
url = self._get_url(f"/pet_or_tag")

params = {}
Expand Down Expand Up @@ -1257,7 +1257,7 @@ async def updatePet(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
headers: dict[str, Any] | None = None,
) -> Pet | EmptyBody:
) -> EmptyBody | Pet:
url = self._get_url(f"/pet")

params = {}
Expand Down
2 changes: 1 addition & 1 deletion examples/petstore/client_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ def loginUser(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
headers: dict[str, Any] | None = None,
) -> LoginuserResponse200 | EmptyBody:
) -> EmptyBody | LoginuserResponse200:
url = self._get_url(f"/user/login")

params = {}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pythogen"
version = "0.1.32"
version = "0.1.33"
description = "Generator of python HTTP-clients from OpenApi specification."
homepage = "https://github.com/artsmolin/pythogen"
repository = "https://github.com/artsmolin/pythogen"
Expand Down
2 changes: 1 addition & 1 deletion pythogen/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Format(Enum):
def _missing_(cls, value):
value = re.sub('[_-]*', '', value)
for member in cls:
if member.lower() == value:
if member.name.lower() == value:
return member
return None

Expand Down
4 changes: 2 additions & 2 deletions tests/clients/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ async def get_object(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
headers: dict[str, Any] | None = None,
) -> UnknownError | GetObjectResp:
) -> GetObjectResp | UnknownError:
url = self._get_url(f"/objects/{object_id}")

params = {
Expand Down Expand Up @@ -996,7 +996,7 @@ async def get_object_slow(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
headers: dict[str, Any] | None = None,
) -> UnknownError | GetObjectResp:
) -> GetObjectResp | UnknownError:
url = self._get_url(f"/slow/objects/{object_id}")

params = {}
Expand Down
4 changes: 2 additions & 2 deletions tests/clients/async_client_with_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ async def get_object(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
headers: dict[str, Any] | None = None,
) -> UnknownError | GetObjectResp:
) -> GetObjectResp | UnknownError:
url = self._get_url(f"/objects/{object_id}")

params = {
Expand Down Expand Up @@ -1239,7 +1239,7 @@ async def get_object_slow(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
headers: dict[str, Any] | None = None,
) -> UnknownError | GetObjectResp:
) -> GetObjectResp | UnknownError:
url = self._get_url(f"/slow/objects/{object_id}")

params = {}
Expand Down
4 changes: 2 additions & 2 deletions tests/clients/sync_client_with_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def get_object(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
headers: dict[str, Any] | None = None,
) -> GetObjectResp | UnknownError:
) -> UnknownError | GetObjectResp:
url = self._get_url(f"/objects/{object_id}")

params = {
Expand Down Expand Up @@ -1239,7 +1239,7 @@ def get_object_slow(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
headers: dict[str, Any] | None = None,
) -> GetObjectResp | UnknownError:
) -> UnknownError | GetObjectResp:
url = self._get_url(f"/slow/objects/{object_id}")

params = {}
Expand Down

0 comments on commit 3f4edbb

Please sign in to comment.