diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-02-23 18:43:00 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2014-02-23 18:43:00 +0000 |
commit | 68c280c5bf1cf8d6330280b188ed73c333dc9403 (patch) | |
tree | e9a25239917ecc5eaccee466135d5ff9a3e87658 /obnamlib/plugins/fuse_plugin.py | |
parent | 461014864c2bc07f2b5ab49606d6a081f1a56f28 (diff) | |
download | obnam-68c280c5bf1cf8d6330280b188ed73c333dc9403.tar.gz |
Simplify code
It's clearer to use "if foo in bar" rather than catching KeyError.
Diffstat (limited to 'obnamlib/plugins/fuse_plugin.py')
-rw-r--r-- | obnamlib/plugins/fuse_plugin.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/obnamlib/plugins/fuse_plugin.py b/obnamlib/plugins/fuse_plugin.py index 05d12395..e6800f20 100644 --- a/obnamlib/plugins/fuse_plugin.py +++ b/obnamlib/plugins/fuse_plugin.py @@ -215,9 +215,8 @@ class ObnamFuse(fuse.Fuse): def get_metadata(self, path): tracing.trace('path=%r', path) - try: - return self.metadatacache[path] - except KeyError: + + if path not in self.metadatacache: if len(self.metadatacache) > self.MAX_METADATA_CACHE: self.metadatacache.clear() metadata = self.obnam.repo.get_metadata(*self.get_gen_path(path)) @@ -227,7 +226,8 @@ class ObnamFuse(fuse.Fuse): metadata.st_atime_sec = 0 if metadata.st_mtime_sec < 0: metadata.st_mtime_sec = 0 - return metadata + + return self.metadatacache[path] def get_stat(self, path): tracing.trace('path=%r', path) |