clear-skies 2.0.11__py3-none-any.whl → 2.0.13__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.11.dist-info → clear_skies-2.0.13.dist-info}/METADATA +1 -1
- {clear_skies-2.0.11.dist-info → clear_skies-2.0.13.dist-info}/RECORD +9 -9
- clearskies/configs/callable_config.py +1 -1
- clearskies/contexts/wsgi.py +1 -3
- clearskies/contexts/wsgi_ref.py +1 -1
- clearskies/input_outputs/headers.py +29 -23
- clearskies/input_outputs/wsgi.py +1 -0
- {clear_skies-2.0.11.dist-info → clear_skies-2.0.13.dist-info}/WHEEL +0 -0
- {clear_skies-2.0.11.dist-info → clear_skies-2.0.13.dist-info}/licenses/LICENSE +0 -0
|
@@ -112,7 +112,7 @@ clearskies/configs/authentication.py,sha256=9XZClfYcECi5dzt1BvDof34tW6IotN252bcx
|
|
|
112
112
|
clearskies/configs/authorization.py,sha256=Pa6wCyMitpKv2Nde69tMB5sJsxeCI2nVSdTuwF6R9pQ,828
|
|
113
113
|
clearskies/configs/boolean.py,sha256=Yj6fEKo85wQkalg7oHimn1ZU3lJGxCmKeFV1mvdXqIc,624
|
|
114
114
|
clearskies/configs/boolean_or_callable.py,sha256=vVyB1ES8IW_nX5ZzwumQy2EM7LctQ9M_8IB5BOnmNEU,745
|
|
115
|
-
clearskies/configs/callable_config.py,sha256=
|
|
115
|
+
clearskies/configs/callable_config.py,sha256=nEZyHVUkrIysB21iiHJLwznbfU5bZGKCGioZ-5BOLfU,708
|
|
116
116
|
clearskies/configs/columns.py,sha256=WhdpPUiwVqwBO2XCDDiMym2nWr_1-L1JoICyob4T6Wo,1258
|
|
117
117
|
clearskies/configs/conditions.py,sha256=a09bVac4-10ZtKPQGSu_e9VnHnwITwy_7_T4NekXpgs,1008
|
|
118
118
|
clearskies/configs/config.py,sha256=2qsF3ZBc8tsTXDgNLL7vT01kjWanbJH3oXO9R2S6GnU,909
|
|
@@ -158,8 +158,8 @@ clearskies/configs/writeable_model_columns.py,sha256=vQFh5w6ToC8SDi_GaEvy33csp2C
|
|
|
158
158
|
clearskies/contexts/__init__.py,sha256=f7XVUq2UKlDH6fjmcUWk6lbe9p_OaGpZ5ZjM6CuwTGQ,247
|
|
159
159
|
clearskies/contexts/cli.py,sha256=cuGWoyRhHlO_Ba6Dozg3sGob1VZoI4TBFOLu-2Udabk,2838
|
|
160
160
|
clearskies/contexts/context.py,sha256=rT-d0v5wiVqRNz_bsitTBXYEy0555-H2xr9TpETf-og,3676
|
|
161
|
-
clearskies/contexts/wsgi.py,sha256=
|
|
162
|
-
clearskies/contexts/wsgi_ref.py,sha256=
|
|
161
|
+
clearskies/contexts/wsgi.py,sha256=Wrf0B9WxoMPe71jn2fATsSYyS_Ego3VKFGjuI6KliWs,3165
|
|
162
|
+
clearskies/contexts/wsgi_ref.py,sha256=q78gyeQS3KJ80NsozJkKb0ag00_6uwPK1yj5wxUM3JA,2818
|
|
163
163
|
clearskies/di/__init__.py,sha256=Ab8GNv9ZksnCABq8n2gCcyLEAXD-5-kX4O8PweTJIFs,474
|
|
164
164
|
clearskies/di/additional_config.py,sha256=65INxw8aqTZQsyaKPj-aQmd6FBe4_4DwibXGgWYBy14,5139
|
|
165
165
|
clearskies/di/additional_config_auto_import.py,sha256=XYw0Kcnp6hp-ee-c0YjiATwJvRb2E82xk9PuoX9dGRY,758
|
|
@@ -207,11 +207,11 @@ clearskies/functional/string.py,sha256=ZnkOjx8nxqZq2TV0CIb-Kz4onGoyekTX_WkLJM6XT
|
|
|
207
207
|
clearskies/functional/validations.py,sha256=cPYOTwWomlQrPvqPP_Jdlds7zZ5H9GABCP5pnGzC9T4,2821
|
|
208
208
|
clearskies/input_outputs/__init__.py,sha256=9qeKJULw3MQ3zqkgBZice5d7qqRgsP3y-wkhWO2Y9vM,362
|
|
209
209
|
clearskies/input_outputs/cli.py,sha256=t7uWqLi6VI3i_zuyoKLdIq3vUwr19lQZoJmuAxVEvgg,5741
|
|
210
|
-
clearskies/input_outputs/headers.py,sha256=
|
|
210
|
+
clearskies/input_outputs/headers.py,sha256=AnyqI64kploPX7qiBfQCD9w8b2FYWVIuwaXVafbpIiM,2085
|
|
211
211
|
clearskies/input_outputs/input_output.py,sha256=tJQVN3U3MX_jpwsXJ-g-K1cdqQwyuSarTjo3JOp7zQQ,5154
|
|
212
212
|
clearskies/input_outputs/programmatic.py,sha256=OCRq0M42cKZKgk4YAfJyTWo3T4jNRmnGmVr7zCTovpg,1658
|
|
213
213
|
clearskies/input_outputs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
214
|
-
clearskies/input_outputs/wsgi.py,sha256
|
|
214
|
+
clearskies/input_outputs/wsgi.py,sha256=wcqZUu8zuKj9V1ur2oNlYqgcI_sC5LJEieZxvDVMMFU,2783
|
|
215
215
|
clearskies/input_outputs/exceptions/__init__.py,sha256=3KiM3KaMYEKoToqCCQ4_no2n0W5ROqeBC0sI2Ix4P6w,82
|
|
216
216
|
clearskies/input_outputs/exceptions/cli_input_error.py,sha256=kOFU8aLTLmeTL_AKDshxMu8_ufildg6p8ndhE1xHfb0,41
|
|
217
217
|
clearskies/input_outputs/exceptions/cli_not_found.py,sha256=JBBuZA9ZwdkPhd3a0qaGgEPQrxh1fehy4R3ZaV2gWXU,39
|
|
@@ -251,7 +251,7 @@ clearskies/validators/minimum_value.py,sha256=NDLcG6xCemlv3kfr-RiUaM3x2INS1GJGMB
|
|
|
251
251
|
clearskies/validators/required.py,sha256=GWxyexwj-K6DunZWNEnZxW6tQGAFd4oOCvQrW1s1K9k,1308
|
|
252
252
|
clearskies/validators/timedelta.py,sha256=DJ0pTm-SSUtjZ7phGoD6vjb086vXPzvLLijkU-jQlOs,1892
|
|
253
253
|
clearskies/validators/unique.py,sha256=GFEQOMYRIO9pSGHHj6zf1GdnJ0UM7Dm4ZO4uGn19BZo,991
|
|
254
|
-
clear_skies-2.0.
|
|
255
|
-
clear_skies-2.0.
|
|
256
|
-
clear_skies-2.0.
|
|
257
|
-
clear_skies-2.0.
|
|
254
|
+
clear_skies-2.0.13.dist-info/METADATA,sha256=-vCQH5UBp10JkiJslrdn99Gg4FAvuEjusoEU-lypGkY,2114
|
|
255
|
+
clear_skies-2.0.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
256
|
+
clear_skies-2.0.13.dist-info/licenses/LICENSE,sha256=3Ehd0g3YOpCj8sqj0Xjq5qbOtjjgk9qzhhD9YjRQgOA,1053
|
|
257
|
+
clear_skies-2.0.13.dist-info/RECORD,,
|
|
@@ -7,7 +7,7 @@ from clearskies.configs import config
|
|
|
7
7
|
|
|
8
8
|
class Callable(config.Config):
|
|
9
9
|
def __set__(self, instance, value: CallableType):
|
|
10
|
-
if not callable(value):
|
|
10
|
+
if value is not None and not callable(value):
|
|
11
11
|
error_prefix = self._error_prefix(instance)
|
|
12
12
|
raise TypeError(
|
|
13
13
|
f"{error_prefix} attempt to set a value of type '{value.__class__.__name__}' to a parameter that requries a Callable."
|
clearskies/contexts/wsgi.py
CHANGED
|
@@ -3,9 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
from typing import TYPE_CHECKING
|
|
4
4
|
|
|
5
5
|
from clearskies.contexts.context import Context
|
|
6
|
-
|
|
7
|
-
if TYPE_CHECKING:
|
|
8
|
-
from clearskies.input_outputs import Wsgi as WsgiInputOutput
|
|
6
|
+
from clearskies.input_outputs import Wsgi as WsgiInputOutput
|
|
9
7
|
|
|
10
8
|
|
|
11
9
|
class Wsgi(Context):
|
clearskies/contexts/wsgi_ref.py
CHANGED
|
@@ -7,12 +7,12 @@ from wsgiref.simple_server import make_server
|
|
|
7
7
|
from wsgiref.util import setup_testing_defaults
|
|
8
8
|
|
|
9
9
|
from clearskies.contexts.context import Context
|
|
10
|
+
from clearskies.input_outputs import Wsgi as WsgiInputOutput
|
|
10
11
|
|
|
11
12
|
if TYPE_CHECKING:
|
|
12
13
|
from clearskies.di import AdditionalConfig
|
|
13
14
|
from clearskies.endpoint import Endpoint
|
|
14
15
|
from clearskies.endpoint_group import EndpointGroup
|
|
15
|
-
from clearskies.input_outputs import Wsgi as WsgiInputOutput
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class WsgiRef(Context):
|
|
@@ -1,47 +1,53 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import re
|
|
4
|
+
from typing import TypeVar
|
|
4
5
|
|
|
6
|
+
_T = TypeVar("_T")
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
class Headers(dict[str, str]):
|
|
8
10
|
_duck_cheat = "headers"
|
|
9
11
|
|
|
10
|
-
def __init__(self, headers: dict[str, str] = {}):
|
|
11
|
-
|
|
12
|
+
def __init__(self, headers: dict[str, str] = {}) -> None:
|
|
13
|
+
normalized_headers = (
|
|
12
14
|
{key.upper().replace("_", "-"): value for (key, value) in headers.items()} if headers else {}
|
|
13
15
|
)
|
|
16
|
+
super().__init__(normalized_headers)
|
|
14
17
|
|
|
15
|
-
def __contains__(self, key:
|
|
16
|
-
|
|
18
|
+
def __contains__(self, key: object) -> bool:
|
|
19
|
+
if not isinstance(key, str):
|
|
20
|
+
return False
|
|
21
|
+
return super().__contains__(key.upper().replace("_", "-"))
|
|
17
22
|
|
|
18
|
-
def
|
|
19
|
-
return
|
|
23
|
+
def __getitem__(self, key: str) -> str:
|
|
24
|
+
return super().__getitem__(key.upper().replace("_", "-"))
|
|
20
25
|
|
|
21
|
-
def
|
|
26
|
+
def __setitem__(self, key: str, value: str) -> None:
|
|
22
27
|
if not isinstance(key, str):
|
|
23
28
|
raise TypeError(
|
|
24
|
-
f"Header keys must be strings, but an object of type '{
|
|
29
|
+
f"Header keys must be strings, but an object of type '{key.__class__.__name__}' was provided."
|
|
25
30
|
)
|
|
26
31
|
if not isinstance(value, str):
|
|
27
32
|
raise TypeError(
|
|
28
33
|
f"Header values must be strings, but an object of type '{value.__class__.__name__}' was provided."
|
|
29
34
|
)
|
|
30
|
-
|
|
35
|
+
normalized_key = re.sub("\\s+", " ", key.upper().replace("_", "-"))
|
|
36
|
+
normalized_value = re.sub("\\s+", " ", value.strip())
|
|
37
|
+
super().__setitem__(normalized_key, normalized_value)
|
|
31
38
|
|
|
32
|
-
def
|
|
33
|
-
|
|
34
|
-
return default
|
|
35
|
-
return self.__getattr__(key)
|
|
36
|
-
|
|
37
|
-
def keys(self) -> list[str]:
|
|
38
|
-
return list(self._headers.keys())
|
|
39
|
-
|
|
40
|
-
def values(self) -> list[str]:
|
|
41
|
-
return list(self._headers.keys())
|
|
39
|
+
def __getattr__(self, key: str) -> str | None:
|
|
40
|
+
return self.get(key.upper().replace("_", "-"), None)
|
|
42
41
|
|
|
43
|
-
def
|
|
44
|
-
|
|
42
|
+
def __setattr__(self, key: str, value: str) -> None:
|
|
43
|
+
if key.startswith("_") or key == "_duck_cheat":
|
|
44
|
+
# Allow setting private attributes and special attributes normally
|
|
45
|
+
super().__setattr__(key, value)
|
|
46
|
+
else:
|
|
47
|
+
self.__setitem__(key, value)
|
|
48
|
+
|
|
49
|
+
def get(self, key: str, default: _T = None) -> str | _T: # type: ignore[assignment]
|
|
50
|
+
return super().get(key.upper().replace("_", "-"), default)
|
|
45
51
|
|
|
46
52
|
def add(self, key: str, value: str) -> None:
|
|
47
53
|
"""Add a header. This expects a string with a colon separating the key and value."""
|
clearskies/input_outputs/wsgi.py
CHANGED
|
File without changes
|
|
File without changes
|