aiohttp-zip-response 2.0.2__tar.gz → 2.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aiohttp-zip-response
3
- Version: 2.0.2
3
+ Version: 2.2.0
4
4
  Summary: A AIOHTTP response class streaming a directory as ZIP archive
5
5
  Home-page: https://github.com/DoctorJohn/aiohttp-zip-response
6
6
  License: MIT
@@ -17,6 +17,7 @@ Classifier: Programming Language :: Python :: 3.9
17
17
  Classifier: Programming Language :: Python :: 3.10
18
18
  Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
20
21
  Classifier: Topic :: Internet :: WWW/HTTP
21
22
  Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
22
23
  Requires-Dist: aiohttp (>=3.9.5,<4.0.0)
@@ -48,10 +48,8 @@ class ZipResponse(web.StreamResponse):
48
48
  datetime.fromtimestamp(lstat.st_mtime),
49
49
  lstat.st_mode,
50
50
  ZIP_32,
51
- self.yield_member_chunks(member_path),
51
+ self.yield_symlink_member_chunks(member_path),
52
52
  )
53
- else:
54
- continue
55
53
 
56
54
  elif member_path.is_file():
57
55
  yield (
@@ -59,7 +57,7 @@ class ZipResponse(web.StreamResponse):
59
57
  datetime.fromtimestamp(lstat.st_mtime),
60
58
  lstat.st_mode,
61
59
  ZIP_32,
62
- self.yield_member_chunks(member_path),
60
+ self.yield_file_member_chunks(member_path),
63
61
  )
64
62
 
65
63
  elif member_path.is_dir():
@@ -68,20 +66,23 @@ class ZipResponse(web.StreamResponse):
68
66
  datetime.fromtimestamp(lstat.st_mtime),
69
67
  lstat.st_mode,
70
68
  ZIP_32,
71
- self.yield_member_chunks(member_path),
69
+ self.yield_dir_member_chunks(member_path),
72
70
  )
73
71
 
74
- async def yield_member_chunks(self, path: Path) -> AsyncGenerator[bytes, None]:
75
- if path.is_symlink():
76
- yield str(path.resolve().relative_to(self._base_path)).encode()
77
- return
78
-
79
- if path.is_dir():
80
- return
72
+ async def yield_symlink_member_chunks(
73
+ self, path: Path
74
+ ) -> AsyncGenerator[bytes, None]:
75
+ yield str(path.resolve().relative_to(self._base_path)).encode()
76
+ return
81
77
 
78
+ async def yield_file_member_chunks(self, path: Path) -> AsyncGenerator[bytes, None]:
82
79
  with path.open("rb") as file:
83
80
  while True:
84
81
  chunk = file.read(self._chunk_size)
85
82
  if not chunk:
86
83
  break
87
84
  yield chunk
85
+
86
+ async def yield_dir_member_chunks(self, path: Path) -> AsyncGenerator[bytes, None]:
87
+ return
88
+ yield b"" # pragma: no cover
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "aiohttp-zip-response"
3
- version = "2.0.2"
3
+ version = "2.2.0"
4
4
  description = "A AIOHTTP response class streaming a directory as ZIP archive"
5
5
  authors = ["Jonathan Ehwald <github@ehwald.info>"]
6
6
  license = "MIT"
@@ -19,6 +19,7 @@ classifiers = [
19
19
  "Programming Language :: Python :: 3.10",
20
20
  "Programming Language :: Python :: 3.11",
21
21
  "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
22
23
  "Topic :: Internet :: WWW/HTTP",
23
24
  "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
24
25
  ]
@@ -29,13 +30,13 @@ aiohttp = "^3.9.5"
29
30
  stream-zip = "^0.0.81"
30
31
 
31
32
  [tool.poetry.group.dev.dependencies]
32
- pre-commit = "^3.7.1"
33
+ pre-commit = "^4.0.1"
33
34
  pytest = "^8.2.2"
34
- pytest-cov = "^5.0.0"
35
- pytest-asyncio = "^0.23.7"
35
+ pytest-cov = "^6.0.0"
36
+ pytest-asyncio = "^0.24.0"
36
37
  pytest-aiohttp = "^1.0.5"
37
38
  pytest-randomly = "^3.15.0"
38
- ruff = "^0.5.1"
39
+ ruff = "^0.7.3"
39
40
  mypy = "^1.10.1"
40
41
 
41
42
  [tool.ruff.lint]
@@ -43,6 +44,7 @@ extend-select = ["I"]
43
44
 
44
45
  [tool.pytest.ini_options]
45
46
  asyncio_mode = "auto"
47
+ addopts = "--cov=aiohttp_zip_response --cov-report term-missing"
46
48
 
47
49
  [build-system]
48
50
  requires = ["poetry-core"]