diff options
author | Carlo Teubner <carlo.teubner@gmail.com> | 2016-08-20 13:06:16 +0100 |
---|---|---|
committer | Carlo Teubner <carlo.teubner@gmail.com> | 2016-08-20 13:06:16 +0100 |
commit | 61af307ad4bb317503b1eb3ee60f7421881e5f5d (patch) | |
tree | e34782307154d9a5e42c0710be5b421435631cfb /src | |
parent | 28076ee5887f152aa93f0c0a053d8d8281250460 (diff) |
helpers.py: replace memoize usages with lru_cache
Diffstat (limited to 'src')
-rw-r--r-- | src/borg/helpers.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/borg/helpers.py b/src/borg/helpers.py index 32ebf968c..153225faf 100644 --- a/src/borg/helpers.py +++ b/src/borg/helpers.py @@ -722,9 +722,6 @@ def format_archive(archive): ) -memoize = lru_cache(maxsize=None) - - class Buffer: """ provide a thread-local buffer @@ -766,7 +763,7 @@ class Buffer: return self._thread_local.buffer -@memoize +@lru_cache(maxsize=None) def uid2user(uid, default=None): try: return pwd.getpwuid(uid).pw_name @@ -774,7 +771,7 @@ def uid2user(uid, default=None): return default -@memoize +@lru_cache(maxsize=None) def user2uid(user, default=None): try: return user and pwd.getpwnam(user).pw_uid @@ -782,7 +779,7 @@ def user2uid(user, default=None): return default -@memoize +@lru_cache(maxsize=None) def gid2group(gid, default=None): try: return grp.getgrgid(gid).gr_name @@ -790,7 +787,7 @@ def gid2group(gid, default=None): return default -@memoize +@lru_cache(maxsize=None) def group2gid(group, default=None): try: return group and grp.getgrnam(group).gr_gid |