CacheControl 0.12.13__py2.py3-none-any.whl → 0.12.14__py2.py3-none-any.whl

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: CacheControl
3
- Version: 0.12.13
3
+ Version: 0.12.14
4
4
  Summary: httplib2 caching for requests
5
5
  Home-page: https://github.com/ionrock/cachecontrol
6
6
  Author: Eric Larson
@@ -21,7 +21,7 @@ License-File: LICENSE.txt
21
21
  Requires-Dist: requests
22
22
  Requires-Dist: msgpack (>=0.5.2)
23
23
  Provides-Extra: filecache
24
- Requires-Dist: filelock (>=3.8.0) ; extra == 'filecache'
24
+ Requires-Dist: lockfile (>=0.9) ; extra == 'filecache'
25
25
  Provides-Extra: redis
26
26
  Requires-Dist: redis (>=2.10.5) ; extra == 'redis'
27
27
 
@@ -1,4 +1,4 @@
1
- cachecontrol/__init__.py,sha256=vO3ulk25MtiOvhM-O9nIiTUfxjF_rSdAS_5Sug5yfKo,465
1
+ cachecontrol/__init__.py,sha256=Ay1JZbjaWZfkKNVpxrIpBmisYdP-mw-UnuUq6W39XlA,465
2
2
  cachecontrol/_cmd.py,sha256=HjFJdGgPOLsvS_5e8BvqYrweXJj1gR7dSsqCB1X24uw,1326
3
3
  cachecontrol/adapter.py,sha256=du8CsHKttAWL9-pWmSvyNDVzHrH-qfiSOgo6fcanM-0,5021
4
4
  cachecontrol/cache.py,sha256=Tty45fOjH40fColTGkqKQvQQmbYsMpk-nCyfLcv2vG4,1535
@@ -9,11 +9,11 @@ cachecontrol/heuristics.py,sha256=8kAyuZLSCyEIgQr6vbUwfhpqg9ows4mM0IV6DWazevI,41
9
9
  cachecontrol/serialize.py,sha256=2alQaLbA33qLRW8PQSJzQ3uDik1vVMf8gfnoIzw8eB8,7216
10
10
  cachecontrol/wrapper.py,sha256=X3-KMZ20Ho3VtqyVaXclpeQpFzokR5NE8tZSfvKVaB8,774
11
11
  cachecontrol/caches/__init__.py,sha256=h-1cUmOz6mhLsjTjOrJ8iPejpGdLCyG4lzTftfGZvLg,242
12
- cachecontrol/caches/file_cache.py,sha256=sEykjs7hBwD0ssLcZtCSDxzQbkhJa1a-EEMu8MF5FWc,4949
12
+ cachecontrol/caches/file_cache.py,sha256=GpexcE29LoY4MaZwPUTcUBZaDdcsjqyLxZFznk8Hbr4,5271
13
13
  cachecontrol/caches/redis_cache.py,sha256=bGKAU0IOcJUFmU_blBI3w6zKj1L4IyfDPmLNyzjp_y4,1021
14
- CacheControl-0.12.13.dist-info/LICENSE.txt,sha256=hu7uh74qQ_P_H1ZJb0UfaSQ5JvAl_tuwM2ZsMExMFhs,558
15
- CacheControl-0.12.13.dist-info/METADATA,sha256=H99iFq9vEK4mhcK7sLCyPYajoBVfGe9bSQMobRG8o9w,2183
16
- CacheControl-0.12.13.dist-info/WHEEL,sha256=a-zpFRIJzOq5QfuhBzbhiA1eHTzNCJn8OdRvhdNX0Rk,110
17
- CacheControl-0.12.13.dist-info/entry_points.txt,sha256=SyncUQvsSkNqcQOu8uE2_D8K5d7_2fR2cV7tSJaMrhc,55
18
- CacheControl-0.12.13.dist-info/top_level.txt,sha256=vGYWzpbe3h6gkakV4f7iCK2x3KyK3oMkV5pe5v25-d4,13
19
- CacheControl-0.12.13.dist-info/RECORD,,
14
+ CacheControl-0.12.14.dist-info/LICENSE.txt,sha256=hu7uh74qQ_P_H1ZJb0UfaSQ5JvAl_tuwM2ZsMExMFhs,558
15
+ CacheControl-0.12.14.dist-info/METADATA,sha256=Zx4oWUReiKdwP2bjB200yn_DIdkYF7utCxHYyD-Laec,2181
16
+ CacheControl-0.12.14.dist-info/WHEEL,sha256=a-zpFRIJzOq5QfuhBzbhiA1eHTzNCJn8OdRvhdNX0Rk,110
17
+ CacheControl-0.12.14.dist-info/entry_points.txt,sha256=SyncUQvsSkNqcQOu8uE2_D8K5d7_2fR2cV7tSJaMrhc,55
18
+ CacheControl-0.12.14.dist-info/top_level.txt,sha256=vGYWzpbe3h6gkakV4f7iCK2x3KyK3oMkV5pe5v25-d4,13
19
+ CacheControl-0.12.14.dist-info/RECORD,,
cachecontrol/__init__.py CHANGED
@@ -8,7 +8,7 @@ Make it easy to import from cachecontrol without long namespaces.
8
8
  """
9
9
  __author__ = "Eric Larson"
10
10
  __email__ = "eric@ionrock.org"
11
- __version__ = "0.12.13"
11
+ __version__ = "0.12.14"
12
12
 
13
13
  from .wrapper import CacheControl
14
14
  from .adapter import CacheControlAdapter
@@ -66,23 +66,33 @@ class _FileCacheMixin:
66
66
  forever=False,
67
67
  filemode=0o0600,
68
68
  dirmode=0o0700,
69
+ use_dir_lock=None,
69
70
  lock_class=None,
70
71
  ):
71
72
 
73
+ if use_dir_lock is not None and lock_class is not None:
74
+ raise ValueError("Cannot use use_dir_lock and lock_class together")
75
+
72
76
  try:
73
- if lock_class is None:
74
- from filelock import FileLock
75
- lock_class = FileLock
77
+ from lockfile import LockFile
78
+ from lockfile.mkdirlockfile import MkdirLockFile
76
79
  except ImportError:
77
80
  notice = dedent(
78
81
  """
79
82
  NOTE: In order to use the FileCache you must have
80
- filelock installed. You can install it via pip:
81
- pip install filelock
83
+ lockfile installed. You can install it via pip:
84
+ pip install lockfile
82
85
  """
83
86
  )
84
87
  raise ImportError(notice)
85
88
 
89
+ else:
90
+ if use_dir_lock:
91
+ lock_class = MkdirLockFile
92
+
93
+ elif lock_class is None:
94
+ lock_class = LockFile
95
+
86
96
  self.directory = directory
87
97
  self.forever = forever
88
98
  self.filemode = filemode
@@ -123,9 +133,9 @@ class _FileCacheMixin:
123
133
  except (IOError, OSError):
124
134
  pass
125
135
 
126
- with self.lock_class(path + ".lock"):
136
+ with self.lock_class(path) as lock:
127
137
  # Write our actual file
128
- with _secure_open_write(path, self.filemode) as fh:
138
+ with _secure_open_write(lock.path, self.filemode) as fh:
129
139
  fh.write(data)
130
140
 
131
141
  def _delete(self, key, suffix):