diff options
Diffstat (limited to 'ranger/container/tags.py')
-rw-r--r-- | ranger/container/tags.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/ranger/container/tags.py b/ranger/container/tags.py index cf2f359d..128f984e 100644 --- a/ranger/container/tags.py +++ b/ranger/container/tags.py @@ -39,7 +39,7 @@ class Tags(object): self.sync() for item in items: try: - del(self.tags[item]) + del self.tags[item] except KeyError: pass self.dump() @@ -56,7 +56,7 @@ class Tags(object): for item in items: try: if item in self and tag in (self.tags[item], self.default_tag): - del(self.tags[item]) + del self.tags[item] else: self.tags[item] = tag except KeyError: @@ -72,35 +72,35 @@ class Tags(object): def sync(self): try: if sys.version_info[0] >= 3: - f = open(self._filename, 'r', errors='replace') + fobj = open(self._filename, 'r', errors='replace') else: - f = open(self._filename, 'r') + fobj = open(self._filename, 'r') except OSError: pass else: - self.tags = self._parse(f) - f.close() + self.tags = self._parse(fobj) + fobj.close() def dump(self): try: - f = open(self._filename, 'w') + fobj = open(self._filename, 'w') except OSError: pass else: - self._compile(f) - f.close() + self._compile(fobj) + fobj.close() - def _compile(self, f): + def _compile(self, fobj): for path, tag in self.tags.items(): if tag == self.default_tag: # COMPAT: keep the old format if the default tag is used - f.write(path + '\n') + fobj.write(path + '\n') elif tag in ALLOWED_KEYS: - f.write('{0}:{1}\n'.format(tag, path)) + fobj.write('{0}:{1}\n'.format(tag, path)) - def _parse(self, f): + def _parse(self, fobj): result = dict() - for line in f: + for line in fobj: line = line.strip() if len(line) > 2 and line[1] == ':': tag, path = line[0], line[2:] @@ -122,7 +122,7 @@ class TagsDummy(Tags): It acts like there are no tags and avoids writing any changes. """ - def __init__(self, filename): + def __init__(self, filename): # pylint: disable=super-init-not-called self.tags = dict() def __contains__(self, item): @@ -146,8 +146,8 @@ class TagsDummy(Tags): def dump(self): pass - def _compile(self, f): + def _compile(self, fobj): pass - def _parse(self, f): + def _parse(self, fobj): pass |