-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from knopki/feat-snake-case-dicts
camel case <-> snake case autoconversion
- Loading branch information
Showing
36 changed files
with
468 additions
and
379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"""Compatibility layer""" | ||
|
||
import sys | ||
|
||
if sys.version_info < (3, 9): # pragma: no cover | ||
from typing import Awaitable, Callable, Dict, List, Mapping, Sequence | ||
else: # pragma: no cover | ||
from collections.abc import Awaitable, Callable, Mapping, Sequence | ||
|
||
Dict = dict | ||
List = list | ||
|
||
|
||
if sys.version_info < (3, 10): # pragma: no cover | ||
from typing_extensions import TypeGuard | ||
else: # pragma: no cover | ||
from typing import TypeGuard | ||
|
||
if sys.version_info < (3, 11): # pragma: no cover | ||
from typing_extensions import Concatenate, NotRequired, ParamSpec, TypedDict, Unpack | ||
else: # pragma: no cover | ||
from typing import Concatenate, NotRequired, ParamSpec, TypedDict, Unpack | ||
|
||
|
||
__all__ = [ | ||
"Awaitable", | ||
"Callable", | ||
"Concatenate", | ||
"Dict", | ||
"List", | ||
"Mapping", | ||
"NotRequired", | ||
"ParamSpec", | ||
"Sequence", | ||
"TypeGuard", | ||
"TypedDict", | ||
"Unpack", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
"""Base of DTOs""" | ||
|
||
import sys | ||
from datetime import datetime | ||
|
||
if sys.version_info < (3, 11): # pragma: no cover | ||
from typing_extensions import NotRequired, TypedDict | ||
else: # pragma: no cover | ||
from typing import NotRequired, TypedDict | ||
from ..compat import NotRequired, TypedDict | ||
|
||
|
||
class MetisTimestampsDTO(TypedDict): | ||
"Response with timestamps" | ||
createdAt: NotRequired[datetime] | ||
updatedAt: NotRequired[datetime] | ||
created_at: NotRequired[datetime] | ||
updated_at: NotRequired[datetime] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,15 @@ | ||
"""Calculation DTOs""" | ||
import sys | ||
|
||
from ..compat import NotRequired, Sequence | ||
from .base import MetisTimestampsDTO | ||
from .datasource import MetisDataSourceDTO | ||
|
||
if sys.version_info < (3, 9): # pragma: no cover | ||
from typing import Sequence | ||
else: # pragma: no cover | ||
from collections.abc import Sequence | ||
|
||
if sys.version_info < (3, 11): # pragma: no cover | ||
from typing_extensions import NotRequired | ||
else: # pragma: no cover | ||
from typing import NotRequired | ||
|
||
|
||
class MetisCalculationDTO(MetisTimestampsDTO): | ||
"Calculation DTO" | ||
id: int | ||
name: str | ||
userId: int | ||
user_id: int | ||
progress: int | ||
parent: int | ||
result: NotRequired[Sequence[MetisDataSourceDTO]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
"Base response DTO" | ||
|
||
import sys | ||
|
||
if sys.version_info < (3, 11): # pragma: no cover | ||
from typing_extensions import TypedDict | ||
else: # pragma: no cover | ||
from typing import TypedDict | ||
from ..compat import TypedDict | ||
|
||
|
||
class MetisRequestIdDTO(TypedDict): | ||
"Response with request id dictionary" | ||
reqId: str | ||
req_id: str |
Oops, something went wrong.