ul-api-utils 8.0.2__py3-none-any.whl → 8.0.3__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.

@@ -43,6 +43,7 @@ class ApiRequestQuery(BaseModel):
43
43
  page: Optional[int] = None
44
44
 
45
45
  @model_validator(mode="before")
46
+ @classmethod
46
47
  def validate_empty_values(cls, values: Dict[str, Any]) -> Dict[str, Any]:
47
48
  vals = dict()
48
49
  for k, v in values.items():
@@ -4,7 +4,7 @@ from types import NoneType
4
4
  from typing import TypeVar, Generic, List, Optional, Dict, Any, Callable, Union, BinaryIO, Tuple, Type
5
5
  import msgpack
6
6
  from flask import jsonify, send_file, redirect, Response, request
7
- from pydantic import ConfigDict
7
+ from pydantic import ConfigDict, RootModel
8
8
  from pydantic import BaseModel
9
9
  from werkzeug import Response as BaseResponse
10
10
 
@@ -153,8 +153,8 @@ TPayloadTotalUnion = Union[
153
153
  ]
154
154
 
155
155
 
156
- class DictJsonApiResponsePayload(JsonApiResponsePayload):
157
- __root__: Dict[str, Any]
156
+ class DictJsonApiResponsePayload(RootModel[Dict[str, Any]]):
157
+ pass
158
158
 
159
159
 
160
160
  TProxyPayload = TypeVar('TProxyPayload', bound=Union[JsonApiResponsePayload, List[JsonApiResponsePayload], None])
@@ -1,87 +1,23 @@
1
1
  import csv
2
2
  from typing import TypeVar, Generic, List, Union, Generator, Callable, Annotated, Any
3
3
 
4
- from pydantic import ValidationError, Field, BaseModel, \
5
- StringConstraints
4
+ from pydantic import ValidationError, Field, StringConstraints
6
5
  from pydantic.v1.fields import ModelField
7
6
 
8
7
  from ul_api_utils.const import CRON_EXPRESSION_VALIDATION_REGEX, MIN_UTC_OFFSET_SECONDS, MAX_UTC_OFFSET_SECONDS
9
8
 
10
9
  NotEmptyListAnnotation = Annotated[list[Any], Field(min_length=1)]
11
-
12
- class NotEmptyList(BaseModel):
13
- """Type that can be used in pydantic field, that will validate empty lists."""
14
- not_empty_list: NotEmptyListAnnotation
15
-
16
-
17
10
  CronScheduleAnnotation = Annotated[str, StringConstraints(pattern=CRON_EXPRESSION_VALIDATION_REGEX)]
18
-
19
- class CronScheduleStr(BaseModel):
20
- """Type that can be used in pydantic field, that will validate cron-formatted strings."""
21
- cron_schedule_str: CronScheduleAnnotation
22
-
23
-
24
11
  WhiteSpaceStrippedStrAnnotation = Annotated[str, StringConstraints(strip_whitespace=True)]
25
-
26
- class WhiteSpaceStrippedStr(BaseModel):
27
- """Type that can be used in pydantic field, that will strip whitespaces strings."""
28
- white_space_stripped_str: WhiteSpaceStrippedStrAnnotation
29
-
30
-
31
12
  UTCOffsetSecondsAnnotation = Annotated[int, Field(ge=MIN_UTC_OFFSET_SECONDS, le=MAX_UTC_OFFSET_SECONDS)]
32
-
33
- class UTCOffsetSeconds(BaseModel):
34
- """Type that can be used for pydantic fields to represent the offset from UTC."""
35
- utc_offset: UTCOffsetSecondsAnnotation
36
-
37
13
  PgTypePasswordStrAnnotation = Annotated[str, StringConstraints(min_length=6, max_length=72)]
38
-
39
- class PgTypePasswordStr(BaseModel):
40
- """Type that can be used for pydantic fields to represent password with length from 6 to 72 characters."""
41
- pg_type_password_str: PgTypePasswordStrAnnotation
42
-
43
-
44
14
  PgTypeShortStrAnnotation = Annotated[str, StringConstraints(min_length=0, max_length=255)]
45
-
46
- class PgTypeShortStr(BaseModel):
47
- """Type that can be used for pydantic fields to represent short string with length from 0 to 255 characters."""
48
- pg_type_short_str: PgTypeShortStrAnnotation
49
-
50
-
51
15
  PgTypeLongStrAnnotation = Annotated[str, StringConstraints(min_length=0, max_length=1000)]
52
-
53
- class PgTypeLongStr(BaseModel):
54
- """Type that can be used for pydantic fields to represent short string with length from 0 to 1000 characters."""
55
- pg_type_long_str: PgTypeLongStrAnnotation
56
-
57
-
58
16
  PgTypeInt32Annotation = Annotated[int, Field(ge=-2147483648, le=2147483648)]
59
-
60
- class PgTypeInt32(BaseModel):
61
- """Type that can be used for pydantic fields to represent int32 number."""
62
- pg_type_int32: PgTypeInt32Annotation
63
-
64
-
65
17
  PgTypePositiveInt32Annotation = Annotated[int, Field(ge=0, le=2147483648)]
66
-
67
- class PgTypePositiveInt32(BaseModel):
68
- """Type that can be used for pydantic fields to represent positive int32 number."""
69
- pg_type_positive_int32: PgTypePositiveInt32Annotation
70
-
71
-
72
18
  PgTypeInt16Annotation = Annotated[int, Field(ge=-32768, le=32768)]
