fresco 3.5.0__py3-none-any.whl → 3.6.0__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 fresco might be problematic. Click here for more details.
- fresco/__init__.py +55 -56
- fresco/core.py +33 -23
- fresco/decorators.py +6 -3
- fresco/defaults.py +1 -0
- fresco/middleware.py +4 -4
- fresco/multidict.py +35 -51
- fresco/options.py +146 -75
- fresco/request.py +155 -34
- fresco/requestcontext.py +3 -0
- fresco/response.py +12 -9
- fresco/routeargs.py +23 -9
- fresco/routing.py +74 -56
- fresco/static.py +1 -1
- fresco/subrequests.py +1 -1
- fresco/tests/test_core.py +4 -4
- fresco/tests/test_multidict.py +2 -2
- fresco/tests/test_options.py +40 -16
- fresco/tests/test_request.py +21 -10
- fresco/tests/test_routing.py +36 -33
- fresco/tests/util/test_http.py +1 -3
- fresco/types.py +28 -2
- fresco/util/cache.py +2 -1
- fresco/util/http.py +66 -46
- fresco/util/urls.py +13 -11
- fresco/util/wsgi.py +15 -14
- {fresco-3.5.0.dist-info → fresco-3.6.0.dist-info}/METADATA +3 -2
- {fresco-3.5.0.dist-info → fresco-3.6.0.dist-info}/RECORD +30 -30
- {fresco-3.5.0.dist-info → fresco-3.6.0.dist-info}/WHEEL +1 -1
- fresco/typing.py +0 -17
- {fresco-3.5.0.dist-info → fresco-3.6.0.dist-info/licenses}/LICENSE.txt +0 -0
- {fresco-3.5.0.dist-info → fresco-3.6.0.dist-info}/top_level.txt +0 -0
fresco/util/wsgi.py
CHANGED
|
@@ -22,15 +22,16 @@ from io import BytesIO
|
|
|
22
22
|
from urllib.parse import unquote
|
|
23
23
|
from urllib.parse import urlparse
|
|
24
24
|
from typing import List
|
|
25
|
-
|
|
26
|
-
from typing import Tuple
|
|
25
|
+
import typing as t
|
|
27
26
|
import sys
|
|
28
27
|
|
|
29
|
-
from fresco.
|
|
30
|
-
from fresco.
|
|
31
|
-
from fresco.
|
|
28
|
+
from fresco.types import WSGIApplication
|
|
29
|
+
from fresco.types import WriteCallable
|
|
30
|
+
from fresco.types import OptionalExcInfo
|
|
31
|
+
from fresco.types import HeaderList
|
|
32
32
|
|
|
33
33
|
logger = logging.getLogger(__name__)
|
|
34
|
+
T = t.TypeVar("T")
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
__all__ = [
|
|
@@ -102,7 +103,6 @@ REQUEST_HEADER_NAMES = {
|
|
|
102
103
|
"dnt": "DNT",
|
|
103
104
|
"x_forwarded_for": "X-Forwarded-For",
|
|
104
105
|
"x_forwarded_host": "X-Forwarded-Host",
|
|
105
|
-
"x_forwarded_host": "X-Forwarded-Host",
|
|
106
106
|
"x_forwarded_proto": "X-Forwarded-Proto",
|
|
107
107
|
"front_end_https": "Front-End-Https",
|
|
108
108
|
"x_http_method_override": "X-Http-Method-Override",
|
|
@@ -245,8 +245,8 @@ class StartResponseWrapper(object):
|
|
|
245
245
|
self.exc_info = None
|
|
246
246
|
|
|
247
247
|
|
|
248
|
-
class ClosingIterator(
|
|
249
|
-
"""
|
|
248
|
+
class ClosingIterator(t.Generic[T]):
|
|
249
|
+
"""
|
|
250
250
|
Wrap a WSGI iterator to allow additional close functions to be called on
|
|
251
251
|
application exit.
|
|
252
252
|
|
|
@@ -275,7 +275,7 @@ class ClosingIterator(object):
|
|
|
275
275
|
|
|
276
276
|
__slots__ = ("_iterable", "_next", "_close_funcs", "_closed")
|
|
277
277
|
|
|
278
|
-
def __init__(self, iterable, *close_funcs):
|
|
278
|
+
def __init__(self, iterable: t.Iterable[T], *close_funcs: t.Callable[[], None]):
|
|
279
279
|
"""
|
|
280
280
|
Initialize a ``ClosingIterator`` to wrap iterable ``iterable``, and
|
|
281
281
|
call any functions listed in ``*close_funcs`` on the instance's
|
|
@@ -406,19 +406,20 @@ def make_environ(url="/", environ=None, wsgi_input=b"", **kwargs):
|
|
|
406
406
|
|
|
407
407
|
|
|
408
408
|
def apply_request(
|
|
409
|
-
request, wsgicallable:
|
|
410
|
-
) ->
|
|
409
|
+
request, wsgicallable: WSGIApplication
|
|
410
|
+
) -> tuple[str, HeaderList, OptionalExcInfo, list[bytes]]:
|
|
411
411
|
"""
|
|
412
412
|
Execute ``wsgicallable`` with the given request, exhaust and close the
|
|
413
413
|
content iterator and return the result.
|
|
414
414
|
"""
|
|
415
415
|
|
|
416
|
-
_start_response_result:
|
|
416
|
+
_start_response_result: list[tuple[str, HeaderList, OptionalExcInfo]] = []
|
|
417
417
|
|
|
418
418
|
def start_response(
|
|
419
|
-
status: str, headers: HeaderList, exc_info:
|
|
420
|
-
):
|
|
419
|
+
status: str, headers: HeaderList, exc_info: OptionalExcInfo = None
|
|
420
|
+
) -> WriteCallable:
|
|
421
421
|
_start_response_result.append((status, headers, exc_info))
|
|
422
|
+
return lambda s: None
|
|
422
423
|
|
|
423
424
|
contentiter = wsgicallable(request.environ, start_response)
|
|
424
425
|
assert len(_start_response_result) == 1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: fresco
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.6.0
|
|
4
4
|
Summary: A Web/WSGI micro-framework
|
|
5
5
|
Author-email: Oliver Cope <oliver@redgecko.org>
|
|
6
6
|
License: Apache
|
|
@@ -16,6 +16,7 @@ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
|
16
16
|
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
|
|
17
17
|
Description-Content-Type: text/x-rst
|
|
18
18
|
License-File: LICENSE.txt
|
|
19
|
+
Dynamic: license-file
|
|
19
20
|
|
|
20
21
|
Fresco, a web micro-framework for Python
|
|
21
22
|
========================================
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
fresco/__init__.py,sha256=
|
|
1
|
+
fresco/__init__.py,sha256=02YPwizUXGa9L8OrpfoX9edVv6ISiCdIOyqR0LvYYWA,3537
|
|
2
2
|
fresco/cookie.py,sha256=Qnx8yOjU4LUJ1fqi7YvqbhAA01rCsclJGl_fxI68slw,7055
|
|
3
|
-
fresco/core.py,sha256=
|
|
4
|
-
fresco/decorators.py,sha256=
|
|
3
|
+
fresco/core.py,sha256=bqGDgm4OH46j6HqnC5nJyn9n1dQw-I1ntUY8dIpeO_M,26988
|
|
4
|
+
fresco/decorators.py,sha256=JL4MlsJz4RWRAuOCCB3fx3rtd-E1CvwO2MD7bf94yHM,3324
|
|
5
|
+
fresco/defaults.py,sha256=YStD4MPcCtq-fREFoupSaAS0SY8lH1oEnKDONlR86zs,26
|
|
5
6
|
fresco/exceptions.py,sha256=KE-LoYUGnho6KltzkU6cnm9vUiUhAiDIjPqn5ba-YCA,4410
|
|
6
|
-
fresco/middleware.py,sha256=
|
|
7
|
-
fresco/multidict.py,sha256=
|
|
8
|
-
fresco/options.py,sha256=
|
|
7
|
+
fresco/middleware.py,sha256=TH1I5NthLDwnOdluOSFpP_9SQQYhYqh-8lGuAXT74dc,4811
|
|
8
|
+
fresco/multidict.py,sha256=lKRpSP1XNghLp2-i5cXPfPQxuoJclHpNkWk91F4GI1o,13152
|
|
9
|
+
fresco/options.py,sha256=X66xZV45vWIyQR2GwFTLgV2QGoXOfLhHURWQ_edoxmY,17024
|
|
9
10
|
fresco/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
fresco/request.py,sha256=
|
|
11
|
-
fresco/requestcontext.py,sha256=
|
|
12
|
-
fresco/response.py,sha256=
|
|
13
|
-
fresco/routeargs.py,sha256=
|
|
14
|
-
fresco/routing.py,sha256=
|
|
15
|
-
fresco/static.py,sha256=
|
|
16
|
-
fresco/subrequests.py,sha256=
|
|
17
|
-
fresco/types.py,sha256=
|
|
18
|
-
fresco/typing.py,sha256=uQWLElgVCJSZ3X2OkGNu-1ihmPvytyqSLguPB6tm-Pc,412
|
|
11
|
+
fresco/request.py,sha256=XJ9SJAe9zILfWt-YB4zxjIrjECrLYzyxjZ9xk8h4tAw,30024
|
|
12
|
+
fresco/requestcontext.py,sha256=_AJ7DMT5vlIO4Uc-WlRsYJdRge4WRO7ygibKImOS0iM,3601
|
|
13
|
+
fresco/response.py,sha256=ilJ_Wbp7LVP1E6bXp0iAy1o6D0hboXtpLvm2ZCmUGmk,37277
|
|
14
|
+
fresco/routeargs.py,sha256=E-LQutqg6AojtagZojF7NeMjFBk9joRNMGo842IMTBk,10598
|
|
15
|
+
fresco/routing.py,sha256=r_vPD1xc7brOrbw1iO0X2IP7WX5wlIWlcXwcNndU1ZY,61259
|
|
16
|
+
fresco/static.py,sha256=rNQz_8-PVhSGup_w-HycqatLEbFes7VSlnNQ0rz24pU,2529
|
|
17
|
+
fresco/subrequests.py,sha256=fOG9Bd3w9Ova0S3qv5ssxQ_otrSxaFcKG7TOy6CxNCg,11068
|
|
18
|
+
fresco/types.py,sha256=PbXppEcckX4ohU8npteU1mCkHOuXQxrnqxk1RNEFXkE,797
|
|
19
19
|
fresco/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
fresco/tests/fixtures.py,sha256=eyo2zPivB3fItDkrJqWnOCvIS_A1q1JEhT4AutAB--o,1871
|
|
21
21
|
fresco/tests/test_cookie.py,sha256=HTLmNCjcPoZDeFnZAzY3lJPeduzgU4mi9C-74eSQCec,2171
|
|
22
|
-
fresco/tests/test_core.py,sha256
|
|
22
|
+
fresco/tests/test_core.py,sha256=-eibrVd8UqPqTvcar54kt24m6_lX3mxXR8L7v-WDrWw,34003
|
|
23
23
|
fresco/tests/test_decorators.py,sha256=VFXHo1gm2jldQXeaEF3NNo5fnpdJ-LXc8-vNymPJKTQ,1480
|
|
24
24
|
fresco/tests/test_exceptions.py,sha256=R0Tn86m33iTKecZ69TgH4CqY9XSFP0FsLMH10O5Jth8,973
|
|
25
25
|
fresco/tests/test_middleware.py,sha256=D_sWfX-w3bhItOm54nB_cuYPGoWopISvZCFIuMX68cU,3137
|
|
26
|
-
fresco/tests/test_multidict.py,sha256=
|
|
27
|
-
fresco/tests/test_options.py,sha256=
|
|
28
|
-
fresco/tests/test_request.py,sha256=
|
|
26
|
+
fresco/tests/test_multidict.py,sha256=uIa1cu5DMAukX2nLOjTiB12oh0icBeSPfsUnqsu85m0,7577
|
|
27
|
+
fresco/tests/test_options.py,sha256=394MLLTyf4vmfkUyqQ8EGIiTTJsQh7P9M6eta2wgUbw,12764
|
|
28
|
+
fresco/tests/test_request.py,sha256=wGDwxCZMbzyGgQJwM2Nlsf0ogcGenXN3srO8dQEhE24,16777
|
|
29
29
|
fresco/tests/test_requestcontext.py,sha256=t8hm-lzIk85ryb3sdlpVoPQyLDWpCjB86dg8nVG1yRw,3115
|
|
30
30
|
fresco/tests/test_response.py,sha256=MrhHIDg81pJlTeEcn2rGtU-i59s1KzEccF81u4Up6xs,8934
|
|
31
31
|
fresco/tests/test_routeargs.py,sha256=VMWUbrXegTLN9Tx2AcrpbjAAEaxAANzkcy02SmpFOmY,8162
|
|
32
|
-
fresco/tests/test_routing.py,sha256=
|
|
32
|
+
fresco/tests/test_routing.py,sha256=NBBJ6UcsdSoUAFNgUtCC0lEEeKB6JxS8XyrUeef25M8,40018
|
|
33
33
|
fresco/tests/test_static.py,sha256=y73dqzE2flpACQ_dvNhDzk_WlvNQfkhYF_8YY4MMGDo,4686
|
|
34
34
|
fresco/tests/test_subrequests.py,sha256=7rluJnw-elXRXfrzvAQvGBHRBU93zwnL827mTxBGd3Y,7909
|
|
35
35
|
fresco/tests/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
36
|
fresco/tests/util/form_data.py,sha256=TalOuv4BGM3JNrf14tE47o9wAwZ7jA1CvRDnGJFifno,10570
|
|
37
37
|
fresco/tests/util/test_common.py,sha256=NvKX8KIAUki7b2kDLILWqARbOQmR3XyInLlbcwFEhiU,1117
|
|
38
|
-
fresco/tests/util/test_http.py,sha256=
|
|
38
|
+
fresco/tests/util/test_http.py,sha256=mdHDc-4m9sMNkEgHToIsgFuSSXQzNUcYSehPehYvJYo,10748
|
|
39
39
|
fresco/tests/util/test_security.py,sha256=MtpDDKyDhAeRT766Lt3peOv4Jj55TM1lvJk1_5TKaes,1492
|
|
40
40
|
fresco/tests/util/test_urls.py,sha256=xKiE6oq0bB-9u8kNYlMQmeCwuAKr1KLQovB-i24wKVQ,7643
|
|
41
41
|
fresco/tests/util/test_wsgi.py,sha256=VsHUCo8yck_40nsYm-H-M0R8QYEE8JcboeGPbcrzsO0,3038
|
|
42
42
|
fresco/util/__init__.py,sha256=mJkaZzvYgBnxsBAGv8y_P1yzonHqWgw6VF2Zs4rmJEA,7
|
|
43
|
-
fresco/util/cache.py,sha256=
|
|
43
|
+
fresco/util/cache.py,sha256=0xINmBecCYo3h5-zU_yRyJeWmROygE3pO9w9Y3ZONcs,1661
|
|
44
44
|
fresco/util/common.py,sha256=8lvrjhELvYsUWxu7DZi1OJcUOFk2ILYndNsnaS0IqjM,1258
|
|
45
45
|
fresco/util/contentencodings.py,sha256=cCP-nSlXiBAZWoJdlnrQREi9jYRu8UY327bQdfBNlkg,5527
|
|
46
46
|
fresco/util/file.py,sha256=Vp7qJTo9RouUeHq25ExyBGkGTHuW-9Q7D_0GB54DFe8,1383
|
|
47
|
-
fresco/util/http.py,sha256=
|
|
47
|
+
fresco/util/http.py,sha256=hxMKjF6FWvugDvToRqSscDhCD1KdVY1bmV4Unwd_Uhs,22672
|
|
48
48
|
fresco/util/io.py,sha256=xxwDNJOcewY8lAR4Ce3cmB_zlrys8JGsESgwGWE198Y,1289
|
|
49
49
|
fresco/util/object.py,sha256=FjYNfPHzvBqq1rn0Y6As-2AVZ_SZOjH-lrSy4EbYmHY,370
|
|
50
50
|
fresco/util/security.py,sha256=nXEdoCak_2c4OA1L1wGwhZygS22s2fzwR0Kp-DdwKZg,1058
|
|
51
51
|
fresco/util/textproc.py,sha256=e5jLTofKCqdm6_Fy8XOyR43AJr5APtL59Kd8cNA9PrQ,2309
|
|
52
|
-
fresco/util/urls.py,sha256=
|
|
53
|
-
fresco/util/wsgi.py,sha256=
|
|
54
|
-
fresco-3.
|
|
55
|
-
fresco-3.
|
|
56
|
-
fresco-3.
|
|
57
|
-
fresco-3.
|
|
58
|
-
fresco-3.
|
|
52
|
+
fresco/util/urls.py,sha256=2vDbfmjBLtUVpZ0ZhoNWkzn2WVZxcZZQeBZjtcUDp3w,9276
|
|
53
|
+
fresco/util/wsgi.py,sha256=RYw4KeOUjzzPOL_HhEtgLyCngofjMdAT8BTLOSKU6KA,13021
|
|
54
|
+
fresco-3.6.0.dist-info/licenses/LICENSE.txt,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
55
|
+
fresco-3.6.0.dist-info/METADATA,sha256=zfjV8OUXV-2-dRpwNilk8cgduTx8ZUq8dw_IcClwnuQ,1571
|
|
56
|
+
fresco-3.6.0.dist-info/WHEEL,sha256=GHB6lJx2juba1wDgXDNlMTyM13ckjBMKf-OnwgKOCtA,91
|
|
57
|
+
fresco-3.6.0.dist-info/top_level.txt,sha256=p_1aMce5Shjq9fIfdbB-aN8wCDhjF_iYnn98bUebbII,7
|
|
58
|
+
fresco-3.6.0.dist-info/RECORD,,
|
fresco/typing.py
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
from types import TracebackType
|
|
2
|
-
from typing import Any
|
|
3
|
-
from typing import Callable
|
|
4
|
-
from typing import Iterable
|
|
5
|
-
|
|
6
|
-
HeaderList = list[tuple[str, str]]
|
|
7
|
-
HeadersList = HeaderList
|
|
8
|
-
WSGIEnviron = dict[str, Any]
|
|
9
|
-
StartResponse = Callable[[str, HeaderList], None]
|
|
10
|
-
WSGICallable = Callable[
|
|
11
|
-
[
|
|
12
|
-
WSGIEnviron,
|
|
13
|
-
StartResponse,
|
|
14
|
-
],
|
|
15
|
-
Iterable[bytes]
|
|
16
|
-
]
|
|
17
|
-
ExcInfoTuple = tuple[type, BaseException, TracebackType]
|
|
File without changes
|
|
File without changes
|