summaryrefslogtreecommitdiff
path: root/xdg
diff options
context:
space:
mode:
authorThomas Kluyver <takowl@gmail.com>2013-03-15 22:17:24 +0000
committerThomas Kluyver <takowl@gmail.com>2013-03-15 22:17:24 +0000
commitd66bb731c459839c91dd88e6f872d2e2292e1f99 (patch)
tree6b15b0673c8573bc75330c7f054ac81d8196bb4c /xdg
parentd26d8ee1dcc9e7e8f6fbe4a48bef07b7e998b2ea (diff)
Avoid duplicate MIME globs
Diffstat (limited to 'xdg')
-rw-r--r--xdg/Mime.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/xdg/Mime.py b/xdg/Mime.py
index 5a33351..b1a1007 100644
--- a/xdg/Mime.py
+++ b/xdg/Mime.py
@@ -369,8 +369,8 @@ class GlobDB(object):
"""Prepare the GlobDB. It can't actually be used until .finalise() is
called, but merge_file() can be used to add data before that.
"""
- # Maps mimetype to [(weight, glob, flags), ...]
- self.allglobs = defaultdict(list)
+ # Maps mimetype to {(weight, glob, flags), ...}
+ self.allglobs = defaultdict(set)
def merge_file(self, path):
"""Loads name matching information from a globs2 file."""#
@@ -386,14 +386,14 @@ class GlobDB(object):
if len(fields) > 3:
flags = fields[3].split(',')
else:
- flags = []
+ flags = ()
if pattern == '__NOGLOBS__':
# This signals to discard any previous globs
allglobs.pop(mtype, None)
continue
- allglobs[mtype].append((weight, pattern, flags))
+ allglobs[mtype].add((weight, pattern, tuple(flags)))
def finalise(self):
"""Prepare the GlobDB for matching.