Import ifilterfalse as filterfalse, for python3 compatibility.
authorZac Medico <zmedico@gentoo.org>
Thu, 9 Sep 2010 11:34:13 +0000 (04:34 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 9 Sep 2010 11:34:13 +0000 (04:34 -0700)
pym/portage/util/__init__.py

index 2a2597b1a9756225c412661d8f563ef52fc538a7..c1658566c0e14ae8718801b1a30a0b5dcfcb93b1 100644 (file)
@@ -14,7 +14,10 @@ __all__ = ['apply_permissions', 'apply_recursive_permissions',
 import codecs
 from copy import deepcopy
 import errno
-from itertools import ifilterfalse
+try:
+       from itertools import filterfalse
+except ImportError:
+       from itertools import ifilterfalse as filterfalse
 import logging
 import re
 import shlex
@@ -737,7 +740,7 @@ def unique_everseen(iterable, key=None):
     seen = set()
     seen_add = seen.add
     if key is None:
-        for element in ifilterfalse(seen.__contains__, iterable):
+        for element in filterfalse(seen.__contains__, iterable):
             seen_add(element)
             yield element
     else: