anyquart 0.1.1__tar.gz → 0.2.0__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 (39) hide show
  1. {anyquart-0.1.1 → anyquart-0.2.0}/PKG-INFO +1 -1
  2. {anyquart-0.1.1 → anyquart-0.2.0}/pyproject.toml +3 -10
  3. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/app.py +10 -3
  4. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/helpers.py +1 -29
  5. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/testing/connections.py +7 -8
  6. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/views.py +1 -1
  7. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/wrappers/response.py +2 -5
  8. {anyquart-0.1.1 → anyquart-0.2.0}/LICENSE.txt +0 -0
  9. {anyquart-0.1.1 → anyquart-0.2.0}/README.md +0 -0
  10. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/__init__.py +0 -0
  11. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/__main__.py +0 -0
  12. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/asgi.py +0 -0
  13. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/blueprints.py +0 -0
  14. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/cli.py +0 -0
  15. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/config.py +0 -0
  16. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/ctx.py +0 -0
  17. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/datastructures.py +0 -0
  18. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/debug.py +0 -0
  19. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/formparser.py +0 -0
  20. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/globals.py +0 -0
  21. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/json/__init__.py +0 -0
  22. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/json/provider.py +0 -0
  23. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/json/tag.py +0 -0
  24. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/logging.py +0 -0
  25. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/py.typed +0 -0
  26. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/routing.py +0 -0
  27. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/sessions.py +0 -0
  28. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/signals.py +0 -0
  29. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/templating.py +0 -0
  30. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/testing/__init__.py +0 -0
  31. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/testing/app.py +0 -0
  32. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/testing/client.py +0 -0
  33. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/testing/utils.py +0 -0
  34. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/typing.py +0 -0
  35. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/utils.py +0 -0
  36. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/wrappers/__init__.py +0 -0
  37. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/wrappers/base.py +0 -0
  38. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/wrappers/request.py +0 -0
  39. {anyquart-0.1.1 → anyquart-0.2.0}/src/anyquart/wrappers/websocket.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: anyquart
3
- Version: 0.1.1
3
+ Version: 0.2.0
4
4
  Summary: A fork of Quart that uses AnyIO
5
5
  Author-email: pgjones <philip.graham.jones@googlemail.com>, NIYONSHUTI Emmanuel <emmanuelniyonshuti13@gmail.com>
6
6
  Maintainer-email: NIYONSHUTI Emmanuel <emmanuelniyonshuti13@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "anyquart"
3
- version = "0.1.1"
3
+ version = "0.2.0"
4
4
  description = "A fork of Quart that uses AnyIO"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -107,19 +107,12 @@ exclude_also = [
107
107
  ]
108
108
 
109
109
  [tool.mypy]
110
- python_version = "3.10"
111
- files = ["src", "tests"]
112
- show_error_codes = true
113
- pretty = true
110
+ python_version = "3.14"
114
111
  strict = true
115
- # TODO fully satisfy strict mode and remove these customizations
116
- allow_redefinition = true
117
112
  disallow_any_generics = false
118
- disallow_untyped_calls = false
119
- implicit_reexport = true
120
- no_implicit_optional = true
121
113
  strict_optional = false
122
114
  warn_return_any = false
115
+ files = ["src", "tests"]
123
116
 
124
117
  [tool.pyright]
125
118
  pythonVersion = "3.10"
@@ -1143,7 +1143,7 @@ class AnyQuart(App):
1143
1143
  .. versionadded:: 0.11
1144
1144
 
1145
1145
  Override if you wish to change how synchronous functions are
1146
- run. Before anyquart 0.11 this did not run the synchronous code
1146
+ run. Before quart 0.11 this did not run the synchronous code
1147
1147
  in an executor.
