hishel 0.0.30__tar.gz → 0.0.31__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 (29) hide show
  1. {hishel-0.0.30 → hishel-0.0.31}/CHANGELOG.md +6 -0
  2. {hishel-0.0.30 → hishel-0.0.31}/PKG-INFO +7 -1
  3. {hishel-0.0.30 → hishel-0.0.31}/hishel/__init__.py +1 -1
  4. {hishel-0.0.30 → hishel-0.0.31}/hishel/_async/_storages.py +9 -6
  5. {hishel-0.0.30 → hishel-0.0.31}/hishel/_sync/_storages.py +9 -6
  6. {hishel-0.0.30 → hishel-0.0.31}/.gitignore +0 -0
  7. {hishel-0.0.30 → hishel-0.0.31}/LICENSE +0 -0
  8. {hishel-0.0.30 → hishel-0.0.31}/README.md +0 -0
  9. {hishel-0.0.30 → hishel-0.0.31}/hishel/_async/__init__.py +0 -0
  10. {hishel-0.0.30 → hishel-0.0.31}/hishel/_async/_client.py +0 -0
  11. {hishel-0.0.30 → hishel-0.0.31}/hishel/_async/_mock.py +0 -0
  12. {hishel-0.0.30 → hishel-0.0.31}/hishel/_async/_pool.py +0 -0
  13. {hishel-0.0.30 → hishel-0.0.31}/hishel/_async/_transports.py +0 -0
  14. {hishel-0.0.30 → hishel-0.0.31}/hishel/_controller.py +3 -3
  15. {hishel-0.0.30 → hishel-0.0.31}/hishel/_exceptions.py +0 -0
  16. {hishel-0.0.30 → hishel-0.0.31}/hishel/_files.py +0 -0
  17. {hishel-0.0.30 → hishel-0.0.31}/hishel/_headers.py +0 -0
  18. {hishel-0.0.30 → hishel-0.0.31}/hishel/_lfu_cache.py +0 -0
  19. {hishel-0.0.30 → hishel-0.0.31}/hishel/_s3.py +0 -0
  20. {hishel-0.0.30 → hishel-0.0.31}/hishel/_serializers.py +0 -0
  21. {hishel-0.0.30 → hishel-0.0.31}/hishel/_sync/__init__.py +0 -0
  22. {hishel-0.0.30 → hishel-0.0.31}/hishel/_sync/_client.py +0 -0
  23. {hishel-0.0.30 → hishel-0.0.31}/hishel/_sync/_mock.py +0 -0
  24. {hishel-0.0.30 → hishel-0.0.31}/hishel/_sync/_pool.py +0 -0
  25. {hishel-0.0.30 → hishel-0.0.31}/hishel/_sync/_transports.py +0 -0
  26. {hishel-0.0.30 → hishel-0.0.31}/hishel/_synchronization.py +0 -0
  27. {hishel-0.0.30 → hishel-0.0.31}/hishel/_utils.py +0 -0
  28. {hishel-0.0.30 → hishel-0.0.31}/hishel/py.typed +0 -0
  29. {hishel-0.0.30 → hishel-0.0.31}/pyproject.toml +0 -0
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.31 (22nd Sep, 2024)
4
+
5
+ - Ignore file not found error when cleaning up a file storage. (#264)
6
+ - Fix `AssertionError` on `client.close()` when use SQLiteStorage. (#269)
7
+ - Fix ignored flags when use `force_cache`. (#271)
8
+
3
9
  ## 0.0.30 (12th July, 2024)
4
10
 
5
11
  - Fix cache update on revalidation response with content (rfc9111 section 4.3.3) (#239)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: hishel
3
- Version: 0.0.30
3
+ Version: 0.0.31
4
4
  Summary: Persistent cache implementation for httpx and httpcore
5
5
  Project-URL: Homepage, https://hishel.com
6
6
  Project-URL: Source, https://github.com/karpetrosyan/hishel
@@ -175,6 +175,12 @@ Help us grow and continue developing good software for you ❤️
175
175
 
176
176
  # Changelog
177
177
 
178
+ ## 0.0.31 (22nd Sep, 2024)
179
+
180
+ - Ignore file not found error when cleaning up a file storage. (#264)
181
+ - Fix `AssertionError` on `client.close()` when use SQLiteStorage. (#269)
182
+ - Fix ignored flags when use `force_cache`. (#271)
183
+
178
184
  ## 0.0.30 (12th July, 2024)
179
185
 
180
186
  - Fix cache update on revalidation response with content (rfc9111 section 4.3.3) (#239)
@@ -14,4 +14,4 @@ def install_cache() -> None: # pragma: no cover
14
14
  httpx.Client = CacheClient # type: ignore
15
15
 
16
16
 
17
- __version__ = "0.0.30"
17
+ __version__ = "0.0.31"
@@ -227,10 +227,13 @@ class AsyncFileStorage(AsyncBaseStorage):
227
227
  async with self._lock:
228
228
  with os.scandir(self._base_path) as entries:
229
229
  for entry in entries:
230
- if entry.is_file():
231
- age = time.time() - entry.stat().st_mtime
232
- if age > self._ttl:
233
- os.unlink(entry.path)
230
+ try:
231
+ if entry.is_file():
232
+ age = time.time() - entry.stat().st_mtime
233
+ if age > self._ttl:
234
+ os.unlink(entry.path)
235
+ except FileNotFoundError: # pragma: no cover
236
+ pass
234
237
 
235
238
 
236
239
  class AsyncSQLiteStorage(AsyncBaseStorage):
@@ -374,8 +377,8 @@ class AsyncSQLiteStorage(AsyncBaseStorage):
374
377
  return self._serializer.loads(cached_response)
375
378
 
376
379
  async def aclose(self) -> None: # pragma: no cover
377
- assert self._connection
378
- await self._connection.close()
380
+ if self._connection is not None:
381
+ await self._connection.close()
379
382
 
380
383
  async def _remove_expired_caches(self) -> None:
381
384
  assert self._connection
@@ -227,10 +227,13 @@ class FileStorage(BaseStorage):
227
227
  with self._lock:
228
228
  with os.scandir(self._base_path) as entries:
229
229
  for entry in entries:
230
- if entry.is_file():
231
- age = time.time() - entry.stat().st_mtime
232
- if age > self._ttl:
233
- os.unlink(entry.path)
230
+ try:
231
+ if entry.is_file():
232
+ age = time.time() - entry.stat().st_mtime
233
+ if age > self._ttl:
234
+ os.unlink(entry.path)
235
+ except FileNotFoundError: # pragma: no cover
236
+ pass
234
237
 
235
238
 
236
239
  class SQLiteStorage(BaseStorage):
@@ -374,8 +377,8 @@ class SQLiteStorage(BaseStorage):
374
377
  return self._serializer.loads(cached_response)
375
378
 
376
379
  def close(self) -> None: # pragma: no cover
377
- assert self._connection
378
- self._connection.close()
380
+ if self._connection is not None:
381
+ self._connection.close()
379
382
 
380
383
  def _remove_expired_caches(self) -> None:
381
384
  assert self._connection
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -149,9 +149,6 @@ class Controller:
149
149
  method = request.method.decode("ascii")
150
150
  force_cache = request.extensions.get("force_cache", None)
151
151
 
152
- if force_cache if force_cache is not None else self._force_cache:
153
- return True
154
-
155
152
  if response.status not in self._cacheable_status_codes:
156
153
  return False
157
154
 
@@ -162,6 +159,9 @@ class Controller:
162
159
  if method not in self._cacheable_methods:
163
160
  return False
164
161
 
162
+ if force_cache if force_cache is not None else self._force_cache:
163
+ return True
164
+
165
165
  response_cache_control = parse_cache_control(extract_header_values_decoded(response.headers, b"cache-control"))
166
166
  request_cache_control = parse_cache_control(extract_header_values_decoded(request.headers, b"cache-control"))
167
167
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes