summaryrefslogtreecommitdiffhomepage
path: root/libs/fcache
diff options
context:
space:
mode:
authormorpheus65535 <[email protected]>2024-03-03 12:15:23 -0500
committerGitHub <[email protected]>2024-03-03 12:15:23 -0500
commit03afeb347075381bcb7fd6036295c9fa4a90d2dc (patch)
tree7c5d72c973d2c8e4ade57391a1c9ad5e94903a46 /libs/fcache
parent9ae684240b5bdd40a870d8122f0e380f8d03a187 (diff)
downloadbazarr-03afeb347075381bcb7fd6036295c9fa4a90d2dc.tar.gz
bazarr-03afeb347075381bcb7fd6036295c9fa4a90d2dc.zip
Updated multiple Python modules (now in libs and custom_libs directories) and React libraries
Diffstat (limited to 'libs/fcache')
-rw-r--r--libs/fcache/__init__.py2
-rw-r--r--libs/fcache/cache.py11
2 files changed, 6 insertions, 7 deletions
diff --git a/libs/fcache/__init__.py b/libs/fcache/__init__.py
index 3d187266f..722515271 100644
--- a/libs/fcache/__init__.py
+++ b/libs/fcache/__init__.py
@@ -1 +1 @@
-__version__ = "0.5.0"
+__version__ = "0.5.2"
diff --git a/libs/fcache/cache.py b/libs/fcache/cache.py
index 7775cb21f..53326af18 100644
--- a/libs/fcache/cache.py
+++ b/libs/fcache/cache.py
@@ -6,7 +6,7 @@ import pickle
import shutil
import tempfile
-import appdirs
+import platformdirs
from .posixemulation import rename
@@ -16,7 +16,7 @@ logger = logging.getLogger(__name__)
class FileCache(MutableMapping):
"""A persistent file cache that is dictionary-like and has a write buffer.
- *appname* is passed to `appdirs <https://pypi.python.org/pypi/appdirs/>`_
+ *appname* is passed to `platformdirs <https://pypi.org/project/platformdirs/>`_
to determine a system-appropriate location for the cache files. The cache
directory used is available via :data:`cache_dir`.
@@ -40,7 +40,7 @@ class FileCache(MutableMapping):
:param bool serialize: Whether or not to (de)serialize the values. If a
cache is used with a :class:`~shelve.Shelf`, set this to ``False``.
:param str app_cache_dir: absolute path to root cache directory to be
- used in place of system-appropriate location determined by appdirs
+ used in place of system-appropriate location determined by platformdirs
The optional *flag* argument can be:
@@ -106,7 +106,7 @@ class FileCache(MutableMapping):
self._is_subcache = bool(subcache)
if not app_cache_dir:
- app_cache_dir = appdirs.user_cache_dir(appname, appname)
+ app_cache_dir = platformdirs.user_cache_dir(appname, appname)
subcache_dir = os.path.join(app_cache_dir, *subcache)
self.cache_dir = os.path.join(subcache_dir, "cache")
exists = os.path.exists(self.cache_dir)
@@ -139,8 +139,7 @@ class FileCache(MutableMapping):
"""Create the write buffer and cache directory."""
if not self._sync and not hasattr(self, "_buffer"):
self._buffer = {}
- if not os.path.exists(self.cache_dir):
- os.makedirs(self.cache_dir)
+ os.makedirs(self.cache_dir, exist_ok=True)
def clear(self):
"""Remove all items from the write buffer and cache.