CacheControl 0.14.0__tar.gz → 0.14.1__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 (34) hide show
  1. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/PKG-INFO +11 -10
  2. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/cachecontrol/__init__.py +2 -1
  3. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/cachecontrol/adapter.py +2 -2
  4. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/cachecontrol/cache.py +1 -0
  5. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/cachecontrol/caches/file_cache.py +1 -1
  6. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/cachecontrol/controller.py +1 -0
  7. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/cachecontrol/filewrapper.py +2 -2
  8. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/cachecontrol/heuristics.py +4 -1
  9. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/pyproject.toml +8 -7
  10. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/conftest.py +1 -1
  11. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/issue_263.py +0 -3
  12. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/test_cache_control.py +2 -1
  13. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/test_redirects.py +1 -0
  14. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/test_serialization.py +0 -1
  15. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/test_storage_filecache.py +1 -0
  16. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/LICENSE.txt +0 -0
  17. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/README.rst +0 -0
  18. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/cachecontrol/_cmd.py +0 -0
  19. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/cachecontrol/caches/__init__.py +0 -0
  20. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/cachecontrol/caches/redis_cache.py +0 -0
  21. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/cachecontrol/py.typed +0 -0
  22. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/cachecontrol/serialize.py +0 -0
  23. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/cachecontrol/wrapper.py +0 -0
  24. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/__init__.py +0 -0
  25. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/test_adapter.py +0 -0
  26. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/test_chunked_response.py +0 -0
  27. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/test_etag.py +0 -0
  28. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/test_expires_heuristics.py +0 -0
  29. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/test_max_age.py +0 -0
  30. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/test_regressions.py +0 -0
  31. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/test_server_http_version.py +0 -0
  32. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/test_storage_redis.py +0 -0
  33. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/test_vary.py +0 -0
  34. {cachecontrol-0.14.0 → cachecontrol-0.14.1}/tests/utils.py +0 -0
@@ -1,35 +1,36 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: CacheControl
3
- Version: 0.14.0
3
+ Version: 0.14.1
4
4
  Summary: httplib2 caching for requests
5
5
  Keywords: requests,http,caching,web
6
6
  Author-email: Eric Larson <ericlarson@ionrock.com>, Frost Ming <me@frostming.com>, William Woodruff <william@yossarian.net>
7
- Requires-Python: >=3.7
7
+ Requires-Python: >=3.8
8
8
  Description-Content-Type: text/x-rst
9
9
  Classifier: Development Status :: 4 - Beta
10
10
  Classifier: Environment :: Web Environment
11
11
  Classifier: License :: OSI Approved :: Apache Software License
12
12
  Classifier: Operating System :: OS Independent
13
- Classifier: Programming Language :: Python :: 3.7
14
13
  Classifier: Programming Language :: Python :: 3.8
15
14
  Classifier: Programming Language :: Python :: 3.9
16
15
  Classifier: Programming Language :: Python :: 3.10
17
16
  Classifier: Programming Language :: Python :: 3.11
18
17
  Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
19
  Classifier: Topic :: Internet :: WWW/HTTP
20
20
  Requires-Dist: requests >= 2.16.0
21
21
  Requires-Dist: msgpack >= 0.5.2, < 2.0.0
22
- Requires-Dist: CacheControl[filecache,redis] ; extra == "dev"
22
+ Requires-Dist: CacheControl[filecache, redis] ; extra == "dev"
23
23
  Requires-Dist: build ; extra == "dev"
24
+ Requires-Dist: cherrypy ; extra == "dev"
25
+ Requires-Dist: codespell[tomli] ; extra == "dev"
26
+ Requires-Dist: furo ; extra == "dev"
24
27
  Requires-Dist: mypy ; extra == "dev"
25
- Requires-Dist: tox ; extra == "dev"
26
- Requires-Dist: pytest-cov ; extra == "dev"
27
28
  Requires-Dist: pytest ; extra == "dev"
