clear-skies 2.0.1__py3-none-any.whl → 2.0.2__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 clear-skies might be problematic. Click here for more details.
- {clear_skies-2.0.1.dist-info → clear_skies-2.0.2.dist-info}/METADATA +1 -1
- {clear_skies-2.0.1.dist-info → clear_skies-2.0.2.dist-info}/RECORD +65 -65
- clearskies/__init__.py +5 -8
- clearskies/authentication/jwks.py +2 -2
- clearskies/authentication/secret_bearer.py +2 -2
- clearskies/backends/api_backend.py +2 -2
- clearskies/backends/secrets_backend.py +0 -1
- clearskies/column.py +6 -2
- clearskies/columns/audit.py +3 -2
- clearskies/columns/belongs_to_id.py +2 -2
- clearskies/columns/belongs_to_model.py +6 -2
- clearskies/columns/belongs_to_self.py +2 -2
- clearskies/columns/boolean.py +6 -2
- clearskies/columns/category_tree.py +2 -2
- clearskies/columns/category_tree_children.py +2 -2
- clearskies/columns/created.py +3 -2
- clearskies/columns/created_by_authorization_data.py +2 -2
- clearskies/columns/created_by_header.py +2 -2
- clearskies/columns/created_by_ip.py +2 -2
- clearskies/columns/created_by_routing_data.py +3 -2
- clearskies/columns/created_by_user_agent.py +2 -2
- clearskies/columns/date.py +6 -2
- clearskies/columns/datetime.py +6 -2
- clearskies/columns/float.py +6 -2
- clearskies/columns/has_many.py +2 -2
- clearskies/columns/has_many_self.py +2 -2
- clearskies/columns/integer.py +6 -2
- clearskies/columns/json.py +6 -2
- clearskies/columns/many_to_many_ids.py +6 -2
- clearskies/columns/many_to_many_ids_with_data.py +6 -2
- clearskies/columns/many_to_many_models.py +6 -2
- clearskies/columns/many_to_many_pivots.py +3 -2
- clearskies/columns/phone.py +3 -2
- clearskies/columns/select.py +3 -2
- clearskies/columns/string.py +4 -0
- clearskies/columns/timestamp.py +6 -2
- clearskies/columns/updated.py +2 -2
- clearskies/columns/uuid.py +2 -2
- clearskies/configs/__init__.py +1 -1
- clearskies/{parameters_to_properties.py → decorators.py} +2 -0
- clearskies/di/injectable_properties.py +2 -2
- clearskies/endpoint.py +2 -2
- clearskies/endpoint_group.py +1 -1
- clearskies/endpoints/callable.py +1 -1
- clearskies/endpoints/create.py +1 -1
- clearskies/endpoints/delete.py +1 -1
- clearskies/endpoints/get.py +1 -1
- clearskies/endpoints/health_check.py +1 -1
- clearskies/endpoints/list.py +1 -1
- clearskies/endpoints/restful_api.py +2 -2
- clearskies/endpoints/simple_search.py +1 -1
- clearskies/endpoints/update.py +1 -1
- clearskies/model.py +691 -37
- clearskies/security_headers/cache_control.py +2 -2
- clearskies/security_headers/cors.py +2 -2
- clearskies/security_headers/csp.py +2 -2
- clearskies/security_headers/hsts.py +2 -2
- clearskies/validators/after_column.py +2 -2
- clearskies/validators/in_the_future.py +1 -1
- clearskies/validators/in_the_past.py +1 -1
- clearskies/validators/required.py +0 -1
- clearskies/validators/timedelta.py +2 -2
- clearskies/validators/unique.py +0 -1
- {clear_skies-2.0.1.dist-info → clear_skies-2.0.2.dist-info}/LICENSE +0 -0
- {clear_skies-2.0.1.dist-info → clear_skies-2.0.2.dist-info}/WHEEL +0 -0
clearskies/columns/date.py
CHANGED
|
@@ -5,7 +5,7 @@ from typing import TYPE_CHECKING, Any, Callable, Self, overload
|
|
|
5
5
|
|
|
6
6
|
import dateparser # type: ignore
|
|
7
7
|
|
|
8
|
-
import clearskies.
|
|
8
|
+
import clearskies.decorators
|
|
9
9
|
import clearskies.typing
|
|
10
10
|
from clearskies import configs
|
|
11
11
|
from clearskies.autodoc.schema import Datetime as AutoDocDatetime
|
|
@@ -102,7 +102,7 @@ class Date(Datetime):
|
|
|
102
102
|
auto_doc_class: type[AutoDocSchema] = AutoDocDatetime
|
|
103
103
|
_descriptor_config_map = None
|
|
104
104
|
|
|
105
|
-
@clearskies.
|
|
105
|
+
@clearskies.decorators.parameters_to_properties
|
|
106
106
|
def __init__(
|
|
107
107
|
self,
|
|
108
108
|
date_format: str = "%Y-%m-%d",
|
|
@@ -162,6 +162,10 @@ class Date(Datetime):
|
|
|
162
162
|
return super().__get__(instance, cls)
|
|
163
163
|
|
|
164
164
|
def __set__(self, instance, value: datetime.datetime | datetime.date) -> None:
|
|
165
|
+
# this makes sure we're initialized
|
|
166
|
+
if "name" not in self._config: # type: ignore
|
|
167
|
+
instance.get_columns()
|
|
168
|
+
|
|
165
169
|
instance._next_data[self.name] = value
|
|
166
170
|
|
|
167
171
|
def equals(self, value: str | datetime.datetime | datetime.date) -> Condition:
|
clearskies/columns/datetime.py
CHANGED
|
@@ -5,7 +5,7 @@ from typing import TYPE_CHECKING, Any, Callable, Self, overload
|
|
|
5
5
|
|
|
6
6
|
import dateparser # type: ignore
|
|
7
7
|
|
|
8
|
-
import clearskies.
|
|
8
|
+
import clearskies.decorators
|
|
9
9
|
import clearskies.typing
|
|
10
10
|
from clearskies import configs
|
|
11
11
|
from clearskies.autodoc.schema import Datetime as AutoDocDatetime
|
|
@@ -127,7 +127,7 @@ class Datetime(Column):
|
|
|
127
127
|
auto_doc_class: type[AutoDocSchema] = AutoDocDatetime
|
|
128
128
|
_descriptor_config_map = None
|
|
129
129
|
|
|
130
|
-
@clearskies.
|
|
130
|
+
@clearskies.decorators.parameters_to_properties
|
|
131
131
|
def __init__(
|
|
132
132
|
self,
|
|
133
133
|
date_format: str = "%Y-%m-%d %H:%M:%S",
|
|
@@ -204,6 +204,10 @@ class Datetime(Column):
|
|
|
204
204
|
return super().__get__(instance, cls)
|
|
205
205
|
|
|
206
206
|
def __set__(self, instance, value: datetime.datetime) -> None:
|
|
207
|
+
# this makes sure we're initialized
|
|
208
|
+
if "name" not in self._config: # type: ignore
|
|
209
|
+
instance.get_columns()
|
|
210
|
+
|
|
207
211
|
instance._next_data[self.name] = value
|
|
208
212
|
|
|
209
213
|
def equals(self, value: str | datetime.datetime) -> Condition:
|
clearskies/columns/float.py
CHANGED
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import TYPE_CHECKING, Callable, Self, overload
|
|
4
4
|
|
|
5
|
-
import clearskies.
|
|
5
|
+
import clearskies.decorators
|
|
6
6
|
import clearskies.typing
|
|
7
7
|
from clearskies import configs
|
|
8
8
|
from clearskies.autodoc.schema import Number as AutoDocNumber
|
|
@@ -75,7 +75,7 @@ class Float(Column):
|
|
|
75
75
|
auto_doc_class: type[AutoDocSchema] = AutoDocNumber
|
|
76
76
|
_descriptor_config_map = None
|
|
77
77
|
|
|
78
|
-
@clearskies.
|
|
78
|
+
@clearskies.decorators.parameters_to_properties
|
|
79
79
|
def __init__(
|
|
80
80
|
self,
|
|
81
81
|
default: float | None = None,
|
|
@@ -106,6 +106,10 @@ class Float(Column):
|
|
|
106
106
|
return super().__get__(instance, cls)
|
|
107
107
|
|
|
108
108
|
def __set__(self, instance, value: float) -> None:
|
|
109
|
+
# this makes sure we're initialized
|
|
110
|
+
if "name" not in self._config: # type: ignore
|
|
111
|
+
instance.get_columns()
|
|
112
|
+
|
|
109
113
|
instance._next_data[self.name] = float(value)
|
|
110
114
|
|
|
111
115
|
def from_backend(self, value) -> float:
|
clearskies/columns/has_many.py
CHANGED
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import TYPE_CHECKING, Any, Self, overload
|
|
4
4
|
|
|
5
|
-
import clearskies.
|
|
5
|
+
import clearskies.decorators
|
|
6
6
|
import clearskies.typing
|
|
7
7
|
from clearskies import configs
|
|
8
8
|
from clearskies.autodoc.schema import Array as AutoDocArray
|
|
@@ -382,7 +382,7 @@ class HasMany(Column):
|
|
|
382
382
|
|
|
383
383
|
input_output = InputOutput()
|
|
384
384
|
|
|
385
|
-
@clearskies.
|
|
385
|
+
@clearskies.decorators.parameters_to_properties
|
|
386
386
|
def __init__(
|
|
387
387
|
self,
|
|
388
388
|
child_model_class,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import clearskies.decorators
|
|
1
2
|
import clearskies.typing
|
|
2
|
-
from clearskies import parameters_to_properties
|
|
3
3
|
from clearskies.columns.has_many import HasMany
|
|
4
4
|
|
|
5
5
|
|
|
@@ -20,7 +20,7 @@ class HasManySelf(HasMany):
|
|
|
20
20
|
|
|
21
21
|
_descriptor_config_map = None
|
|
22
22
|
|
|
23
|
-
@
|
|
23
|
+
@clearskies.decorators.parameters_to_properties
|
|
24
24
|
def __init__(
|
|
25
25
|
self,
|
|
26
26
|
foreign_column_name: str | None = None,
|
clearskies/columns/integer.py
CHANGED
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import TYPE_CHECKING, Callable, Self, overload
|
|
4
4
|
|
|
5
|
-
import clearskies.
|
|
5
|
+
import clearskies.decorators
|
|
6
6
|
import clearskies.typing
|
|
7
7
|
from clearskies import configs
|
|
8
8
|
from clearskies.autodoc.schema import Integer as AutoDocInteger
|
|
@@ -77,7 +77,7 @@ class Integer(Column):
|
|
|
77
77
|
|
|
78
78
|
_descriptor_config_map = None
|
|
79
79
|
|
|
80
|
-
@clearskies.
|
|
80
|
+
@clearskies.decorators.parameters_to_properties
|
|
81
81
|
def __init__(
|
|
82
82
|
self,
|
|
83
83
|
default: int | None = None,
|
|
@@ -113,6 +113,10 @@ class Integer(Column):
|
|
|
113
113
|
return None if value is None else int(value)
|
|
114
114
|
|
|
115
115
|
def __set__(self, instance, value: int) -> None:
|
|
116
|
+
# this makes sure we're initialized
|
|
117
|
+
if "name" not in self._config: # type: ignore
|
|
118
|
+
instance.get_columns()
|
|
119
|
+
|
|
116
120
|
instance._next_data[self.name] = value
|
|
117
121
|
|
|
118
122
|
def from_backend(self, value) -> int | None:
|
clearskies/columns/json.py
CHANGED
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import json
|
|
4
4
|
from typing import TYPE_CHECKING, Any, Callable, Self, overload
|
|
5
5
|
|
|
6
|
-
import clearskies.
|
|
6
|
+
import clearskies.decorators
|
|
7
7
|
import clearskies.typing
|
|
8
8
|
from clearskies import configs
|
|
9
9
|
from clearskies.column import Column
|
|
@@ -72,7 +72,7 @@ class Json(Column):
|
|
|
72
72
|
is_searchable = configs.Boolean(default=False)
|
|
73
73
|
_descriptor_config_map = None
|
|
74
74
|
|
|
75
|
-
@clearskies.
|
|
75
|
+
@clearskies.decorators.parameters_to_properties
|
|
76
76
|
def __init__(
|
|
77
77
|
self,
|
|
78
78
|
default: dict[str, Any] | None = None,
|
|
@@ -102,6 +102,10 @@ class Json(Column):
|
|
|
102
102
|
return super().__get__(instance, cls)
|
|
103
103
|
|
|
104
104
|
def __set__(self, instance, value: dict[str, Any]) -> None:
|
|
105
|
+
# this makes sure we're initialized
|
|
106
|
+
if "name" not in self._config: # type: ignore
|
|
107
|
+
instance.get_columns()
|
|
108
|
+
|
|
105
109
|
instance._next_data[self.name] = value
|
|
106
110
|
|
|
107
111
|
def from_backend(self, value) -> dict[str, Any] | list[Any] | None:
|
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
from collections import OrderedDict
|
|
4
4
|
from typing import TYPE_CHECKING, Any, Callable, Self, overload
|
|
5
5
|
|
|
6
|
-
import clearskies.
|
|
6
|
+
import clearskies.decorators
|
|
7
7
|
import clearskies.typing
|
|
8
8
|
from clearskies import configs
|
|
9
9
|
from clearskies.autodoc.schema import Array as AutoDocArray
|
|
@@ -173,7 +173,7 @@ class ManyToManyIds(Column):
|
|
|
173
173
|
is_searchable = configs.Boolean(default=False)
|
|
174
174
|
_descriptor_config_map = None
|
|
175
175
|
|
|
176
|
-
@clearskies.
|
|
176
|
+
@clearskies.decorators.parameters_to_properties
|
|
177
177
|
def __init__(
|
|
178
178
|
self,
|
|
179
179
|
related_model_class,
|
|
@@ -258,6 +258,10 @@ class ManyToManyIds(Column):
|
|
|
258
258
|
return [getattr(model, related_id_column_name) for model in self.get_related_models(instance)]
|
|
259
259
|
|
|
260
260
|
def __set__(self, instance, value: list[str | int]) -> None:
|
|
261
|
+
# this makes sure we're initialized
|
|
262
|
+
if "name" not in self._config: # type: ignore
|
|
263
|
+
instance.get_columns()
|
|
264
|
+
|
|
261
265
|
instance._next_data[self.name] = value
|
|
262
266
|
|
|
263
267
|
def get_related_models(self, model: Model) -> Model:
|
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import TYPE_CHECKING, Any, Callable, Self, overload
|
|
4
4
|
|
|
5
|
-
import clearskies.
|
|
5
|
+
import clearskies.decorators
|
|
6
6
|
import clearskies.typing
|
|
7
7
|
from clearskies import configs
|
|
8
8
|
from clearskies.columns.many_to_many_ids import ManyToManyIds
|
|
@@ -149,7 +149,7 @@ class ManyToManyIdsWithData(ManyToManyIds):
|
|
|
149
149
|
setable = configs.ListAnyDictOrCallable(default=None) # type: ignore
|
|
150
150
|
_descriptor_config_map = None
|
|
151
151
|
|
|
152
|
-
@clearskies.
|
|
152
|
+
@clearskies.decorators.parameters_to_properties
|
|
153
153
|
def __init__(
|
|
154
154
|
self,
|
|
155
155
|
related_model_class,
|
|
@@ -187,6 +187,10 @@ class ManyToManyIdsWithData(ManyToManyIds):
|
|
|
187
187
|
return super().__get__(instance, cls)
|
|
188
188
|
|
|
189
189
|
def __set__(self, instance, value: list[dict[str, Any]]) -> None: # type: ignore
|
|
190
|
+
# this makes sure we're initialized
|
|
191
|
+
if "name" not in self._config: # type: ignore
|
|
192
|
+
instance.get_columns()
|
|
193
|
+
|
|
190
194
|
instance._next_data[self.name] = value
|
|
191
195
|
|
|
192
196
|
def post_save(self, data, model, id):
|
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
from collections import OrderedDict
|
|
4
4
|
from typing import TYPE_CHECKING, Any, Callable, Self, overload
|
|
5
5
|
|
|
6
|
-
import clearskies.
|
|
6
|
+
import clearskies.decorators
|
|
7
7
|
import clearskies.typing
|
|
8
8
|
from clearskies import configs
|
|
9
9
|
from clearskies.autodoc.schema import Array as AutoDocArray
|
|
@@ -30,7 +30,7 @@ class ManyToManyModels(Column):
|
|
|
30
30
|
is_searchable = configs.Boolean(default=False)
|
|
31
31
|
_descriptor_config_map = None
|
|
32
32
|
|
|
33
|
-
@clearskies.
|
|
33
|
+
@clearskies.decorators.parameters_to_properties
|
|
34
34
|
def __init__(
|
|
35
35
|
self,
|
|
36
36
|
many_to_many_column_name,
|
|
@@ -87,6 +87,10 @@ class ManyToManyModels(Column):
|
|
|
87
87
|
return self.many_to_many_column.get_related_models(instance) # type: ignore
|
|
88
88
|
|
|
89
89
|
def __set__(self, instance, value: Model | list[Model] | list[dict[str, Any]]) -> None:
|
|
90
|
+
# this makes sure we're initialized
|
|
91
|
+
if "name" not in self._config: # type: ignore
|
|
92
|
+
instance.get_columns()
|
|
93
|
+
|
|
90
94
|
# we allow a list of models or a model, but if it's a model it may represent a single record or a query.
|
|
91
95
|
# if it's a single record then we want to wrap it in a list so we can iterate over it.
|
|
92
96
|
if hasattr(value, "_data") and value._data:
|
|
@@ -3,8 +3,9 @@ from __future__ import annotations
|
|
|
3
3
|
from collections import OrderedDict
|
|
4
4
|
from typing import TYPE_CHECKING, Any, Callable, Self, overload
|
|
5
5
|
|
|
6
|
+
import clearskies.decorators
|
|
6
7
|
import clearskies.typing
|
|
7
|
-
from clearskies import configs
|
|
8
|
+
from clearskies import configs
|
|
8
9
|
from clearskies.autodoc.schema import Array as AutoDocArray
|
|
9
10
|
from clearskies.autodoc.schema import Object as AutoDocObject
|
|
10
11
|
from clearskies.column import Column
|
|
@@ -30,7 +31,7 @@ class ManyToManyPivots(Column):
|
|
|
30
31
|
is_searchable = configs.Boolean(default=False)
|
|
31
32
|
_descriptor_config_map = None
|
|
32
33
|
|
|
33
|
-
@
|
|
34
|
+
@clearskies.decorators.parameters_to_properties
|
|
34
35
|
def __init__(
|
|
35
36
|
self,
|
|
36
37
|
many_to_many_column_name,
|
clearskies/columns/phone.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import re
|
|
2
2
|
from typing import Any, Callable
|
|
3
3
|
|
|
4
|
+
import clearskies.decorators
|
|
4
5
|
import clearskies.typing
|
|
5
|
-
from clearskies import configs
|
|
6
|
+
from clearskies import configs
|
|
6
7
|
from clearskies.columns.string import String
|
|
7
8
|
|
|
8
9
|
|
|
@@ -98,7 +99,7 @@ class Phone(String):
|
|
|
98
99
|
usa_only = configs.Boolean(default=True)
|
|
99
100
|
_descriptor_config_map = None
|
|
100
101
|
|
|
101
|
-
@
|
|
102
|
+
@clearskies.decorators.parameters_to_properties
|
|
102
103
|
def __init__(
|
|
103
104
|
self,
|
|
104
105
|
usa_only: bool = True,
|
clearskies/columns/select.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
from typing import Callable
|
|
2
2
|
|
|
3
|
+
import clearskies.decorators
|
|
3
4
|
import clearskies.typing
|
|
4
|
-
from clearskies import configs
|
|
5
|
+
from clearskies import configs
|
|
5
6
|
from clearskies.columns.string import String
|
|
6
7
|
|
|
7
8
|
|
|
@@ -67,7 +68,7 @@ class Select(String):
|
|
|
67
68
|
allowed_values = configs.StringList(required=True)
|
|
68
69
|
_descriptor_config_map = None
|
|
69
70
|
|
|
70
|
-
@
|
|
71
|
+
@clearskies.decorators.parameters_to_properties
|
|
71
72
|
def __init__(
|
|
72
73
|
self,
|
|
73
74
|
allowed_values: list[str],
|
clearskies/columns/string.py
CHANGED
|
@@ -92,6 +92,10 @@ class String(Column):
|
|
|
92
92
|
return instance._transformed_data[self.name]
|
|
93
93
|
|
|
94
94
|
def __set__(self, instance: Model, value: str) -> None:
|
|
95
|
+
# this makes sure we're initialized
|
|
96
|
+
if "name" not in self._config: # type: ignore
|
|
97
|
+
instance.get_columns()
|
|
98
|
+
|
|
95
99
|
instance._next_data[self.name] = value
|
|
96
100
|
|
|
97
101
|
def input_error_for_value(self, value: str, operator: str | None = None) -> str:
|
clearskies/columns/timestamp.py
CHANGED
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import datetime
|
|
4
4
|
from typing import TYPE_CHECKING, Any, Callable, Self, Type, overload
|
|
5
5
|
|
|
6
|
-
import clearskies.
|
|
6
|
+
import clearskies.decorators
|
|
7
7
|
import clearskies.typing
|
|
8
8
|
from clearskies import configs
|
|
9
9
|
from clearskies.columns.datetime import Datetime
|
|
@@ -76,7 +76,7 @@ class Timestamp(Datetime):
|
|
|
76
76
|
include_microseconds = configs.Boolean(default=False)
|
|
77
77
|
_descriptor_config_map = None
|
|
78
78
|
|
|
79
|
-
@clearskies.
|
|
79
|
+
@clearskies.decorators.parameters_to_properties
|
|
80
80
|
def __init__(
|
|
81
81
|
self,
|
|
82
82
|
include_microseconds: bool = False,
|
|
@@ -148,6 +148,10 @@ class Timestamp(Datetime):
|
|
|
148
148
|
return super().__get__(instance, cls)
|
|
149
149
|
|
|
150
150
|
def __set__(self, instance, value: datetime.datetime) -> None:
|
|
151
|
+
# this makes sure we're initialized
|
|
152
|
+
if "name" not in self._config: # type: ignore
|
|
153
|
+
instance.get_columns()
|
|
154
|
+
|
|
151
155
|
instance._next_data[self.name] = value
|
|
152
156
|
|
|
153
157
|
def input_error_for_value(self, value: str, operator: str | None = None) -> str:
|
clearskies/columns/updated.py
CHANGED
|
@@ -3,8 +3,8 @@ from __future__ import annotations
|
|
|
3
3
|
import datetime
|
|
4
4
|
from typing import TYPE_CHECKING, Any
|
|
5
5
|
|
|
6
|
+
import clearskies.decorators
|
|
6
7
|
import clearskies.di
|
|
7
|
-
import clearskies.parameters_to_properties
|
|
8
8
|
import clearskies.typing
|
|
9
9
|
from clearskies import configs
|
|
10
10
|
from clearskies.columns.datetime import Datetime
|
|
@@ -85,7 +85,7 @@ class Updated(Datetime):
|
|
|
85
85
|
|
|
86
86
|
now = clearskies.di.inject.Now()
|
|
87
87
|
|
|
88
|
-
@clearskies.
|
|
88
|
+
@clearskies.decorators.parameters_to_properties
|
|
89
89
|
def __init__(
|
|
90
90
|
self,
|
|
91
91
|
in_utc: bool = True,
|
clearskies/columns/uuid.py
CHANGED
|
@@ -2,8 +2,8 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import TYPE_CHECKING, Any
|
|
4
4
|
|
|
5
|
+
import clearskies.decorators
|
|
5
6
|
import clearskies.di
|
|
6
|
-
import clearskies.parameters_to_properties
|
|
7
7
|
import clearskies.typing
|
|
8
8
|
from clearskies import configs
|
|
9
9
|
from clearskies.columns.string import String
|
|
@@ -65,7 +65,7 @@ class Uuid(String):
|
|
|
65
65
|
|
|
66
66
|
uuid = clearskies.di.inject.Uuid()
|
|
67
67
|
|
|
68
|
-
@clearskies.
|
|
68
|
+
@clearskies.decorators.parameters_to_properties
|
|
69
69
|
def __init__(
|
|
70
70
|
self,
|
|
71
71
|
is_readable: bool = True,
|
clearskies/configs/__init__.py
CHANGED
|
@@ -56,7 +56,7 @@ class MyConfigurableClass(configs.Configurable):
|
|
|
56
56
|
age = configs.Integer(required=True)
|
|
57
57
|
property_with_default = configs.String(default="some value")
|
|
58
58
|
|
|
59
|
-
@clearskies.
|
|
59
|
+
@clearskies.decorators()
|
|
60
60
|
def __init__(self, name: str, age: int, optional: string = None):
|
|
61
61
|
self.finalize_and_validate_configuration()
|
|
62
62
|
```
|
|
@@ -44,7 +44,7 @@ class InjectableProperties:
|
|
|
44
44
|
```python
|
|
45
45
|
import clearskies
|
|
46
46
|
import time
|
|
47
|
-
|
|
47
|
+
import clearskies.decorators
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
class MyOtherThing(clearskies.di.InjectableProperties):
|
|
@@ -56,7 +56,7 @@ class InjectableProperties:
|
|
|
56
56
|
some_number = clearskies.di.inject.ByName("some_number")
|
|
57
57
|
my_other_thing = clearskies.di.inject.ByClass(MyOtherThing)
|
|
58
58
|
|
|
59
|
-
@parameters_to_properties
|
|
59
|
+
@clearskies.decorators.parameters_to_properties
|
|
60
60
|
def __init__(self, my_int: int):
|
|
61
61
|
self.finalize_and_validate_configuration()
|
|
62
62
|
|
clearskies/endpoint.py
CHANGED
|
@@ -8,9 +8,9 @@ from typing import TYPE_CHECKING, Any, Callable
|
|
|
8
8
|
import clearskies.column
|
|
9
9
|
import clearskies.configs
|
|
10
10
|
import clearskies.configurable
|
|
11
|
+
import clearskies.decorators
|
|
11
12
|
import clearskies.di
|
|
12
13
|
import clearskies.end
|
|
13
|
-
import clearskies.parameters_to_properties
|
|
14
14
|
import clearskies.typing
|
|
15
15
|
from clearskies import autodoc, exceptions
|
|
16
16
|
from clearskies.authentication import Authentication, Authorization, Public
|
|
@@ -879,7 +879,7 @@ class Endpoint(
|
|
|
879
879
|
_sortable_columns: dict[str, clearskies.column.Column] = None # type: ignore
|
|
880
880
|
_as_json_map: dict[str, clearskies.column.Column] = None # type: ignore
|
|
881
881
|
|
|
882
|
-
@clearskies.
|
|
882
|
+
@clearskies.decorators.parameters_to_properties
|
|
883
883
|
def __init__(
|
|
884
884
|
self,
|
|
885
885
|
url: str = "",
|
clearskies/endpoint_group.py
CHANGED
|
@@ -239,7 +239,7 @@ class EndpointGroup(
|
|
|
239
239
|
has_cors: bool = False
|
|
240
240
|
endpoints_initialized = False
|
|
241
241
|
|
|
242
|
-
@clearskies.
|
|
242
|
+
@clearskies.decorators.parameters_to_properties
|
|
243
243
|
def __init__(
|
|
244
244
|
self,
|
|
245
245
|
endpoints: list[Endpoint | Self],
|
clearskies/endpoints/callable.py
CHANGED
|
@@ -239,7 +239,7 @@ class Callable(Endpoint):
|
|
|
239
239
|
"""
|
|
240
240
|
return_records = clearskies.configs.Boolean(default=False)
|
|
241
241
|
|
|
242
|
-
@clearskies.
|
|
242
|
+
@clearskies.decorators.parameters_to_properties
|
|
243
243
|
def __init__(
|
|
244
244
|
self,
|
|
245
245
|
to_call: CallableType,
|
clearskies/endpoints/create.py
CHANGED
|
@@ -102,7 +102,7 @@ class Create(Endpoint):
|
|
|
102
102
|
5. We provided an extra column (`not_a_column`) that wasn't in the list of allowed columns.
|
|
103
103
|
"""
|
|
104
104
|
|
|
105
|
-
@clearskies.
|
|
105
|
+
@clearskies.decorators.parameters_to_properties
|
|
106
106
|
def __init__(
|
|
107
107
|
self,
|
|
108
108
|
model_class: type[Model],
|
clearskies/endpoints/delete.py
CHANGED
clearskies/endpoints/get.py
CHANGED
|
@@ -159,7 +159,7 @@ class Get(Endpoint):
|
|
|
159
159
|
"""
|
|
160
160
|
record_lookup_column_name = clearskies.configs.ReadableModelColumn("model_class", default=None)
|
|
161
161
|
|
|
162
|
-
@clearskies.
|
|
162
|
+
@clearskies.decorators.parameters_to_properties
|
|
163
163
|
def __init__(
|
|
164
164
|
self,
|
|
165
165
|
model_class: type[Model],
|
|
@@ -130,7 +130,7 @@ class HealthCheck(Endpoint):
|
|
|
130
130
|
"""
|
|
131
131
|
callables = clearskies.configs.Any(default=[])
|
|
132
132
|
|
|
133
|
-
@clearskies.
|
|
133
|
+
@clearskies.decorators.parameters_to_properties
|
|
134
134
|
def __init__(
|
|
135
135
|
self,
|
|
136
136
|
dependency_injection_names: list[str] = [],
|
clearskies/endpoints/list.py
CHANGED
|
@@ -182,7 +182,7 @@ class List(Endpoint):
|
|
|
182
182
|
"model_class", allow_relationship_references=True
|
|
183
183
|
)
|
|
184
184
|
|
|
185
|
-
@clearskies.
|
|
185
|
+
@clearskies.decorators.parameters_to_properties
|
|
186
186
|
def __init__(
|
|
187
187
|
self,
|
|
188
188
|
model_class: type[Model],
|
|
@@ -5,8 +5,8 @@ from collections import OrderedDict
|
|
|
5
5
|
from typing import TYPE_CHECKING, Any, Callable
|
|
6
6
|
|
|
7
7
|
import clearskies.configs
|
|
8
|
+
import clearskies.decorators
|
|
8
9
|
import clearskies.exceptions
|
|
9
|
-
import clearskies.parameters_to_properties
|
|
10
10
|
from clearskies import authentication, autodoc, typing
|
|
11
11
|
from clearskies.authentication import Authentication, Authorization, Public
|
|
12
12
|
from clearskies.endpoint import Endpoint
|
|
@@ -293,7 +293,7 @@ class RestfulApi(EndpointGroup):
|
|
|
293
293
|
where = clearskies.configs.Conditions(default=[])
|
|
294
294
|
_descriptor_config_map = None
|
|
295
295
|
|
|
296
|
-
@clearskies.
|
|
296
|
+
@clearskies.decorators.parameters_to_properties
|
|
297
297
|
def __init__(
|
|
298
298
|
self,
|
|
299
299
|
model_class: type[Model],
|