From a8d85057026bc070b2f73b57133f1910218ad815 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 9 Dec 2015 03:20:12 -0500 Subject: Use a defaultdict and count to track seen items --- setuptools/command/build_py.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'setuptools/command/build_py.py') diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py index 55aed230..317dbba4 100644 --- a/setuptools/command/build_py.py +++ b/setuptools/command/build_py.py @@ -7,6 +7,8 @@ import fnmatch import textwrap import io import distutils.errors +import collections +import itertools try: @@ -195,14 +197,13 @@ class build_py(orig.build_py, Mixin2to3): os.path.join(src_dir, convert_path(pattern)), ) ) - seen = {} + seen = collections.defaultdict(itertools.count) return [ fn for fn in files if fn not in bad # ditch dupes - and fn not in seen - and seen.setdefault(fn, 1) + and not next(seen[fn]) ] -- cgit v1.2.3