28
- Requires-Dist: cherrypy ; extra == "dev"
29
+ Requires-Dist: pytest-cov ; extra == "dev"
30
+ Requires-Dist: ruff ; extra == "dev"
29
31
  Requires-Dist: sphinx ; extra == "dev"
30
- Requires-Dist: furo ; extra == "dev"
31
32
  Requires-Dist: sphinx-copybutton ; extra == "dev"
32
- Requires-Dist: black ; extra == "dev"
33
+ Requires-Dist: tox ; extra == "dev"
33
34
  Requires-Dist: types-redis ; extra == "dev"
34
35
  Requires-Dist: types-requests ; extra == "dev"
35
36
  Requires-Dist: filelock >= 3.8.0 ; extra == "filecache"
@@ -6,9 +6,10 @@
6
6
 
7
7
  Make it easy to import from cachecontrol without long namespaces.
8
8
  """
9
+
9
10
  __author__ = "Eric Larson"
10
11
  __email__ = "eric@ionrock.org"
11
- __version__ = "0.14.0"
12
+ __version__ = "0.14.1"
12
13
 
13
14
  from cachecontrol.adapter import CacheControlAdapter
14
15
  from cachecontrol.controller import CacheController
@@ -77,7 +77,7 @@ class CacheControlAdapter(HTTPAdapter):
77
77
 
78
78
  return resp
79
79
 
80
- def build_response(
80
+ def build_response( # type: ignore[override]
81
81
  self,
82
82
  request: PreparedRequest,
83
83
  response: HTTPResponse,
@@ -143,7 +143,7 @@ class CacheControlAdapter(HTTPAdapter):
143
143
  _update_chunk_length, response
144
144
  )
145
145
 
146
- resp: Response = super().build_response(request, response) # type: ignore[no-untyped-call]
146
+ resp: Response = super().build_response(request, response)
147
147
 
148
148
  # See if we should invalidate the cache.
149
149
  if request.method in self.invalidating_methods and resp.ok:
@@ -6,6 +6,7 @@
6
6
  The cache object API for implementing caches. The default is a thread
7
7
  safe in-memory dictionary.
8
8
  """
9
+
9
10
  from __future__ import annotations
10
11
 
11
12
  from threading import Lock
@@ -6,7 +6,7 @@ from __future__ import annotations
6
6
  import hashlib
7
7
  import os
8
8
  from textwrap import dedent
9
- from typing import IO, TYPE_CHECKING, Union
9
+ from typing import IO, TYPE_CHECKING
10
10
  from pathlib import Path
11
11
 
12
12
  from cachecontrol.cache import BaseCache, SeparateBodyBaseCache
@@ -5,6 +5,7 @@
5
5
  """
6
6
  The httplib2 algorithms ported for use with requests.
7
7
  """
8
+
8
9
  from __future__ import annotations
9
10
 
10
11
  import calendar
@@ -38,10 +38,10 @@ class CallbackFileWrapper:
38
38
  self.__callback = callback
39
39
 
40
40
  def __getattr__(self, name: str) -> Any:
41
- # The vaguaries of garbage collection means that self.__fp is
41
+ # The vagaries of garbage collection means that self.__fp is
42
42
  # not always set. By using __getattribute__ and the private
43
43
  # name[0] allows looking up the attribute value and raising an
44
- # AttributeError when it doesn't exist. This stop thigns from
44
+ # AttributeError when it doesn't exist. This stop things from
45
45
  # infinitely recursing calls to getattr in the case where
46
46
  # self.__fp hasn't been set.
47
47
  #
@@ -68,7 +68,10 @@ class OneDayCache(BaseHeuristic):
68
68
 
69
69
  if "expires" not in response.headers:
70
70
  date = parsedate(response.headers["date"])
71
- expires = expire_after(timedelta(days=1), date=datetime(*date[:6], tzinfo=timezone.utc)) # type: ignore[index,misc]
71
+ expires = expire_after(
72
+ timedelta(days=1),
73
+ date=datetime(*date[:6], tzinfo=timezone.utc), # type: ignore[index,misc]
74
+ )
72
75
  headers["expires"] = datetime_to_header(expires)