73
-
74
- class PgTypeInt16(BaseModel):
75
- """Type that can be used for pydantic fields to represent int16 (SMALLINT) number."""
76
- pg_type_int16: PgTypeInt16Annotation
77
-
78
-
79
19
  PgTypePositiveInt16Annotation = Annotated[int, Field(ge=0, le=32768)]
80
20
 
81
- class PgTypePositiveInt16(BaseModel):
82
- """Type that can be used for pydantic fields to represent positive int16 (SMALLINT) number."""
83
- pg_type_positive_int16_annotation: PgTypePositiveInt16Annotation
84
-
85
21
 
86
22
  QueryParamsSeparatedListValueType = TypeVar('QueryParamsSeparatedListValueType')
87
23
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ul-api-utils
3
- Version: 8.0.2
3
+ Version: 8.0.3
4
4
  Summary: Python api utils
5
5
  Author: Unic-lab
6
6
  Author-email:
@@ -25,13 +25,13 @@ ul_api_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  ul_api_utils/sentry.py,sha256=UH_SwZCAoKH-Nw5B9CVQMoF-b1BJOp-ZTzwqUZ3Oq84,1801
26
26
  ul_api_utils/access/__init__.py,sha256=NUyRNvCVwfePrfdn5ATFVfHeSO3iq4-Syeup4IAZGzs,4526
27
27
  ul_api_utils/api_resource/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
- ul_api_utils/api_resource/api_request.py,sha256=shKTSI3SdyJl1i7nGouflMW4Qtf67OIlKUf4icZfm8Q,3286
28
+ ul_api_utils/api_resource/api_request.py,sha256=6Ag2trKIkenhYYPU2--hnfNJC5lLgBxVQ7jXj5D1eXM,3303
29
29
  ul_api_utils/api_resource/api_resource.py,sha256=j-E8KJiXWS1L0oVIerJZlbGpDL2ijlQrck4GrJPWPyE,17840
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
32
  ul_api_utils/api_resource/api_resource_fn_typing.py,sha256=mKaeGzkOJ-FyDM6B55isUnr8sFsgSHeILQkxJd_tpI8,18343
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=I3J8qyiegFxwZNnVe2LJyWTXEtux0wwzd8EGT69aO_o,9701
34
+ ul_api_utils/api_resource/api_response.py,sha256=l3sQ34DkybP8nQWW8DSQulihfrB0Ai0RBaCrVZAHeSk,9695
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=53dYTvKS2mCIgE3DvGcMUrpFIM1007s_d1mslj0gLDk,559
37
37
  ul_api_utils/api_resource/db_types.py,sha256=LFw7mnzY4e6WuEYkUzPSgs6b-aw2vnRSqYsJMEMWUhA,436
@@ -143,14 +143,14 @@ ul_api_utils/utils/memory_db/errors.py,sha256=Bw1O1Y_WTCeCRNgb9iwrGT1fst6iHORhrN
143
143
  ul_api_utils/utils/memory_db/repository.py,sha256=xOnxEJyApGTglqjQ5fPKcEV5rHEkvKwcgrUfW4zJbHg,3754
144
144
  ul_api_utils/utils/memory_db/__tests__/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
145
145
  ul_api_utils/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
146
- ul_api_utils/validators/custom_fields.py,sha256=nb9ElW4XauSSxj6XHvHaCnplU7IHXhMdT4bYa3P7-hc,5027
146
+ ul_api_utils/validators/custom_fields.py,sha256=zjusHZ4mOCAmn5MSRGnHkKkexw4r7x0vt5e4dQJctgg,3001
147
147
  ul_api_utils/validators/validate_empty_object.py,sha256=3Ck_iwyJE_M5e7l6s1i88aqb73zIt06uaLrMG2PAb0A,299
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=QLZ7DFta01Z7DOK9Z5Iq4uf_CmvDkVReis-GAl_QN48,1447
151
- ul_api_utils-8.0.2.dist-info/LICENSE,sha256=6Qo8OdcqI8aGrswJKJYhST-bYqxVQBQ3ujKdTSdq-80,1062
152
- ul_api_utils-8.0.2.dist-info/METADATA,sha256=niCxGm0OM5O03QxcYVgWvvPR0zrTDqw2tQf9uUPAJ9U,14744
153
- ul_api_utils-8.0.2.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
154
- ul_api_utils-8.0.2.dist-info/entry_points.txt,sha256=8tL3ySHWTyJMuV1hx1fHfN8zumDVOCOm63w3StphkXg,53
155
- ul_api_utils-8.0.2.dist-info/top_level.txt,sha256=1XsW8iOSFaH4LOzDcnNyxHpHrbKU3fSn-aIAxe04jmw,21
156
- ul_api_utils-8.0.2.dist-info/RECORD,,
151
+ ul_api_utils-8.0.3.dist-info/LICENSE,sha256=6Qo8OdcqI8aGrswJKJYhST-bYqxVQBQ3ujKdTSdq-80,1062
152
+ ul_api_utils-8.0.3.dist-info/METADATA,sha256=gz25UoxRnq-cCOyZQ5qBxrwc8-OQ0MY2RsXr9xE3dYM,14744
153
+ ul_api_utils-8.0.3.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
154
+ ul_api_utils-8.0.3.dist-info/entry_points.txt,sha256=8tL3ySHWTyJMuV1hx1fHfN8zumDVOCOm63w3StphkXg,53
155
+ ul_api_utils-8.0.3.dist-info/top_level.txt,sha256=1XsW8iOSFaH4LOzDcnNyxHpHrbKU3fSn-aIAxe04jmw,21
156
+ ul_api_utils-8.0.3.dist-info/RECORD,,