apytizer 0.0.1a0__py3-none-any.whl → 0.0.1b1__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.
- apytizer/__init__.py +2 -12
- apytizer/adapters/__init__.py +2 -3
- apytizer/adapters/transport_adapter.py +91 -0
- apytizer/apis/__init__.py +6 -0
- apytizer/apis/abstract_api.py +36 -0
- apytizer/apis/web_api.py +461 -0
- apytizer/connections/__init__.py +6 -0
- apytizer/connections/abstract_connection.py +28 -0
- apytizer/connections/http_connection.py +431 -0
- apytizer/decorators/__init__.py +5 -5
- apytizer/decorators/caching.py +60 -9
- apytizer/decorators/chunking.py +105 -0
- apytizer/decorators/connection.py +55 -20
- apytizer/decorators/json_response.py +93 -0
- apytizer/decorators/pagination.py +50 -32
- apytizer/endpoints/__init__.py +6 -0
- apytizer/endpoints/abstract_endpoint.py +38 -0
- apytizer/endpoints/web_endpoint.py +519 -0
- apytizer/engines/__init__.py +6 -0
- apytizer/engines/abstract_engine.py +45 -0
- apytizer/engines/http_engine.py +129 -0
- apytizer/errors.py +34 -0
- apytizer/factories/__init__.py +5 -0
- apytizer/factories/abstract_factory.py +17 -0
- apytizer/http_methods.py +34 -0
- apytizer/managers/__init__.py +12 -0
- apytizer/managers/abstract_manager.py +80 -0
- apytizer/managers/base_manager.py +116 -0
- apytizer/mappers/__init__.py +6 -0
- apytizer/mappers/abstract_mapper.py +48 -0
- apytizer/mappers/base_mapper.py +78 -0
- apytizer/media_types.py +118 -0
- apytizer/models/__init__.py +6 -0
- apytizer/models/abstract_model.py +119 -0
- apytizer/models/base_model.py +85 -0
- apytizer/protocols.py +38 -0
- apytizer/repositories/__init__.py +6 -0
- apytizer/repositories/abstract_repository.py +81 -0
- apytizer/repositories/managed_repository.py +92 -0
- apytizer/routes/__init__.py +6 -0
- apytizer/routes/abstract_route.py +32 -0
- apytizer/routes/base_route.py +138 -0
- apytizer/sessions/__init__.py +33 -0
- apytizer/sessions/abstract_session.py +63 -0
- apytizer/sessions/requests_session.py +125 -0
- apytizer/states/__init__.py +6 -0
- apytizer/states/abstract_state.py +71 -0
- apytizer/states/local_state.py +99 -0
- apytizer/utils/__init__.py +9 -4
- apytizer/utils/caching.py +39 -0
- apytizer/utils/dictionaries.py +375 -0
- apytizer/utils/errors.py +104 -0
- apytizer/utils/iterables.py +91 -0
- apytizer/utils/objects.py +145 -0
- apytizer/utils/strings.py +69 -0
- apytizer/utils/typing.py +29 -0
- apytizer-0.0.1b1.dist-info/METADATA +41 -0
- apytizer-0.0.1b1.dist-info/RECORD +60 -0
- {apytizer-0.0.1a0.dist-info → apytizer-0.0.1b1.dist-info}/WHEEL +1 -2
- apytizer/abstracts/__init__.py +0 -8
- apytizer/abstracts/api.py +0 -147
- apytizer/abstracts/endpoint.py +0 -177
- apytizer/abstracts/model.py +0 -50
- apytizer/abstracts/session.py +0 -39
- apytizer/adapters/transport.py +0 -40
- apytizer/base/__init__.py +0 -8
- apytizer/base/api.py +0 -510
- apytizer/base/endpoint.py +0 -443
- apytizer/base/model.py +0 -119
- apytizer/decorators/json.py +0 -35
- apytizer/utils/generate_key.py +0 -18
- apytizer/utils/merge.py +0 -19
- apytizer-0.0.1a0.dist-info/METADATA +0 -27
- apytizer-0.0.1a0.dist-info/RECORD +0 -25
- apytizer-0.0.1a0.dist-info/top_level.txt +0 -1
- {apytizer-0.0.1a0.dist-info → apytizer-0.0.1b1.dist-info/licenses}/LICENSE +0 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# src/apytizer/utils/iterables.py
|
|
3
|
+
|
|
4
|
+
# Standard Library Imports
|
|
5
|
+
from typing import Any
|
|
6
|
+
from typing import List
|
|
7
|
+
from typing import SupportsIndex
|
|
8
|
+
|
|
9
|
+
# Local Imports
|
|
10
|
+
from .typing import allinstance
|
|
11
|
+
|
|
12
|
+
__all__ = ["deep_append", "deep_extend", "split_list"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def deep_append(
|
|
16
|
+
__obj: List[List[Any]], __index: SupportsIndex, __item: Any, /
|
|
17
|
+
) -> List[List[Any]]:
|
|
18
|
+
"""Appends value to a list within an iterable object.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
__obj: Iterable object.
|
|
22
|
+
__index: Index at which to append item.
|
|
23
|
+
__item: Item to append to nested list.
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
Updated iterable object.
|
|
27
|
+
|
|
28
|
+
Raises:
|
|
29
|
+
TypeError: when argument does not support indexing.
|
|
30
|
+
|
|
31
|
+
"""
|
|
32
|
+
if not isinstance(__obj, list): # type: ignore
|
|
33
|
+
message = f"expected type 'list', got {type(__obj)} instead"
|
|
34
|
+
raise TypeError(message)
|
|
35
|
+
|
|
36
|
+
if not allinstance(__obj, list):
|
|
37
|
+
raise ValueError("must contain only lists")
|
|
38
|
+
|
|
39
|
+
target: List[Any] = __obj[__index]
|
|
40
|
+
target.append(__item)
|
|
41
|
+
return __obj
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def deep_extend(
|
|
45
|
+
__obj: List[List[Any]],
|
|
46
|
+
__index: SupportsIndex,
|
|
47
|
+
__items: List[Any],
|
|
48
|
+
/,
|
|
49
|
+
) -> List[List[Any]]:
|
|
50
|
+
"""Extends list within nested iterable object with provided values.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
__obj: Iterable object.
|
|
54
|
+
__index: Index at which to extend list.
|
|
55
|
+
__items: Items with which to extend nested list.
|
|
56
|
+
|
|
57
|
+
Returns:
|
|
58
|
+
Updated iterable object.
|
|
59
|
+
|
|
60
|
+
Raises:
|
|
61
|
+
TypeError: when argument does not support indexing.
|
|
62
|
+
|
|
63
|
+
"""
|
|
64
|
+
if not isinstance(__obj, list): # type: ignore
|
|
65
|
+
message = f"expected type 'list', got {type(__obj)} instead"
|
|
66
|
+
raise TypeError(message)
|
|
67
|
+
|
|
68
|
+
if not allinstance(__obj, list):
|
|
69
|
+
raise ValueError("iterable object must contain only lists")
|
|
70
|
+
|
|
71
|
+
target: List[Any] = __obj[__index]
|
|
72
|
+
target.extend(__items)
|
|
73
|
+
return __obj
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def split_list(__lst: List[Any], /, size: int) -> List[List[Any]]:
|
|
77
|
+
"""Split list into multiple groups of the same size.
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
__lst: List to split into groups.
|
|
81
|
+
size: Maximum size of each group.
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
Groups.
|
|
85
|
+
|
|
86
|
+
.. _Based On:
|
|
87
|
+
https://stackoverflow.com/questions/2231663/slicing-a-list-into-a-list-of-sub-lists
|
|
88
|
+
|
|
89
|
+
"""
|
|
90
|
+
results = [__lst[i : i + size] for i in range(0, len(__lst), size)]
|
|
91
|
+
return results
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# src/apytizer/utils/objects.py
|
|
3
|
+
|
|
4
|
+
# Standard Library Imports
|
|
5
|
+
import collections
|
|
6
|
+
import functools
|
|
7
|
+
from typing import Any
|
|
8
|
+
from typing import Iterable
|
|
9
|
+
from typing import List
|
|
10
|
+
from typing import Optional
|
|
11
|
+
|
|
12
|
+
# Local Imports
|
|
13
|
+
from .typing import allinstance
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"deep_getattr",
|
|
17
|
+
"deep_setattr",
|
|
18
|
+
"getattrs",
|
|
19
|
+
"setattrs",
|
|
20
|
+
"iter_getattr",
|
|
21
|
+
"iter_setattr",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def deep_getattr(__o: object, __name: Iterable[str], /) -> Any:
|
|
26
|
+
"""Get value of attribute in nested object.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
__o: Object on which to get attribute.
|
|
30
|
+
__name: Name of attribute from which to get value.
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
Value of attribute in nested object.
|
|
34
|
+
|
|
35
|
+
"""
|
|
36
|
+
if not isinstance(__name, Iterable): # type: ignore
|
|
37
|
+
message = f"'{type(__name)}' object is not iterable"
|
|
38
|
+
raise TypeError(message)
|
|
39
|
+
|
|
40
|
+
attrs = __name.split(".") if isinstance(__name, str) else __name
|
|
41
|
+
result = functools.reduce(lambda acc, cur: getattr(acc, cur), attrs, __o)
|
|
42
|
+
return result
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def deep_setattr(__o: object, __name: str, __value: Any, /) -> None:
|
|
46
|
+
"""Sets attribute to value in nested object.
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
__o: Object on which to set attributes.
|
|
50
|
+
__name: Name of attribute to set on object.
|
|
51
|
+
__value: Value to set attribute on object.
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
Updated object.
|
|
55
|
+
|
|
56
|
+
"""
|
|
57
|
+
attrs = collections.deque(__name.split("."))
|
|
58
|
+
target = attrs.pop()
|
|
59
|
+
|
|
60
|
+
obj = functools.reduce(lambda acc, cur: getattr(acc, cur), attrs, __o)
|
|
61
|
+
setattr(obj, target, __value)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def getattrs(
|
|
65
|
+
__o: object, __names: List[str], __default: Optional[Any] = None, /
|
|
66
|
+
) -> List[Any]:
|
|
67
|
+
"""Get named attributes from an object.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
__o: Object from which to get attributes.
|
|
71
|
+
__names: Names of attributes to get from object.
|
|
72
|
+
__default (optional): Default value when attribute doesn't exist.
|
|
73
|
+
Default ``None``.
|
|
74
|
+
|
|
75
|
+
Returns:
|
|
76
|
+
Attributes.
|
|
77
|
+
|
|
78
|
+
"""
|
|
79
|
+
results = [getattr(__o, __name, __default) for __name in __names]
|
|
80
|
+
return results
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def setattrs(__o: object, __names: List[str], __values: List[Any], /) -> None:
|
|
84
|
+
"""Set named attributes on an object.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
__o: Object on which to set attributes.
|
|
88
|
+
__names: Names of attributes to set on object.
|
|
89
|
+
__values: Values to set for keys on object.
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
Updated object.
|
|
93
|
+
|
|
94
|
+
"""
|
|
95
|
+
for __name, __value in zip(__names, __values):
|
|
96
|
+
setattr(__o, __name, __value)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def iter_getattr(__iter: Iterable[object], __name: str, /) -> List[Any]:
|
|
100
|
+
"""Get a named attribute from each object.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
__iter: Iterable object containing objects.
|
|
104
|
+
__name: Attribute for which to retrieve value.
|
|
105
|
+
|
|
106
|
+
Raises:
|
|
107
|
+
TypeError: when argument is not an iterable object.
|
|
108
|
+
ValueError: when not all items are mappings.
|
|
109
|
+
|
|
110
|
+
"""
|
|
111
|
+
if not isinstance(__iter, Iterable): # type: ignore
|
|
112
|
+
raise TypeError("must be an iterable object")
|
|
113
|
+
|
|
114
|
+
if not allinstance(__iter, object):
|
|
115
|
+
raise ValueError("all items within iterator must be objects")
|
|
116
|
+
|
|
117
|
+
results = [getattr(item, __name) for item in __iter]
|
|
118
|
+
return results
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def iter_setattr(
|
|
122
|
+
__iter: Iterable[Any], __name: str, __value: Any, /
|
|
123
|
+
) -> Iterable[Any]:
|
|
124
|
+
"""Sets the named attribute to the specified value on each object.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
__iter: Iterable object containing objects.
|
|
128
|
+
__name: Attribute to set to value.
|
|
129
|
+
value: Value to which to set attribute.
|
|
130
|
+
|
|
131
|
+
Raises:
|
|
132
|
+
TypeError: when argument is not an iterable object.
|
|
133
|
+
ValueError: when not all items are objects.
|
|
134
|
+
|
|
135
|
+
"""
|
|
136
|
+
if not isinstance(__iter, Iterable): # type: ignore
|
|
137
|
+
raise TypeError("must be an iterable object")
|
|
138
|
+
|
|
139
|
+
if not allinstance(__iter, object):
|
|
140
|
+
raise ValueError("all items within iterator must be objects")
|
|
141
|
+
|
|
142
|
+
for item in __iter:
|
|
143
|
+
setattr(item, __name, __value)
|
|
144
|
+
|
|
145
|
+
return __iter
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# src/apytizer/utils/strings.py
|
|
3
|
+
|
|
4
|
+
# Standard Library Imports
|
|
5
|
+
import re
|
|
6
|
+
from typing import Any
|
|
7
|
+
from typing import Iterable
|
|
8
|
+
from typing import List
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"camel_to_snake",
|
|
12
|
+
"iter_format",
|
|
13
|
+
"syntactic_list",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def camel_to_snake(__s: str, /) -> str:
|
|
18
|
+
"""Convert camelcase string to snakecase.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
__s: Camelcase string to convert.
|
|
22
|
+
|
|
23
|
+
Returns:
|
|
24
|
+
Snakecase string.
|
|
25
|
+
|
|
26
|
+
.. _Based On:
|
|
27
|
+
https://stackoverflow.com/a/1176023.
|
|
28
|
+
|
|
29
|
+
"""
|
|
30
|
+
pattern = re.compile(r"(?<=[a-z0-9])(?=[A-Z][a-z]+)")
|
|
31
|
+
result = pattern.sub("_", __s).lower()
|
|
32
|
+
return result
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def iter_format(__iter: Iterable[Any], __format: str, /) -> List[str]:
|
|
36
|
+
"""Format each item in an iterable object.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
__iter: Iterable object containing items to format.
|
|
40
|
+
__format: String format to apply to each item.
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
Formatted items.
|
|
44
|
+
|
|
45
|
+
"""
|
|
46
|
+
result = [__format.format(item) for item in __iter]
|
|
47
|
+
return result
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def syntactic_list(
|
|
51
|
+
__l: List[str], /, conjunction: str, *, oxford: bool = False
|
|
52
|
+
) -> str:
|
|
53
|
+
"""Apply syntax to a list of strings.
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
__l: List of strings.
|
|
57
|
+
conjunction: Conjunction with which to join list.
|
|
58
|
+
oxford (optional): Whether to use an oxford comma. Default ``False``.
|
|
59
|
+
|
|
60
|
+
Returns:
|
|
61
|
+
Syntactically-correct list.
|
|
62
|
+
|
|
63
|
+
"""
|
|
64
|
+
if len(__l) < 2:
|
|
65
|
+
raise ValueError("list must contain at least two items")
|
|
66
|
+
|
|
67
|
+
separator = f"{',' if oxford else ''} {conjunction!s} "
|
|
68
|
+
result = separator.join([", ".join(__l[:-1]), __l[-1]])
|
|
69
|
+
return result
|
apytizer/utils/typing.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
# Standard Library Imports
|
|
4
|
+
from typing import Any
|
|
5
|
+
from typing import Iterable
|
|
6
|
+
from typing import Tuple
|
|
7
|
+
from typing import Type
|
|
8
|
+
from typing import Union
|
|
9
|
+
|
|
10
|
+
__all__ = ["allinstance"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def allinstance(
|
|
14
|
+
__objs: Iterable[Any],
|
|
15
|
+
__class_or_tuple: Union[Tuple[Type[Any], ...], type],
|
|
16
|
+
/,
|
|
17
|
+
) -> bool:
|
|
18
|
+
"""Whether all elements in an iterable object are instances of provided type(s).
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
__objs: Iterable object containing elements.
|
|
22
|
+
__class_or_tuple: Class or tuple of classes.
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
Whether all elements are instances of the provided type(s).
|
|
26
|
+
|
|
27
|
+
"""
|
|
28
|
+
result = all(isinstance(elem, __class_or_tuple) for elem in __objs)
|
|
29
|
+
return result
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: apytizer
|
|
3
|
+
Version: 0.0.1b1
|
|
4
|
+
Summary: Implement wrappers quickly for REST APIs.
|
|
5
|
+
Project-URL: Homepage, https://github.com/seanssullivan/apytizer
|
|
6
|
+
Project-URL: Repository, https://github.com/seanssullivan/apytizer.git
|
|
7
|
+
Project-URL: Issues, https://github.com/seanssullivan/apytizer/issues
|
|
8
|
+
Author-email: Sean Sullivan <seansullivan@seanmedia.ca>
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Natural Language :: English
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Requires-Dist: cachetools
|
|
25
|
+
Requires-Dist: requests
|
|
26
|
+
Provides-Extra: docs
|
|
27
|
+
Requires-Dist: sphinx>=2.0.0; extra == 'docs'
|
|
28
|
+
Provides-Extra: testing
|
|
29
|
+
Requires-Dist: cachetools; extra == 'testing'
|
|
30
|
+
Requires-Dist: coverage; extra == 'testing'
|
|
31
|
+
Requires-Dist: flask; extra == 'testing'
|
|
32
|
+
Requires-Dist: pytest; extra == 'testing'
|
|
33
|
+
Requires-Dist: pytest-cov; extra == 'testing'
|
|
34
|
+
Requires-Dist: pytest-env; extra == 'testing'
|
|
35
|
+
Requires-Dist: requests; extra == 'testing'
|
|
36
|
+
Requires-Dist: tox; extra == 'testing'
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
|
|
39
|
+
# apytizer
|
|
40
|
+
|
|
41
|
+
Implement wrappers quickly for REST APIs.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
apytizer/__init__.py,sha256=yzuWp_U0IBenCTMYUxVKBx_C8bsy6rUY15HGu0ylCsA,74
|
|
2
|
+
apytizer/errors.py,sha256=4GvnxBwo1hU98a8ZUBDfs3OYEeDN3kcZBlCTWjE1SSE,723
|
|
3
|
+
apytizer/http_methods.py,sha256=wMBhD20A8PDSXL2sxsS1oBMMCF0DthWVWkehAOOZ87A,744
|
|
4
|
+
apytizer/media_types.py,sha256=ptUcjYa1dLUGSHK__ETd55fi-kr9ZSglBtUAjlyJ8aw,3449
|
|
5
|
+
apytizer/protocols.py,sha256=NGhlpDC0BnCf58aydLjwWF4nUlYp_cRZaIAOcayS_ZQ,895
|
|
6
|
+
apytizer/adapters/__init__.py,sha256=G4T4wWieL9Wo4kgIvzroxFtnjYr14jxcWqFHrUNaTto,74
|
|
7
|
+
apytizer/adapters/transport_adapter.py,sha256=OH8DoE9h9PKn_yFOFjPZYGB5U_Pk1o1mFJGI7AnXpmk,2296
|
|
8
|
+
apytizer/apis/__init__.py,sha256=5t4pmOxHb6XmVvmo0ECyO84Ph7SR-uQyEImuzZgqNCs,124
|
|
9
|
+
apytizer/apis/abstract_api.py,sha256=lygtd3NgoLVYySCMlsvXSJiEErNe2eiV6HRyJ3FWRkY,826
|
|
10
|
+
apytizer/apis/web_api.py,sha256=_Fx4v2UtaqO5QyeO-D2DyFxeGbpkAjeeY0D1MgruXeI,12962
|
|
11
|
+
apytizer/connections/__init__.py,sha256=wsaRficrSp-A8gCpL8CdLCf84TtNLSmKJnfo8AgYzkM,146
|
|
12
|
+
apytizer/connections/abstract_connection.py,sha256=3Q0PAhWF1Fr_GQm-yOu2m85AWb0lCWkuDfMd3snhcHg,646
|
|
13
|
+
apytizer/connections/http_connection.py,sha256=3TFcsBj_0wOmeYa1XO2DfziPZUqRyZ4zxRH6ECz9UeE,12382
|
|
14
|
+
apytizer/decorators/__init__.py,sha256=QK7klt2x-RyU_NlRZjM7_7rvrSCjyLsTzaSbuY3pPjU,167
|
|
15
|
+
apytizer/decorators/caching.py,sha256=mSTKorQfHzikIFm2KPvDr6l_tscAKVmC2K-Mpx-7aZI,2019
|
|
16
|
+
apytizer/decorators/chunking.py,sha256=yWtXcUV2396M9iuCeNxttT3w9IEfEL7KTOhgaG-j3uE,2690
|
|
17
|
+
apytizer/decorators/connection.py,sha256=iTclb0UuL-FeIXAZqVgCpop-XUDMwyCjzVFqWSVsLKk,1824
|
|
18
|
+
apytizer/decorators/json_response.py,sha256=06ofbA9vHZ54UlPABN6J4ZTH6zn_sdsmrlf8rfbtksY,1978
|
|
19
|
+
apytizer/decorators/pagination.py,sha256=wsaVf7h1NOTeEAeku6zD-hXxP2NJrHIEZNVrRmb1GBc,1936
|
|
20
|
+
apytizer/endpoints/__init__.py,sha256=HurARzunajUhxmyz1vxP-EJLybWLMJJDnjougREhZsA,139
|
|
21
|
+
apytizer/endpoints/abstract_endpoint.py,sha256=ASHZEDBTgx8fLntN7B72dyQrMTGkVQ9xZNodM9H9z58,919
|
|
22
|
+
apytizer/endpoints/web_endpoint.py,sha256=ptDZZq0NHx0zYNOQvxl2lYoN6U1zDoYgFbrTOoEFRtQ,15458
|
|
23
|
+
apytizer/engines/__init__.py,sha256=dkLBf3nNRJ0OcGXYeue_FE6E7Y4nGGJposbjtdy-mA4,134
|
|
24
|
+
apytizer/engines/abstract_engine.py,sha256=aljh99PCbD7giAkWgU8vk_ytJOnb3dk3UnlBZyagdDQ,959
|
|
25
|
+
apytizer/engines/http_engine.py,sha256=qhntZf2-D6n_ZWAL-Km1djGS3_UrduvrRet6gjiAUG0,3517
|
|
26
|
+
apytizer/factories/__init__.py,sha256=tV2VW2H4Fo8TrVNDsD9J-1Kl4IxuIy3fwoLtI9AlfFY,110
|
|
27
|
+
apytizer/factories/abstract_factory.py,sha256=XtvofT5-v824RCnBvD1Rqy_-ylXTw3XXXf6l4yteW50,361
|
|
28
|
+
apytizer/managers/__init__.py,sha256=wNg4SB_it89QYXLBv7dTNVP1DjmNwWW4F1F6Redkwno,311
|
|
29
|
+
apytizer/managers/abstract_manager.py,sha256=AlQdaGj4SGxMZ46BZA5m8pYXA9zJI9EgvJAHeGYLBa0,2145
|
|
30
|
+
apytizer/managers/base_manager.py,sha256=UeZS739UK8C7-IDB_t4CYPbEpOSkGSGE_BygHcEDv1I,2786
|
|
31
|
+
apytizer/mappers/__init__.py,sha256=OGhBhWu34G8UZnmwCIxcRAkXnJKDbyxnTCgJvhKr8JM,122
|
|
32
|
+
apytizer/mappers/abstract_mapper.py,sha256=rqKzr4QcyFFrebPktvwuIGGI1RWq6ELoL344DgiOQyI,1113
|
|
33
|
+
apytizer/mappers/base_mapper.py,sha256=SOx1RuZufytD8y-NSuErp22sgDqBFVZXiyo2JAMGGL0,2154
|
|
34
|
+
apytizer/models/__init__.py,sha256=73LwJufUqhc_vwajlWIqSPxmOam9qj6hY-DdpaU93kg,131
|
|
35
|
+
apytizer/models/abstract_model.py,sha256=_utDDwRTDnhepEfwapF9HGH3Zy2ZLKMwNMS5BjmWxuo,3000
|
|
36
|
+
apytizer/models/base_model.py,sha256=lXfTxws7q1PoG3jSPbuSS0FJ9BQz4xqbbiz5qSduf9g,2126
|
|
37
|
+
apytizer/repositories/__init__.py,sha256=JlJyfHxZ5K5N7vWe-CJWvK2NHsxuldaRmKn6dfrpcUs,150
|
|
38
|
+
apytizer/repositories/abstract_repository.py,sha256=P0q8olfi-Za_YQCCnmIxdFN-PFjvZtY-mzaAN9AUBnQ,2214
|
|
39
|
+
apytizer/repositories/managed_repository.py,sha256=wpKWt1tO02SIF0_TG-QBBQ56Lk0n3LFKTWrZXnOSU2A,2195
|
|
40
|
+
apytizer/routes/__init__.py,sha256=nR2RRWJRPAXN6ph1mOkq7El5phFj1xzHa3HDZyLqbEM,131
|
|
41
|
+
apytizer/routes/abstract_route.py,sha256=DD2rg-AvUUy90cjyc35QiqE3t6APRN_g8EvNk0-YZUg,754
|
|
42
|
+
apytizer/routes/base_route.py,sha256=lRbF6TIgzPu2DPa8u6NiClCLiNFjapckG7bPvxIsIwM,3709
|
|
43
|
+
apytizer/sessions/__init__.py,sha256=1rwoAfpR5LF3LPJXbXjk6-jlBjESGsChRDSkWSt4FQM,944
|
|
44
|
+
apytizer/sessions/abstract_session.py,sha256=YS6KVGBFC7zWYir3Zvefy-crhsfojfFYpSCPZmdYYpI,1471
|
|
45
|
+
apytizer/sessions/requests_session.py,sha256=ZMTcK6meDHnzdtlYwN3hdnu3lQJ_L8FkdzkJ_xgb64k,3730
|
|
46
|
+
apytizer/states/__init__.py,sha256=-Q6fJtW3HKXbjfrRnuN8cF-Txs1grWVTXWZq7yVbCRs,132
|
|
47
|
+
apytizer/states/abstract_state.py,sha256=7wGAl0NWkUxjKsDKm6o_6nAIptiO1T2zl_qS3pFOx7U,1861
|
|
48
|
+
apytizer/states/local_state.py,sha256=thLaTmCOAPAUwnPZ24bCKWfSDM8VxFwkSlNoJWwvvHk,2490
|
|
49
|
+
apytizer/utils/__init__.py,sha256=qTVMHm1Ub01zfxsbQLmaPwxiWPbEBdOPy_h158SI2f4,240
|
|
50
|
+
apytizer/utils/caching.py,sha256=bhAgZBDdhyPuUATkbYpYgVhwcuoPiu7zso4TaS9vIjg,837
|
|
51
|
+
apytizer/utils/dictionaries.py,sha256=05Iikk6bbVO0F9jDMhCSepOot-FlK6eEsBQwev3lERc,9578
|
|
52
|
+
apytizer/utils/errors.py,sha256=yGYgPB-IDvJ-zSpVNq6LVL-ppVDJTC33vSKo-QNJBzY,2803
|
|
53
|
+
apytizer/utils/iterables.py,sha256=aCxh_rfauIRUH_vvPfDLfBL7zgfIMtdC33ZHPi0yTO8,2314
|
|
54
|
+
apytizer/utils/objects.py,sha256=ev53gZuATc2GwLjR0zH0e7zqkL7mEpFeg6waxI8h-FI,3889
|
|
55
|
+
apytizer/utils/strings.py,sha256=Qu2wkjduMybibclhldJgHWVY5GMvsSZ3fUDtPXyzx5w,1588
|
|
56
|
+
apytizer/utils/typing.py,sha256=H2nVGreAEMdW1VzAbdaGVLOHVn2HUXXRhw4M47b47rI,709
|
|
57
|
+
apytizer-0.0.1b1.dist-info/METADATA,sha256=xiIMxMWPP-FuaVo2lUuDvd3JWJT05c0QIXSvz7EdDA0,1621
|
|
58
|
+
apytizer-0.0.1b1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
59
|
+
apytizer-0.0.1b1.dist-info/licenses/LICENSE,sha256=rwTrW8f9E015utDMKkNmSWxjW22qM-BDH6xSiLw0lGQ,10351
|
|
60
|
+
apytizer-0.0.1b1.dist-info/RECORD,,
|
apytizer/abstracts/__init__.py
DELETED
apytizer/abstracts/api.py
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""Abstract API class interface.
|
|
3
|
-
|
|
4
|
-
This module defines an abstract API class which provides an interface
|
|
5
|
-
for subclasses to implement. Each of the abstract methods represents
|
|
6
|
-
a standard HTTP request method.
|
|
7
|
-
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
# Third-Party Imports
|
|
11
|
-
from __future__ import annotations
|
|
12
|
-
import abc
|
|
13
|
-
from typing import Dict, Tuple, Union
|
|
14
|
-
|
|
15
|
-
# Third-Party Imports
|
|
16
|
-
from requests import Response
|
|
17
|
-
from requests.auth import AuthBase
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class AbstractAPI(abc.ABC):
|
|
21
|
-
"""
|
|
22
|
-
Represents an abstract API.
|
|
23
|
-
"""
|
|
24
|
-
url: str
|
|
25
|
-
auth: Union[AuthBase, Tuple]
|
|
26
|
-
|
|
27
|
-
def __eq__(self, other: AbstractAPI) -> bool:
|
|
28
|
-
return other.url == self.url \
|
|
29
|
-
and other.auth == self.auth
|
|
30
|
-
|
|
31
|
-
def __hash__(self) -> int:
|
|
32
|
-
return hash(self.url)
|
|
33
|
-
|
|
34
|
-
def __repr__(self) -> str:
|
|
35
|
-
return f'<{self.__class__.__name__!s} url={self.url!s}>'
|
|
36
|
-
|
|
37
|
-
@abc.abstractmethod
|
|
38
|
-
def head(self, route: str, *args, headers: Dict = None, **kwargs) -> Response:
|
|
39
|
-
"""
|
|
40
|
-
Abstract method for sending an HTTP HEAD request.
|
|
41
|
-
|
|
42
|
-
Returns:
|
|
43
|
-
Response object.
|
|
44
|
-
|
|
45
|
-
.. _MDN Web Docs:
|
|
46
|
-
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD
|
|
47
|
-
|
|
48
|
-
"""
|
|
49
|
-
raise NotImplementedError
|
|
50
|
-
|
|
51
|
-
@abc.abstractmethod
|
|
52
|
-
def get(self, route: str, *args, headers: Dict = None, **kwargs) -> Response:
|
|
53
|
-
"""
|
|
54
|
-
Abstract method for sending an HTTP GET request.
|
|
55
|
-
|
|
56
|
-
Returns:
|
|
57
|
-
Response object.
|
|
58
|
-
|
|
59
|
-
.. _MDN Web Docs:
|
|
60
|
-
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET
|
|
61
|
-
|
|
62
|
-
"""
|
|
63
|
-
raise NotImplementedError
|
|
64
|
-
|
|
65
|
-
@abc.abstractmethod
|
|
66
|
-
def post(self, route: str, *args, headers: Dict = None, **kwargs) -> Response:
|
|
67
|
-
"""
|
|
68
|
-
Abstract method for sending an HTTP POST request.
|
|
69
|
-
|
|
70
|
-
Returns:
|
|
71
|
-
Response object.
|
|
72
|
-
|
|
73
|
-
.. _MDN Web Docs:
|
|
74
|
-
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST
|
|
75
|
-
|
|
76
|
-
"""
|
|
77
|
-
raise NotImplementedError
|
|
78
|
-
|
|
79
|
-
@abc.abstractmethod
|
|
80
|
-
def put(self, route: str, *args, headers: Dict = None, **kwargs) -> Response:
|
|
81
|
-
"""
|
|
82
|
-
Abstract method for sending an HTTP PUT request.
|
|
83
|
-
|
|
84
|
-
Returns:
|
|
85
|
-
Response object.
|
|
86
|
-
|
|
87
|
-
.. _MDN Web Docs:
|
|
88
|
-
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT
|
|
89
|
-
|
|
90
|
-
"""
|
|
91
|
-
raise NotImplementedError
|
|
92
|
-
|
|
93
|
-
@abc.abstractmethod
|
|
94
|
-
def patch(self, route: str, *args, headers: Dict = None, **kwargs) -> Response:
|
|
95
|
-
"""
|
|
96
|
-
Abstract method for sending an HTTP PATCH request.
|
|
97
|
-
|
|
98
|
-
Returns:
|
|
99
|
-
Response object.
|
|
100
|
-
|
|
101
|
-
.. _MDN Web Docs:
|
|
102
|
-
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH
|
|
103
|
-
|
|
104
|
-
"""
|
|
105
|
-
raise NotImplementedError
|
|
106
|
-
|
|
107
|
-
@abc.abstractmethod
|
|
108
|
-
def delete(self, route: str, *args, headers: Dict = None, **kwargs) -> Response:
|
|
109
|
-
"""
|
|
110
|
-
Abstract method for sending an HTTP DELETE request.
|
|
111
|
-
|
|
112
|
-
Returns:
|
|
113
|
-
Response object.
|
|
114
|
-
|
|
115
|
-
.. _MDN Web Docs:
|
|
116
|
-
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE
|
|
117
|
-
|
|
118
|
-
"""
|
|
119
|
-
raise NotImplementedError
|
|
120
|
-
|
|
121
|
-
@abc.abstractmethod
|
|
122
|
-
def options(self, route: str, *args, headers: Dict = None, **kwargs) -> Response:
|
|
123
|
-
"""
|
|
124
|
-
Abstract method for sending an HTTP OPTIONS request.
|
|
125
|
-
|
|
126
|
-
Returns:
|
|
127
|
-
Response object.
|
|
128
|
-
|
|
129
|
-
.. _MDN Web Docs:
|
|
130
|
-
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS
|
|
131
|
-
|
|
132
|
-
"""
|
|
133
|
-
raise NotImplementedError
|
|
134
|
-
|
|
135
|
-
@abc.abstractmethod
|
|
136
|
-
def trace(self, route: str, *args, headers: Dict = None, **kwargs) -> Response:
|
|
137
|
-
"""
|
|
138
|
-
Abstract method for sending an HTTP TRACE request.
|
|
139
|
-
|
|
140
|
-
Returns:
|
|
141
|
-
Response object.
|
|
142
|
-
|
|
143
|
-
.. _MDN Web Docs:
|
|
144
|
-
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/TRACE
|
|
145
|
-
|
|
146
|
-
"""
|
|
147
|
-
raise NotImplementedError
|