1148
1148
  """
1149
1149
  if iscoroutinefunction(func):
@@ -1340,7 +1340,12 @@ class AnyQuart(App):
1340
1340
  request.body.set_result(request_body)
1341
1341
  return self.request_context(request)
1342
1342
 
1343
- def add_background_task(self, func: Callable, *args: Any, **kwargs: Any) -> None:
1343
+ def add_background_task(
1344
+ self,
1345
+ func: Callable[P, Awaitable[T]],
1346
+ *args: P.args,
1347
+ **kwargs: P.kwargs,
1348
+ ) -> None:
1344
1349
  if self.background_tasks_tg is None:
1345
1350
  raise RuntimeError(
1346
1351
  "Can not add background tasks before the app has started."
@@ -1409,7 +1414,9 @@ class AnyQuart(App):
1409
1414
 
1410
1415
  response: ResponseTypes
1411
1416
  if isinstance(value, HTTPException):
1412
- response = value.get_response() # type: ignore
1417
+ werkzeug_response = value.get_response()
1418
+ assert isinstance(werkzeug_response, (Response, WerkzeugResponse))
1419
+ response = werkzeug_response
1413
1420
  elif not isinstance(value, (Response, WerkzeugResponse)):
1414
1421
  if (
1415
1422
  isinstance(value, (str, bytes, bytearray))
@@ -2,8 +2,6 @@ from __future__ import annotations
2
2
 
3
3
  import mimetypes
4
4
  import os
5
- import pkgutil
6
- import sys
7
5
  from collections.abc import Callable
8
6
  from collections.abc import Iterable
9
7
  from datetime import datetime
@@ -21,8 +19,8 @@ from zlib import adler32
21
19
  from flask.helpers import get_root_path as get_root_path # noqa: F401
22
20
  from werkzeug.exceptions import abort as werkzeug_abort
23
21
  from werkzeug.exceptions import NotFound
22
+ from werkzeug.security import safe_join
24
23
  from werkzeug.utils import redirect as werkzeug_redirect
25
- from werkzeug.utils import safe_join
26
24
  from werkzeug.wrappers import Response as WerkzeugResponse
27
25
 
28
26
  from .globals import _cv_request
@@ -232,32 +230,6 @@ def stream_with_context(func: Callable) -> Callable:
232
230
  return generator
233
231
 
234
232
 
235
- def find_package(name: str) -> tuple[Path | None, Path]:
236
- """Finds packages install prefix (or None) and it's containing Folder"""
237
- module = name.split(".")[0]
238
- loader = pkgutil.get_loader(module)
239
- if name == "__main__" or loader is None:
240
- package_path = Path.cwd()
241
- else:
242
- if hasattr(loader, "get_filename"):
243
- filename = loader.get_filename(module)
244
- else:
245
- __import__(name)
246
- filename = sys.modules[name].__file__
247
- package_path = Path(filename).resolve().parent
248
- if hasattr(loader, "is_package"):
249
- is_package = loader.is_package(module)
250
- if is_package:
251
- package_path = Path(package_path).resolve().parent
252
- sys_prefix = Path(sys.prefix).resolve()
253
- try:
254
- package_path.relative_to(sys_prefix)
255
- except ValueError:
256
- return None, package_path
257
- else:
258
- return sys_prefix, package_path
259
-
260
-
261
233
  async def send_from_directory(
262
234
  directory: FilePath,
263
235
  file_name: str,
@@ -92,16 +92,15 @@ class TestHTTPConnection:
92
92
  if exc_type is not None:
93
93
  await self.disconnect()
94
94
  try:
95
- await self._tg_cm.__aexit__(exc_type, exc_value, tb)
96
- async for data in self._client_receive:
97
- if isinstance(data, bytes):
98
- self.response_data.extend(data)
99
- elif not isinstance(data, HTTPDisconnectError):
100
- raise data
95
+ with self._client_receive, self._client_send:
96
+ async for data in self._client_receive:
97
+ if isinstance(data, bytes):
98
+ self.response_data.extend(data)
99
+ elif not isinstance(data, HTTPDisconnectError):
100
+ raise data
101
101
  finally:
102
- await self._client_receive.aclose()
103
102
  await self._server_receive.aclose()
104
- await self._client_send.aclose()
103
+ await self._tg_cm.__aexit__(exc_type, exc_value, tb)
105
104
 
106
105
  async def as_response(self) -> Response:
107
106
  return self.app.response_class(
@@ -72,7 +72,7 @@ class View:
72
72
  self = cls(*class_args, **class_kwargs)
73
73
 
74
74
  async def view(**kwargs: Any) -> ResponseReturnValue:
75
- return await current_app.ensure_async(self.dispatch_request)(**kwargs)
75
+ return await current_app.ensure_async(self.dispatch_request)(**kwargs) # type: ignore
76
76
 
77
77
  if cls.decorators:
78
78
  view.__name__ = name
@@ -6,7 +6,6 @@ from collections.abc import AsyncGenerator
6
6
  from collections.abc import AsyncIterable
7
7
  from collections.abc import AsyncIterator
8
8
  from collections.abc import Iterable
9
- from contextlib import AbstractAsyncContextManager
10
9
  from hashlib import md5
11
10
  from io import BytesIO
12
11
  from os import PathLike
@@ -145,18 +144,16 @@ class FileBody(ResponseBody):
145
144
  if buffer_size is not None:
146
145
  self.buffer_size = buffer_size
147
146
  self.file: AsyncFile[bytes] | None = None
148
- self.file_manager: AbstractAsyncContextManager | None = None
149
147
 
150
148
  async def __aenter__(self) -> FileBody:
151
- self.file_manager = await async_open(self.file_path, mode="rb")
152
- self.file = await self.file_manager.__aenter__()
149
+ self.file = await async_open(self.file_path, mode="rb")
153
150
  await self.file.seek(self.begin)
154
151
  return self
155
152
 
156
153
  async def __aexit__(
157
154
  self, exc_type: type, exc_value: BaseException, tb: TracebackType
158
155
  ) -> None:
159
- await self.file_manager.__aexit__(exc_type, exc_value, tb)
156
+ await self.file.aclose()
160
157
 
161
158
  def __aiter__(self) -> FileBody:
162
159
  return self
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes