tracktolib 0.43.1__py3-none-any.whl → 0.44.0__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.
tracktolib/api.py CHANGED
@@ -19,13 +19,13 @@ from typing import (
19
19
  get_origin,
20
20
  )
21
21
 
22
- from .utils import json_serial, to_camel_case
22
+ from .utils import json_serial
23
23
 
24
24
  try:
25
25
  from fastapi import params, APIRouter
26
26
  from fastapi.responses import JSONResponse
27
- import pydantic
28
- from pydantic import BaseModel
27
+ from pydantic.alias_generators import to_camel
28
+ from pydantic import BaseModel, ConfigDict
29
29
  import starlette.status
30
30
  except ImportError:
31
31
  raise ImportError('Please install fastapi, pydantic or tracktolib with "api" to use this module')
@@ -266,18 +266,8 @@ def model_to_list(string: str) -> str:
266
266
  return f"Array[{string}]"
267
267
 
268
268
 
269
- if pydantic.__version__ < "2.0.0":
270
-
271
- class CamelCaseModel(BaseModel): # type: ignore
272
- class Config:
273
- alias_generator = to_camel_case
274
- allow_population_by_field_name = True
275
-
276
- else:
277
-
278
- class CamelCaseModel(BaseModel):
279
- def __init__(self):
280
- raise NotImplementedError("Please use pydantic < 2.0.0")
269
+ class CamelCaseModel(BaseModel):
270
+ model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
281
271
 
282
272
 
283
273
  def check_status(resp, status: int = starlette.status.HTTP_200_OK):
tracktolib/utils.py CHANGED
@@ -1,4 +1,6 @@
1
+ import asyncio
1
2
  import datetime as dt
3
+ import importlib.util
2
4
  import itertools
3
5
  import mmap
4
6
  import os
@@ -7,8 +9,6 @@ from decimal import Decimal
7
9
  from ipaddress import IPv4Address, IPv6Address
8
10
  from pathlib import Path
9
11
  from typing import Iterable, TypeVar, Iterator, Literal, overload, Any
10
- import importlib.util
11
- import asyncio
12
12
 
13
13
  T = TypeVar("T")
14
14
 
@@ -85,6 +85,8 @@ def json_serial(obj):
85
85
  return str(obj)
86
86
  if isinstance(obj, Decimal):
87
87
  return str(obj)
88
+ if hasattr(obj, "__dict__"):
89
+ return obj.__dict__
88
90
  raise TypeError(f"Type '{type(obj)}' not serializable")
89
91
 
90
92
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tracktolib
3
- Version: 0.43.1
3
+ Version: 0.44.0
4
4
  Summary: Utility library for python
5
5
  Home-page: https://github.com/tracktor/tracktolib
6
6
  License: MIT
@@ -21,14 +21,14 @@ Provides-Extra: pg-sync
21
21
  Provides-Extra: s3
22
22
  Provides-Extra: s3-minio
23
23
  Provides-Extra: tests
24
- Requires-Dist: aiobotocore (>=2.6.0); extra == "s3"
24
+ Requires-Dist: aiobotocore (>=2.9.0); extra == "s3"
25
25
  Requires-Dist: asyncpg (>=0.27.0); extra == "pg"
26
26
  Requires-Dist: deepdiff (>=6.6.0); extra == "tests"
27
27
  Requires-Dist: fastapi (>=0.103.2); extra == "api"
28
28
  Requires-Dist: httpx (>=0.25.0); extra == "http"
29
- Requires-Dist: minio (>=7.1.17); extra == "s3-minio"
29
+ Requires-Dist: minio (>=7.2.0); extra == "s3-minio"
30
30
  Requires-Dist: psycopg (>=3.1.12); extra == "pg-sync"
31
- Requires-Dist: pydantic (>=1.10.12); extra == "api"
31
+ Requires-Dist: pydantic (>=2); extra == "api"
32
32
  Requires-Dist: python-json-logger (>=2.0.4); extra == "logs"
33
33
  Requires-Dist: rich (>=13.6.0); extra == "pg"
34
34
  Project-URL: Repository, https://github.com/tracktor/tracktolib
@@ -1,6 +1,6 @@
1
1
  LICENSE,sha256=uUanH0X7SeZEPdsRTHegMSMTiIHMurt9H0jSwEwKE1Y,1081
2
2
  tracktolib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- tracktolib/api.py,sha256=Xfy4iPjvUtvylbOLHEPGcOgMeyc2bF2HeWHoGc4Wb3g,8126
3
+ tracktolib/api.py,sha256=3gYiJbYevXaZppoxKaxEJnxBrKGSGKS1b52FgjquxbM,7919
4
4
  tracktolib/http_utils.py,sha256=dqjRJTNCo1qDnvQBTcImw1ibi1LnqETrpWDAU5txBHs,2633
5
5
  tracktolib/logs.py,sha256=enezPjBU4v2s8knG_V6kIbQsoyxfNIKEpKVSSkr_2U8,2212
6
6
  tracktolib/pg/__init__.py,sha256=32kKBJzIDyppszZMAOSMgM3ggz7Ow0TaNKiMs740gyw,333
@@ -12,8 +12,8 @@ tracktolib/s3/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  tracktolib/s3/minio.py,sha256=JaRpHOM6NqpMieplp58Fpc7uTh7PItyP8On7jMXhB-Q,1234
13
13
  tracktolib/s3/s3.py,sha256=0aPUo3Vnfy5Rk_Qp_y0KkCZa2kuMWw2JU2xrodn7oAE,3486
14
14
  tracktolib/tests.py,sha256=FS0uae3ShiiJOD7WE2WEv9h3QwRJCbLDHpe_8Ikc0j0,554
15
- tracktolib/utils.py,sha256=UqloaVRxTMlm5X2QrwI9O4sLM_RstvWqB0Zb31oAwpE,4825
16
- tracktolib-0.43.1.dist-info/LICENSE,sha256=uUanH0X7SeZEPdsRTHegMSMTiIHMurt9H0jSwEwKE1Y,1081
17
- tracktolib-0.43.1.dist-info/WHEEL,sha256=vxFmldFsRN_Hx10GDvsdv1wroKq8r5Lzvjp6GZ4OO8c,88
18
- tracktolib-0.43.1.dist-info/METADATA,sha256=K4uZJinMv8tdammptWehrZ5S9vkeiUwMvgu506rNiaw,3617
19
- tracktolib-0.43.1.dist-info/RECORD,,
15
+ tracktolib/utils.py,sha256=xpccH0xx_bH_am6F8kWT8mMiNuv9W6nmsewSwFbmBmY,4886
16
+ tracktolib-0.44.0.dist-info/LICENSE,sha256=uUanH0X7SeZEPdsRTHegMSMTiIHMurt9H0jSwEwKE1Y,1081
17
+ tracktolib-0.44.0.dist-info/WHEEL,sha256=vxFmldFsRN_Hx10GDvsdv1wroKq8r5Lzvjp6GZ4OO8c,88
18
+ tracktolib-0.44.0.dist-info/METADATA,sha256=oZOO7ii9NZ8bBC6V0_r3xl3Z1IqfMMgin4XkagZqseg,3610
19
+ tracktolib-0.44.0.dist-info/RECORD,,