73
76
  headers["cache-control"] = "public"
74
77
  return headers
@@ -24,17 +24,17 @@ classifiers = [
24
24
  "Environment :: Web Environment",
25
25
  "License :: OSI Approved :: Apache Software License",
26
26
  "Operating System :: OS Independent",
27
- "Programming Language :: Python :: 3.7",
28
27
  "Programming Language :: Python :: 3.8",
29
28
  "Programming Language :: Python :: 3.9",
30
29
  "Programming Language :: Python :: 3.10",
31
30
  "Programming Language :: Python :: 3.11",
32
31
  "Programming Language :: Python :: 3.12",
32
+ "Programming Language :: Python :: 3.13",
33
33
  "Topic :: Internet :: WWW/HTTP",
34
34
  ]
35
35
  keywords = ["requests", "http", "caching", "web"]
36
36
  dependencies = ["requests >= 2.16.0", "msgpack >= 0.5.2, < 2.0.0"]
37
- requires-python = ">=3.7"
37
+ requires-python = ">=3.8"
38
38
 
39
39
  [project.urls]
40
40
  Homepage = "https://pypi.org/project/CacheControl/"
@@ -50,15 +50,16 @@ redis = ["redis>=2.10.5"]
50
50
  dev = [
51
51
  "CacheControl[filecache,redis]",
52
52
  "build",
53
+ "cherrypy",
54
+ "codespell[tomli]",
55
+ "furo",
53
56
  "mypy",
54
- "tox",
55
- "pytest-cov",
56
57
  "pytest",
57
- "cherrypy",
58
+ "pytest-cov",
59
+ "ruff",
58
60
  "sphinx",
59
- "furo",
60
61
  "sphinx-copybutton",
61
- "black",
62
+ "tox",
62
63
  "types-redis",
63
64
  "types-requests",
64
65
  ]
@@ -160,5 +160,5 @@ def pytest_configure(config):
160
160
  def pytest_unconfigure(config):
161
161
  try:
162
162
  cherrypy.server.stop()
163
- except:
163
+ except: # noqa: E722
164
164
  pass
@@ -13,9 +13,6 @@ clogger.addHandler(logging.StreamHandler())
13
13
  clogger.setLevel(logging.DEBUG)
14
14
 
15
15
 
16
- from pprint import pprint
17
-
18
-
19
16
  class NoAgeHeuristic(BaseHeuristic):
20
17
  def update_headers(self, response):
21
18
  if "cache-control" in response.headers:
@@ -5,6 +5,7 @@
5
5
  """
6
6
  Unit tests that verify our caching methods work correctly.
7
7
  """
8
+
8
9
  import time
9
10
  from tempfile import mkdtemp
10
11
  from unittest.mock import ANY, Mock
@@ -175,7 +176,7 @@ class TestCacheControllerResponse:
175
176
 
176
177
  This is the shared utility for any cache object.
177
178
  """
178
- # Cache starts out prepopulated wih an entry:
179
+ # Cache starts out prepopulated with an entry:
179
180
  etag = "jfd9094r808"
180
181
  cc = CacheController(cache)
181
182
  url = "http://localhost:123/x"
@@ -5,6 +5,7 @@
5
5
  """
6
6
  Test for supporting redirect caches as needed.
7
7
  """
8
+
8
9
  import requests
9
10
 
10
11
  from cachecontrol import CacheControl
@@ -2,7 +2,6 @@
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
5
- import pickle
6
5
  from unittest.mock import Mock
7
6
 
8
7
  import msgpack
@@ -5,6 +5,7 @@
5
5
  """
6
6
  Unit tests that verify FileCache storage works correctly.
7
7
  """
8
+
8
9
  import os
9
10
  import string
10
11
 
File without changes
File without changes