python-datamodel 0.10.1__cp313-cp313-win32.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.
- datamodel/__init__.py +13 -0
- datamodel/abstract.py +383 -0
- datamodel/adaptive/__init__.py +0 -0
- datamodel/adaptive/models.py +598 -0
- datamodel/aliases/__init__.py +26 -0
- datamodel/base.py +180 -0
- datamodel/converters.c +43471 -0
- datamodel/converters.cp313-win32.pyd +0 -0
- datamodel/converters.html +17387 -0
- datamodel/converters.pyx +1489 -0
- datamodel/exceptions.c +13455 -0
- datamodel/exceptions.cp313-win32.pyd +0 -0
- datamodel/exceptions.html +1261 -0
- datamodel/exceptions.pxd +13 -0
- datamodel/exceptions.pyx +50 -0
- datamodel/fields.cp313-win32.pyd +0 -0
- datamodel/fields.cpp +17401 -0
- datamodel/fields.html +3912 -0
- datamodel/fields.pyx +309 -0
- datamodel/functions.cp313-win32.pyd +0 -0
- datamodel/functions.cpp +9068 -0
- datamodel/functions.html +1766 -0
- datamodel/functions.pxd +9 -0
- datamodel/functions.pyx +82 -0
- datamodel/jsonld/__init__.py +45 -0
- datamodel/jsonld/models.py +500 -0
- datamodel/libs/__init__.py +1 -0
- datamodel/libs/mapping.c +15067 -0
- datamodel/libs/mapping.cp313-win32.pyd +0 -0
- datamodel/libs/mapping.html +2618 -0
- datamodel/libs/mapping.pxd +11 -0
- datamodel/libs/mapping.pyx +135 -0
- datamodel/libs/mutables.py +127 -0
- datamodel/models.py +814 -0
- datamodel/parsers/__init__.py +0 -0
- datamodel/parsers/encoders.py +15 -0
- datamodel/parsers/json.cp313-win32.pyd +0 -0
- datamodel/parsers/json.cpp +17004 -0
- datamodel/parsers/json.html +3365 -0
- datamodel/parsers/json.pyx +250 -0
- datamodel/profiler.py +21 -0
- datamodel/py.typed +0 -0
- datamodel/rs_core/Cargo.toml +17 -0
- datamodel/rs_core/src/lib.rs +294 -0
- datamodel/rs_parsers/Cargo.toml +22 -0
- datamodel/rs_parsers/src/lib.rs +571 -0
- datamodel/rs_parsers.cp313-win32.pyd +0 -0
- datamodel/rs_validators/Cargo.toml +17 -0
- datamodel/rs_validators/src/lib.rs +0 -0
- datamodel/typedefs/__init__.py +9 -0
- datamodel/typedefs/singleton.c +9169 -0
- datamodel/typedefs/singleton.cp313-win32.pyd +0 -0
- datamodel/typedefs/singleton.html +629 -0
- datamodel/typedefs/singleton.pxd +9 -0
- datamodel/typedefs/singleton.pyx +24 -0
- datamodel/typedefs/types.c +11716 -0
- datamodel/typedefs/types.cp313-win32.pyd +0 -0
- datamodel/typedefs/types.html +732 -0
- datamodel/typedefs/types.pxd +11 -0
- datamodel/typedefs/types.pyx +39 -0
- datamodel/types.c +7165 -0
- datamodel/types.cp313-win32.pyd +0 -0
- datamodel/types.html +716 -0
- datamodel/types.pyx +100 -0
- datamodel/validation.cp313-win32.pyd +0 -0
- datamodel/validation.cpp +17085 -0
- datamodel/validation.html +4769 -0
- datamodel/validation.pyx +315 -0
- datamodel/version.py +13 -0
- examples/nn/examples.py +311 -0
- examples/nn/stores.py +151 -0
- examples/tests/sp_types.py +294 -0
- examples/tests/speed_dates.py +26 -0
- python_datamodel-0.10.1.dist-info/LICENSE +29 -0
- python_datamodel-0.10.1.dist-info/METADATA +320 -0
- python_datamodel-0.10.1.dist-info/RECORD +78 -0
- python_datamodel-0.10.1.dist-info/WHEEL +5 -0
- python_datamodel-0.10.1.dist-info/top_level.txt +7 -0
datamodel/exceptions.pxd
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# cython: language_level=3, embedsignature=True, boundscheck=False, wraparound=True, initializedcheck=False
|
|
2
|
+
# Copyright (C) 2018-present Jesus Lara
|
|
3
|
+
#
|
|
4
|
+
"""DataModel Exceptions."""
|
|
5
|
+
cdef class ModelException(Exception):
|
|
6
|
+
"""Base class for other exceptions"""
|
|
7
|
+
|
|
8
|
+
## Other Errors:
|
|
9
|
+
cdef class ValidationError(ModelException):
|
|
10
|
+
pass
|
|
11
|
+
|
|
12
|
+
cdef class ParserError(ModelException):
|
|
13
|
+
pass
|
datamodel/exceptions.pyx
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# cython: language_level=3, embedsignature=True, boundscheck=False, wraparound=True, initializedcheck=False
|
|
2
|
+
# Copyright (C) 2018-present Jesus Lara
|
|
3
|
+
#
|
|
4
|
+
cdef class ModelException(Exception):
|
|
5
|
+
"""Base class for other Data-Model exceptions"""
|
|
6
|
+
|
|
7
|
+
def __init__(self, str message, **kwargs):
|
|
8
|
+
super().__init__(message)
|
|
9
|
+
self.stacktrace = None
|
|
10
|
+
if 'stacktrace' in kwargs:
|
|
11
|
+
self.stacktrace = kwargs['stacktrace']
|
|
12
|
+
self.message = message
|
|
13
|
+
self.args = kwargs
|
|
14
|
+
|
|
15
|
+
def __repr__(self):
|
|
16
|
+
return f"{self.message}"
|
|
17
|
+
|
|
18
|
+
def __str__(self):
|
|
19
|
+
return f"{self.message!s}"
|
|
20
|
+
|
|
21
|
+
def get(self):
|
|
22
|
+
return self.message
|
|
23
|
+
|
|
24
|
+
cdef class ValidationError(ModelException):
|
|
25
|
+
"""Validation Error."""
|
|
26
|
+
def __init__(self, str message, dict payload = None):
|
|
27
|
+
super().__init__(message)
|
|
28
|
+
self.payload = payload or {}
|
|
29
|
+
|
|
30
|
+
def __str__(self):
|
|
31
|
+
base = super().__str__()
|
|
32
|
+
if self.payload:
|
|
33
|
+
# collect the keys that had errors
|
|
34
|
+
field_names = ", ".join(self.payload.keys())
|
|
35
|
+
# attach them to the base message so we see them in the final str
|
|
36
|
+
return f"{base} (Fields with errors: {field_names})"
|
|
37
|
+
else:
|
|
38
|
+
return base
|
|
39
|
+
|
|
40
|
+
cdef class ParsingError(ModelException):
|
|
41
|
+
"""Parsing Error."""
|
|
42
|
+
def __init__(self, str message):
|
|
43
|
+
message = f'Parsing Error: {message}'
|
|
44
|
+
super().__init__(message)
|
|
45
|
+
|
|
46
|
+
cdef class ParserError(ModelException):
|
|
47
|
+
"""Parsing Error."""
|
|
48
|
+
def __init__(self, str message):
|
|
49
|
+
message = f'Parsing Error: {message}'
|
|
50
|
+
super().__init__(message)
|
|
Binary file
|