ul-api-utils 8.1.17__py3-none-any.whl → 8.1.19__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ul-api-utils might be problematic. Click here for more details.
- ul_api_utils/api_resource/api_resource_fn_typing.py +8 -8
- ul_api_utils/api_resource/api_response.py +8 -9
- ul_api_utils/utils/json_encoder.py +3 -1
- {ul_api_utils-8.1.17.dist-info → ul_api_utils-8.1.19.dist-info}/METADATA +1 -1
- {ul_api_utils-8.1.17.dist-info → ul_api_utils-8.1.19.dist-info}/RECORD +9 -9
- {ul_api_utils-8.1.17.dist-info → ul_api_utils-8.1.19.dist-info}/LICENSE +0 -0
- {ul_api_utils-8.1.17.dist-info → ul_api_utils-8.1.19.dist-info}/WHEEL +0 -0
- {ul_api_utils-8.1.17.dist-info → ul_api_utils-8.1.19.dist-info}/entry_points.txt +0 -0
- {ul_api_utils-8.1.17.dist-info → ul_api_utils-8.1.19.dist-info}/top_level.txt +0 -0
|
@@ -2,7 +2,7 @@ import inspect
|
|
|
2
2
|
from typing import NamedTuple, Any, Callable, Optional, List, Dict, Type, Tuple, TYPE_CHECKING, Union, get_origin, get_args
|
|
3
3
|
|
|
4
4
|
from flask import request
|
|
5
|
-
from pydantic import BaseModel, ValidationError, validate_call, TypeAdapter
|
|
5
|
+
from pydantic import BaseModel, ValidationError, validate_call, TypeAdapter, RootModel
|
|
6
6
|
from pydantic.v1.utils import deep_update
|
|
7
7
|
from pydantic_core import ErrorDetails
|
|
8
8
|
|
|
@@ -82,18 +82,18 @@ class ApiResourceFnTyping(NamedTuple):
|
|
|
82
82
|
|
|
83
83
|
if self.request_body_optional:
|
|
84
84
|
if self.request_body_many:
|
|
85
|
-
class BodyTypingOptList(
|
|
86
|
-
|
|
85
|
+
class BodyTypingOptList(RootModel[List[body_typing] | None]): # type: ignore
|
|
86
|
+
pass
|
|
87
87
|
|
|
88
88
|
return BodyTypingOptList
|
|
89
89
|
|
|
90
|
-
class BodyTypingOpt(
|
|
91
|
-
|
|
90
|
+
class BodyTypingOpt(RootModel[Optional[body_typing]]): # type: ignore
|
|
91
|
+
pass
|
|
92
92
|
return BodyTypingOpt
|
|
93
93
|
|
|
94
94
|
if self.request_body_many:
|
|
95
|
-
class BodyTypingList(
|
|
96
|
-
|
|
95
|
+
class BodyTypingList(RootModel[List[body_typing]]): # type: ignore
|
|
96
|
+
pass
|
|
97
97
|
|
|
98
98
|
return BodyTypingList
|
|
99
99
|
return body_typing
|
|
@@ -165,7 +165,7 @@ class ApiResourceFnTyping(NamedTuple):
|
|
|
165
165
|
return kwargs, errors
|
|
166
166
|
body = self._get_body()
|
|
167
167
|
try:
|
|
168
|
-
expected_typing: Type[BaseModel | List[BaseModel]] = List[self.body_typing] if self.request_body_many else self.body_typing
|
|
168
|
+
expected_typing: Type[BaseModel | List[BaseModel]] = List[self.body_typing] if self.request_body_many else self.body_typing # type: ignore
|
|
169
169
|
kwargs['body'] = TypeAdapter(expected_typing).validate_python(body)
|
|
170
170
|
except ValidationError as ve:
|
|
171
171
|
if self.has_body_validation_error:
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import io
|
|
2
2
|
from datetime import datetime
|
|
3
|
-
from types import NoneType
|
|
4
3
|
from typing import TypeVar, Generic, List, Optional, Dict, Any, Callable, Union, BinaryIO, Tuple, Type
|
|
5
4
|
|
|
6
5
|
import msgpack
|
|
@@ -64,8 +63,8 @@ class HtmlApiResponse(ApiResponse):
|
|
|
64
63
|
|
|
65
64
|
@classmethod
|
|
66
65
|
def _internal_use__mk_schema(cls, inner_type: Optional[Type[BaseModel]]) -> Type[BaseModel]:
|
|
67
|
-
class _ResponseNoneType(
|
|
68
|
-
|
|
66
|
+
class _ResponseNoneType(RootModel[None]):
|
|
67
|
+
pass
|
|
69
68
|
return _ResponseNoneType
|
|
70
69
|
|
|
71
70
|
def to_flask_response(self, debugger: Optional[Debugger] = None) -> BaseResponse:
|
|
@@ -103,8 +102,8 @@ class FileApiResponse(ApiResponse):
|
|
|
103
102
|
|
|
104
103
|
@classmethod
|
|
105
104
|
def _internal_use__mk_schema(cls, inner_type: Optional[Type[BaseModel]]) -> Type[BaseModel]:
|
|
106
|
-
class _ResponseNoneType(
|
|
107
|
-
|
|
105
|
+
class _ResponseNoneType(RootModel[None]):
|
|
106
|
+
pass
|
|
108
107
|
return _ResponseNoneType
|
|
109
108
|
|
|
110
109
|
def to_flask_response(self, debugger: Optional[Debugger] = None) -> BaseResponse:
|
|
@@ -131,8 +130,8 @@ class EmptyJsonApiResponse(ApiResponse):
|
|
|
131
130
|
|
|
132
131
|
@classmethod
|
|
133
132
|
def _internal_use__mk_schema(cls, inner_type: Optional[Type[BaseModel]]) -> Type[BaseModel]:
|
|
134
|
-
class _ResponseNoneType(
|
|
135
|
-
|
|
133
|
+
class _ResponseNoneType(RootModel[None]):
|
|
134
|
+
pass
|
|
136
135
|
return _ResponseNoneType
|
|
137
136
|
|
|
138
137
|
def to_flask_response(self, debugger: Optional[Debugger] = None) -> BaseResponse:
|
|
@@ -199,8 +198,8 @@ class RootJsonApiResponse(Generic[TJsonObjApiResponsePayload], EmptyJsonApiRespo
|
|
|
199
198
|
|
|
200
199
|
@classmethod
|
|
201
200
|
def _internal_use__mk_schema(cls, inner_type: Optional[Type[BaseModel]]) -> Type[BaseModel]:
|
|
202
|
-
class _ResponseStd(
|
|
203
|
-
|
|
201
|
+
class _ResponseStd(RootModel[inner_type]): # type: ignore
|
|
202
|
+
pass
|
|
204
203
|
return _ResponseStd
|
|
205
204
|
|
|
206
205
|
def to_flask_response(self, debugger: Optional[Debugger] = None) -> BaseResponse:
|
|
@@ -2,7 +2,7 @@ import dataclasses
|
|
|
2
2
|
import decimal
|
|
3
3
|
import json
|
|
4
4
|
from base64 import b64encode
|
|
5
|
-
from datetime import date, datetime
|
|
5
|
+
from datetime import date, datetime, time
|
|
6
6
|
from enum import Enum
|
|
7
7
|
from json import JSONEncoder
|
|
8
8
|
from typing import Dict, Any, Union, List, Optional, TYPE_CHECKING
|
|
@@ -62,6 +62,8 @@ class CustomJSONEncoder(JSONEncoder):
|
|
|
62
62
|
return str(obj.isoformat())
|
|
63
63
|
if isinstance(obj, date):
|
|
64
64
|
return str(obj.isoformat())
|
|
65
|
+
if isinstance(obj, time):
|
|
66
|
+
return str(obj.isoformat())
|
|
65
67
|
if isinstance(obj, UUID):
|
|
66
68
|
return str(obj)
|
|
67
69
|
if isinstance(obj, Enum):
|
|
@@ -29,9 +29,9 @@ ul_api_utils/api_resource/api_request.py,sha256=6Ag2trKIkenhYYPU2--hnfNJC5lLgBxV
|
|
|
29
29
|
ul_api_utils/api_resource/api_resource.py,sha256=ERAGC4rrN_jmZ_dFhYZZ_Eczqdy5tQK7cfN7SY4sIfA,17914
|
|
30
30
|
ul_api_utils/api_resource/api_resource_config.py,sha256=l9OYJy75UZLshOkEQDO5jlhXeb5H4HDPu-nLOjuoexw,769
|
|
31
31
|
ul_api_utils/api_resource/api_resource_error_handling.py,sha256=E0SWpjFSIP-4SumbgzrHtFuFiGe9q38WsvLROt0YcPE,1168
|
|
32
|
-
ul_api_utils/api_resource/api_resource_fn_typing.py,sha256=
|
|
32
|
+
ul_api_utils/api_resource/api_resource_fn_typing.py,sha256=gyWEnYuepvaVW4O6ljpoPA5S4i9EeKsYBaAN2mHXDcw,18963
|
|
33
33
|
ul_api_utils/api_resource/api_resource_type.py,sha256=mgjSQI3swGpgpLI6y35LYtFrdN-kXyV5cQorwGW7h6g,462
|
|
34
|
-
ul_api_utils/api_resource/api_response.py,sha256=
|
|
34
|
+
ul_api_utils/api_resource/api_response.py,sha256=tJxo8rFPkQYTwDITPKr8ett9CC4T8cuwnvTRSTdudVQ,10038
|
|
35
35
|
ul_api_utils/api_resource/api_response_db.py,sha256=ucY6ANPlHZml7JAbvq-PL85z0bvERTjEJKvz-REPyok,888
|
|
36
36
|
ul_api_utils/api_resource/api_response_payload_alias.py,sha256=FoD0LhQGZ2T8A5-VKRX5ADyzSgm7_dd3qxU2BgCVXkA,587
|
|
37
37
|
ul_api_utils/api_resource/db_types.py,sha256=gF0oxisRkYLf7_2e7YEU-HJDxLy3dJCVaJsYQbOfG5k,433
|
|
@@ -111,7 +111,7 @@ ul_api_utils/utils/deprecated.py,sha256=xR3ELgoDj7vJEY4CAYeEhdbtSJTfkukbjxcULtpM
|
|
|
111
111
|
ul_api_utils/utils/flags.py,sha256=AYN5nKWp4-uu6PSlPptL7ZiLqr3Pu-x5dffF6SBsqfg,957
|
|
112
112
|
ul_api_utils/utils/imports.py,sha256=i8PhoD0c_jnWTeXt_VxW_FihynwXSL_dHRT7jQiFyXE,376
|
|
113
113
|
ul_api_utils/utils/instance_checks.py,sha256=9punTfY5uabuJhmSGLfTgBqRderoFysCXBSI8rvbPco,467
|
|
114
|
-
ul_api_utils/utils/json_encoder.py,sha256=
|
|
114
|
+
ul_api_utils/utils/json_encoder.py,sha256=2uJuoZHNx0TpDLYdlVpch_Am1OXIG_gWHHvdPkfRV2c,4658
|
|
115
115
|
ul_api_utils/utils/load_modules.py,sha256=_CPmQuB6o_33FE6zFl_GyO5xS5gmjfNffB6k-cglKAA,685
|
|
116
116
|
ul_api_utils/utils/token_check.py,sha256=-Quuh8gOs9fNE1shYhdiMpQedafsLN7MB2ilSxG_F8E,489
|
|
117
117
|
ul_api_utils/utils/token_check_through_request.py,sha256=OyyObu6Btk9br7auIYvWcMULhNznNSD5T0mWOwZX7Uk,663
|
|
@@ -148,9 +148,9 @@ ul_api_utils/validators/validate_empty_object.py,sha256=3Ck_iwyJE_M5e7l6s1i88aqb
|
|
|
148
148
|
ul_api_utils/validators/validate_uuid.py,sha256=EfvlRirv2EW0Z6w3s8E8rUa9GaI8qXZkBWhnPs8NFrA,257
|
|
149
149
|
ul_api_utils/validators/__tests__/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
150
150
|
ul_api_utils/validators/__tests__/test_custom_fields.py,sha256=20gLlnm1Ithsbbz3NIUXVAd92lW6YwVRSg_nETZhfaI,1442
|
|
151
|
-
ul_api_utils-8.1.
|
|
152
|
-
ul_api_utils-8.1.
|
|
153
|
-
ul_api_utils-8.1.
|
|
154
|
-
ul_api_utils-8.1.
|
|
155
|
-
ul_api_utils-8.1.
|
|
156
|
-
ul_api_utils-8.1.
|
|
151
|
+
ul_api_utils-8.1.19.dist-info/LICENSE,sha256=6Qo8OdcqI8aGrswJKJYhST-bYqxVQBQ3ujKdTSdq-80,1062
|
|
152
|
+
ul_api_utils-8.1.19.dist-info/METADATA,sha256=RsXe4E1R3Qr06uA63N8eJHskl8oYXUv5SYUzQ-D4Kyw,14748
|
|
153
|
+
ul_api_utils-8.1.19.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
154
|
+
ul_api_utils-8.1.19.dist-info/entry_points.txt,sha256=8tL3ySHWTyJMuV1hx1fHfN8zumDVOCOm63w3StphkXg,53
|
|
155
|
+
ul_api_utils-8.1.19.dist-info/top_level.txt,sha256=1XsW8iOSFaH4LOzDcnNyxHpHrbKU3fSn-aIAxe04jmw,21
|
|
156
|
+
ul_api_utils-8.1.19.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|