diskcache-community 5.7.0__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.
diskcache/__init__.py ADDED
@@ -0,0 +1,113 @@
1
+ """
2
+ DiskCache API Reference
3
+ =======================
4
+
5
+ The :doc:`tutorial` provides a helpful walkthrough of most methods.
6
+ """
7
+
8
+ import os
9
+ import warnings
10
+
11
+ from .core import (
12
+ DEFAULT_SETTINGS,
13
+ ENOVAL,
14
+ EVICTION_POLICY,
15
+ UNKNOWN,
16
+ Cache,
17
+ Disk,
18
+ EmptyDirWarning,
19
+ JSONDisk,
20
+ ReadOnlyError,
21
+ SafeDisk,
22
+ Timeout,
23
+ UnknownFileWarning,
24
+ )
25
+ from .fanout import FanoutCache
26
+ from .persistent import Deque, Index
27
+ from .recipes import (
28
+ Averager,
29
+ BoundedSemaphore,
30
+ Lock,
31
+ RLock,
32
+ barrier,
33
+ memoize_stampede,
34
+ throttle,
35
+ )
36
+
37
+ __all__ = [
38
+ 'Averager',
39
+ 'BoundedSemaphore',
40
+ 'Cache',
41
+ 'DEFAULT_SETTINGS',
42
+ 'Deque',
43
+ 'Disk',
44
+ 'ENOVAL',
45
+ 'EVICTION_POLICY',
46
+ 'EmptyDirWarning',
47
+ 'FanoutCache',
48
+ 'Index',
49
+ 'JSONDisk',
50
+ 'Lock',
51
+ 'RLock',
52
+ 'ReadOnlyError',
53
+ 'SafeDisk',
54
+ 'Timeout',
55
+ 'UNKNOWN',
56
+ 'UnknownFileWarning',
57
+ 'barrier',
58
+ 'memoize_stampede',
59
+ 'throttle',
60
+ ]
61
+
62
+ try:
63
+ from .djangocache import DjangoCache # noqa
64
+
65
+ __all__.append('DjangoCache')
66
+ except Exception: # pylint: disable=broad-except # pragma: no cover
67
+ # Django not installed or not setup so ignore.
68
+ pass
69
+
70
+
71
+ def _warn_if_upstream_installed(site_dir=None):
72
+ """Warn when the upstream ``diskcache`` distribution is installed too.
73
+
74
+ Both distributions install into the same ``diskcache`` package directory,
75
+ so the files on disk belong to whichever was installed last and
76
+ uninstalling either one removes them for both. Return True when the
77
+ warning was issued.
78
+
79
+ """
80
+ if site_dir is None:
81
+ site_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
82
+
83
+ try:
84
+ names = os.listdir(site_dir)
85
+ except OSError:
86
+ return False
87
+
88
+ for name in names:
89
+ if name.startswith('diskcache-') and name.endswith(
90
+ ('.dist-info', '.egg-info')
91
+ ):
92
+ warnings.warn(
93
+ 'the diskcache distribution is installed next to'
94
+ ' diskcache-community; both provide the diskcache package'
95
+ ' directory, so uninstall diskcache (pip uninstall diskcache)'
96
+ ' and then reinstall diskcache-community',
97
+ RuntimeWarning,
98
+ stacklevel=2,
99
+ )
100
+ return True
101
+
102
+ return False
103
+
104
+
105
+ _warn_if_upstream_installed()
106
+
107
+
108
+ __title__ = 'diskcache-community'
109
+ __version__ = '5.7.0'
110
+ __build__ = 0x050700
111
+ __author__ = 'Grant Jenks'
112
+ __license__ = 'Apache 2.0'
113
+ __copyright__ = 'Copyright 2016-2023 Grant Jenks'
diskcache/cli.py ADDED
@@ -0,0 +1 @@
1
+ """Command line interface to disk cache."""