Bug 1427210: Since we are using python 2.7, we can use a set instead of simulating it with a dictionary; r?Fallen draft
authorTom Prince <mozilla@hocat.ca>
Tue, 26 Dec 2017 22:07:47 -0700
changeset 23604 34fc1163a375b842a4d0547b5af3f9c3977f2e41
parent 23598 b9832b8e7d39815d0913806978603879520ff883
child 23605 89c1dea4c3878f659d355dca921e28498721c835
push id193
push userbmo:mozilla@hocat.ca
push dateWed, 27 Dec 2017 22:25:50 +0000
reviewersFallen
bugs1427210
Bug 1427210: Since we are using python 2.7, we can use a set instead of simulating it with a dictionary; r?Fallen MozReview-Commit-ID: I3daw8OZjFa
mail/check-sync-dirs.py
--- a/mail/check-sync-dirs.py
+++ b/mail/check-sync-dirs.py
@@ -28,33 +28,35 @@ import fnmatch
 if len(sys.argv) != 3:
     print >> sys.stderr, 'TEST-UNEXPECTED-FAIL | check-sync-dirs.py | Usage: %s COPY ORIGINAL' % sys.argv[0]
     sys.exit(1)
 
 copy = os.path.abspath(sys.argv[1])
 original = os.path.abspath(sys.argv[2])
 
 
-# Return the contents of FILENAME, a 'check-sync-exceptions' file, as
-# a dictionary whose keys are exactly the list of filenames, along
-# with the basename of FILENAME itself.  If FILENAME does not exist,
-# return the empty dictionary.
 def read_exceptions(filename):
+    """
+    Return the contents of FILENAME, a 'check-sync-exceptions' file, as
+    a dictionary whose keys are exactly the list of filenames, along
+    with the basename of FILENAME itself.  If FILENAME does not exist,
+    return the empty dictionary.
+    """
     if (os.path.exists(filename)):
         f = file(filename)
-        exceptions = {}
+        exceptions = set()
         for line in f:
             line = line.strip()
             if line != '' and line[0] != '#':
-                exceptions[line] = None
-        exceptions[os.path.basename(filename)] = None
+                exceptions.add(line)
+        exceptions.add(os.path.basename(filename))
         f.close()
         return exceptions
     else:
-        return {}
+        return set()
 
 
 # Return true if FILENAME matches any pattern in the list of filename
 # patterns PATTERNS.
 def fnmatch_any(filename, patterns):
     for pattern in patterns:
         if fnmatch.fnmatch(filename, pattern):
             return True