asgi-tools 2.1.3__tar.gz → 2.2.2__tar.gz

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.
Files changed (44) hide show
  1. {asgi_tools-2.1.3/asgi_tools.egg-info → asgi_tools-2.2.2}/PKG-INFO +3 -4
  2. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/_compat.py +1 -10
  3. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/request.py +2 -2
  4. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/response.py +5 -3
  5. {asgi_tools-2.1.3 → asgi_tools-2.2.2/asgi_tools.egg-info}/PKG-INFO +3 -4
  6. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools.egg-info/requires.txt +2 -4
  7. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/pyproject.toml +4 -4
  8. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/LICENSE +0 -0
  9. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/MANIFEST.in +0 -0
  10. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/README.rst +0 -0
  11. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/__init__.py +0 -0
  12. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/app.py +0 -0
  13. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/constants.py +0 -0
  14. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/errors.py +0 -0
  15. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/forms.py +0 -0
  16. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/forms.pyx +0 -0
  17. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/logs.py +0 -0
  18. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/middleware.py +0 -0
  19. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/multipart.pxd +0 -0
  20. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/multipart.py +0 -0
  21. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/multipart.pyx +0 -0
  22. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/py.typed +0 -0
  23. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/router.py +0 -0
  24. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/tests.py +0 -0
  25. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/types.py +0 -0
  26. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/utils.py +0 -0
  27. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools/view.py +0 -0
  28. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools.egg-info/SOURCES.txt +0 -0
  29. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools.egg-info/dependency_links.txt +0 -0
  30. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/asgi_tools.egg-info/top_level.txt +0 -0
  31. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/setup.cfg +0 -0
  32. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/setup.py +0 -0
  33. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/tests/test_app.py +0 -0
  34. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/tests/test_benchmarks.py +0 -0
  35. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/tests/test_client.py +0 -0
  36. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/tests/test_compat.py +0 -0
  37. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/tests/test_compatibility.py +0 -0
  38. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/tests/test_examples.py +0 -0
  39. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/tests/test_formdata.py +0 -0
  40. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/tests/test_middlewares.py +0 -0
  41. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/tests/test_request.py +0 -0
  42. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/tests/test_responses.py +0 -0
  43. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/tests/test_types.py +0 -0
  44. {asgi_tools-2.1.3 → asgi_tools-2.2.2}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: asgi-tools
3
- Version: 2.1.3
3
+ Version: 2.2.2
4
4
  Summary: ASGI Toolkit to build web applications
5
5
  Author-email: Kirill Klenov <horneds@gmail.com>
6
6
  License: MIT License
@@ -40,11 +40,9 @@ Requires-Dist: PyYAML; extra == "tests"
40
40
  Requires-Dist: ruff; extra == "tests"
41
41
  Requires-Dist: mypy; extra == "tests"
42
42
  Requires-Dist: exceptiongroup; python_version < "3.11" and extra == "tests"
43
- Requires-Dist: ujson; implementation_name == "cpython" and extra == "tests"
43
+ Requires-Dist: orjson; implementation_name == "cpython" and extra == "tests"
44
44
  Requires-Dist: uvloop; implementation_name == "cpython" and extra == "tests"
45
45
  Requires-Dist: pytest-mypy; implementation_name == "cpython" and extra == "tests"
46
- Provides-Extra: ujson
47
- Requires-Dist: ujson; extra == "ujson"
48
46
  Provides-Extra: orjson
49
47
  Requires-Dist: orjson; extra == "orjson"
50
48
  Provides-Extra: examples
@@ -58,6 +56,7 @@ Requires-Dist: cython; extra == "dev"
58
56
  Requires-Dist: pre-commit; extra == "dev"
59
57
  Requires-Dist: sphinx; extra == "dev"
60
58
  Requires-Dist: pydata-sphinx-theme; extra == "dev"
59
+ Requires-Dist: sphinx-copybutton; extra == "dev"
61
60
  Dynamic: license-file
62
61
 
63
62
  .. image:: https://raw.githubusercontent.com/klen/asgi-tools/develop/.github/assets/asgi-tools.png
