crypticorn 2.2.0__py3-none-any.whl → 2.2.1__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.
@@ -0,0 +1,32 @@
1
+ from typing import Optional, Type, Any, Tuple
2
+ from copy import deepcopy
3
+
4
+ from pydantic import BaseModel, create_model
5
+ from pydantic.fields import FieldInfo
6
+
7
+
8
+ def partial_model(model: Type[BaseModel]) -> Type[BaseModel]:
9
+ '''Marks all fields of a model as optional. Useful for updating models.
10
+
11
+ >>> @partial_model
12
+ >>> class Model(BaseModel):
13
+ >>> i: int
14
+ >>> f: float
15
+ >>> s: str
16
+
17
+ >>> Model(i=1)
18
+ '''
19
+ def make_field_optional(field: FieldInfo, default: Any = None) -> Tuple[Any, FieldInfo]:
20
+ new = deepcopy(field)
21
+ new.default = default
22
+ new.annotation = Optional[field.annotation] # type: ignore
23
+ return new.annotation, new
24
+ return create_model(
25
+ f'Partial{model.__name__}',
26
+ __base__=model,
27
+ __module__=model.__module__,
28
+ **{
29
+ field_name: make_field_optional(field_info)
30
+ for field_name, field_info in model.model_fields.items()
31
+ }
32
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crypticorn
3
- Version: 2.2.0
3
+ Version: 2.2.1
4
4
  Summary: Maximise Your Crypto Trading Profits with AI Predictions
5
5
  Author-email: Crypticorn <timon@crypticorn.com>
6
6
  Project-URL: Homepage, https://crypticorn.com
@@ -57,6 +57,7 @@ crypticorn/auth/client/models/whoami200_response.py,sha256=uehdq5epgeOphhrIR3tbr
57
57
  crypticorn/common/__init__.py,sha256=8QvHfHNl5CsTOuNBag9fXZ6PZdfyAveIBeVL_37Db1U,151
58
58
  crypticorn/common/auth.py,sha256=NZMM0zGCgMn0lBV71EZ428it9tGdnPnTUHKthPx4kyg,7482
59
59
  crypticorn/common/errors.py,sha256=Yd3zLtrqCe0NvjfqxIHohT48T4yfSi-V4s_WyYAi8t4,12614
60
+ crypticorn/common/pydantic.py,sha256=v99oUUxyYWCBr8wi6Icj9TdJe_HhjrpX44nm18GNKzI,974
60
61
  crypticorn/common/scopes.py,sha256=-dkEjY2AVAjdub4zLMy6IFltzii_Ll0NBaSWtI7w4BU,1419
61
62
  crypticorn/common/sorter.py,sha256=DPkQmxDeuti4onCiE8IJZUkTc5WZp1j4dIIc7wN9En0,1167
62
63
  crypticorn/common/urls.py,sha256=twMpsXnGZhxa4-sV8Pmt4n0VUzVd_xUNiyGD2BckFKM,803
@@ -259,7 +260,7 @@ crypticorn/trade/client/models/tpsl.py,sha256=QGPhcgadjxAgyzpRSwlZJg_CDLnKxdZgse
259
260
  crypticorn/trade/client/models/trading_action_type.py,sha256=jW0OsNz_ZNXlITxAfh979BH5U12oTXSr6qUVcKcGHhw,847
260
261
  crypticorn/trade/client/models/validation_error.py,sha256=uTkvsKrOAt-21UC0YPqCdRl_OMsuu7uhPtWuwRSYvv0,3228
261
262
  crypticorn/trade/client/models/validation_error_loc_inner.py,sha256=22ql-H829xTBgfxNQZsqd8fS3zQt9tLW1pj0iobo0jY,5131
262
- crypticorn-2.2.0.dist-info/METADATA,sha256=aLpVj-g7X_LrGymsLqnbiByREFUDLZsHSScoeo2djPk,5393
263
- crypticorn-2.2.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
264
- crypticorn-2.2.0.dist-info/top_level.txt,sha256=EP3NY216qIBYfmvGl0L2Zc9ItP0DjGSkiYqd9xJwGcM,11
265
- crypticorn-2.2.0.dist-info/RECORD,,
263
+ crypticorn-2.2.1.dist-info/METADATA,sha256=rztkcNNRcv4USnjntyA6RhGLsvkG2pceZ97QxcUxY_Q,5393
264
+ crypticorn-2.2.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
265
+ crypticorn-2.2.1.dist-info/top_level.txt,sha256=EP3NY216qIBYfmvGl0L2Zc9ItP0DjGSkiYqd9xJwGcM,11
266
+ crypticorn-2.2.1.dist-info/RECORD,,