@@ -44,7 +44,7 @@ __all__ = (
44
44
  try:
45
45
  from asyncio import timeout as asyncio_timeout # type: ignore[attr-defined]
46
46
  except ImportError: # python 310
47
- from async_timeout import timeout as asyncio_timeout # type: ignore[no-redef]
47
+ from async_timeout import timeout as asyncio_timeout # type: ignore[assignment,no-redef]
48
48
 
49
49
 
50
50
  aiofile_installed = False
@@ -244,15 +244,6 @@ def json_loads(obj: bytes | str) -> TJSON:
244
244
  return loads(obj)
245
245
 
246
246
 
247
- with suppress(ImportError):
248
- from ujson import dumps as udumps
249
- from ujson import loads as json_loads # type: ignore[assignment]
250
-
251
- def json_dumps(content) -> bytes:
252
- """Emulate orjson."""
253
- return udumps(content, ensure_ascii=False).encode("utf-8")
254
-
255
-
256
247
  with suppress(ImportError):
257
248
  from orjson import dumps as json_dumps # type: ignore[assignment,no-redef]
258
249
  from orjson import loads as json_loads # type: ignore[assignment,no-redef]
@@ -5,7 +5,7 @@ incoming request.
5
5
  from __future__ import annotations
6
6
 
7
7
  from http import cookies
8
- from typing import TYPE_CHECKING, Any, AsyncGenerator, Iterator, Mapping, Protocol, TypeVar
8
+ from typing import TYPE_CHECKING, Any, AsyncGenerator, Iterator, Mapping, Protocol, TypeVar, cast
9
9
 
10
10
  from yarl import URL
11
11
 
@@ -206,7 +206,7 @@ class Request(TASGIScope):
206
206
  :py:class:`multidict.MultiDict`.
207
207
 
208
208
  """
209
- return self.url.query
209
+ return cast("MultiDictProxy[str]", self.url.query)
210
210
 
211
211
  @property
212
212
  def content_type(self) -> str:
@@ -144,9 +144,8 @@ class ResponseHTML(Response):
144
144
  class ResponseJSON(Response):
145
145
  """Returns JSON responses (application/json).
146
146
 
147
- The class optionally supports `ujson <https://pypi.org/project/ujson/>`_ and `orjson
148
- <https://pypi.org/project/orjson/>`_ JSON libraries. Install one of them to use instead
149
- the standard library.
147
+ The class optionally supports `orjson <https://pypi.org/project/orjson/>`_ for faster
148
+ JSON handling. Install it to use instead of the standard library.
150
149
 
151
150
  """
152
151
 
@@ -404,6 +403,9 @@ class ResponseErrorMeta(type):
404
403
 
405
404
  def __getattr__(cls, name: str) -> partial[ResponseError]:
406
405
  """Generate Response Errors by HTTP names."""
406
+ if name.startswith("__") and name.endswith("__"):
407
+ msg = f"type object '{cls.__name__}' has no attribute '{name}'"
408
+ raise AttributeError(msg)
407
409
  status = HTTPStatus[name]
408
410
  return partial(cls, status_code=status.value)
409
411
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: asgi-tools
3
- Version: 2.1.3
3
+ Version: 2.2.2
4
4
  Summary: ASGI Toolkit to build web applications
5
5
  Author-email: Kirill Klenov <horneds@gmail.com>
6
6
  License: MIT License
@@ -40,11 +40,9 @@ Requires-Dist: PyYAML; extra == "tests"
40
40
  Requires-Dist: ruff; extra == "tests"
41
41
  Requires-Dist: mypy; extra == "tests"
42
42
  Requires-Dist: exceptiongroup; python_version < "3.11" and extra == "tests"
43
- Requires-Dist: ujson; implementation_name == "cpython" and extra == "tests"
43
+ Requires-Dist: orjson; implementation_name == "cpython" and extra == "tests"
44
44
  Requires-Dist: uvloop; implementation_name == "cpython" and extra == "tests"
45
45
  Requires-Dist: pytest-mypy; implementation_name == "cpython" and extra == "tests"
46
- Provides-Extra: ujson
47
- Requires-Dist: ujson; extra == "ujson"
48
46
  Provides-Extra: orjson
49
47
  Requires-Dist: orjson; extra == "orjson"
50
48
  Provides-Extra: examples
@@ -58,6 +56,7 @@ Requires-Dist: cython; extra == "dev"
58
56
  Requires-Dist: pre-commit; extra == "dev"
59
57
  Requires-Dist: sphinx; extra == "dev"
60
58
  Requires-Dist: pydata-sphinx-theme; extra == "dev"
59
+ Requires-Dist: sphinx-copybutton; extra == "dev"
61
60
  Dynamic: license-file
62
61
 
63
62
  .. image:: https://raw.githubusercontent.com/klen/asgi-tools/develop/.github/assets/asgi-tools.png
@@ -13,6 +13,7 @@ cython
13
13
  pre-commit
14
14
  sphinx
15
15
  pydata-sphinx-theme
16
+ sphinx-copybutton
16
17
 
17
18
  [examples]
18
19
  uvicorn[standard]
@@ -32,12 +33,9 @@ ruff
32
33
  mypy
33
34
 
34
35
  [tests:implementation_name == "cpython"]
35
- ujson
36
+ orjson
36
37
  uvloop
37
38
  pytest-mypy
38
39
 
39
40
  [tests:python_version < "3.11"]
40
41
  exceptiongroup
41
-
42
- [ujson]
43
- ujson
@@ -3,7 +3,7 @@ requires = ["setuptools", "wheel", "Cython"]
3
3
 
4
4
  [project]
5
5
  name = "asgi-tools"
6
- version = "2.1.3"
6
+ version = "2.2.2"
7
7
  description = "ASGI Toolkit to build web applications"
8
8
  readme = "README.rst"
9
9
  requires-python = ">=3.10,<4"
@@ -50,11 +50,10 @@ tests = [
50
50
  "ruff",
51
51
  "mypy",
52
52
  "exceptiongroup;python_version<'3.11'",
53
- "ujson; implementation_name == 'cpython'",
53
+ "orjson; implementation_name == 'cpython'",
54
54
  "uvloop; implementation_name == 'cpython'",
55
55
  "pytest-mypy; implementation_name == 'cpython'",
56
56
  ]
57
- ujson = ["ujson"]
58
57
  orjson = ["orjson"]
59
58
  examples = ["uvicorn[standard]", "jinja2", "httpx"]
60
59
  dev = [
@@ -64,6 +63,7 @@ dev = [
64
63
  "pre-commit",
65
64
  "sphinx",
66
65
  "pydata-sphinx-theme",
66
+ "sphinx-copybutton",
67
67
  ]
68
68
 
69
69
  [tool.setuptools]
@@ -139,7 +139,7 @@ required-imports = ["from __future__ import annotations"]
139
139
  ]
140
140
 
141
141
  [tool.bumpversion]
142
- current_version = "2.1.3"
142
+ current_version = "2.2.2"
143
143
  commit = false
144
144
  tag = false
145
145
  message = "build: Bump version: {current_version} → {new_version}"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes