launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24366
[Merge] ~cjwatson/launchpad:six-iterators into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:six-iterators into launchpad:master.
Commit message:
Import ifilter*/imap/izip* from six.moves
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/379654
Normally I prefer to use Python 3 names for things, but in this case those could introduce some confusion with corresponding Python 2 builtins that don't have iterator semantics, so I stuck with the Python 2 names instead for now.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:six-iterators into launchpad:master.
diff --git a/lib/lp/app/browser/stringformatter.py b/lib/lp/app/browser/stringformatter.py
index 57b8eaf..151997c 100644
--- a/lib/lp/app/browser/stringformatter.py
+++ b/lib/lp/app/browser/stringformatter.py
@@ -17,13 +17,13 @@ __all__ = [
]
from base64 import urlsafe_b64encode
-from itertools import izip_longest
import re
import sys
from breezy.patches import hunk_from_header
from lxml import html
import markdown
+from six.moves import zip_longest as izip_longest
from zope.component import getUtility
from zope.error.interfaces import IErrorReportingUtility
from zope.interface import implementer
diff --git a/lib/lp/app/browser/vocabulary.py b/lib/lp/app/browser/vocabulary.py
index 4dd7340..3d4230c 100644
--- a/lib/lp/app/browser/vocabulary.py
+++ b/lib/lp/app/browser/vocabulary.py
@@ -12,10 +12,9 @@ __all__ = [
'vocabulary_filters',
]
-from itertools import izip
-
from lazr.restful.interfaces import IWebServiceClientRequest
import simplejson
+from six.moves import zip as izip
from zope.component import (
adapter,
getUtility,
diff --git a/lib/lp/app/security.py b/lib/lp/app/security.py
index 9250a4b..7e85825 100644
--- a/lib/lp/app/security.py
+++ b/lib/lp/app/security.py
@@ -11,11 +11,9 @@ __all__ = [
'DelegatedAuthorization',
]
-from itertools import (
- izip,
- repeat,
- )
+from itertools import repeat
+from six.moves import zip as izip
from zope.component import queryAdapter
from zope.interface import implementer
from zope.security.permission import checkPermission
diff --git a/lib/lp/archivepublisher/domination.py b/lib/lp/archivepublisher/domination.py
index 0fee84c..a02fd78 100644
--- a/lib/lp/archivepublisher/domination.py
+++ b/lib/lp/archivepublisher/domination.py
@@ -54,16 +54,16 @@ __all__ = ['Dominator']
from collections import defaultdict
from datetime import timedelta
-from itertools import (
- ifilter,
- ifilterfalse,
- )
from operator import (
attrgetter,
itemgetter,
)
import apt_pkg
+from six.moves import (
+ filter as ifilter,
+ filterfalse as ifilterfalse,
+ )
from storm.expr import (
And,
Count,
diff --git a/lib/lp/archivepublisher/scripts/publishdistro.py b/lib/lp/archivepublisher/scripts/publishdistro.py
index efdfc14..b114e8e 100644
--- a/lib/lp/archivepublisher/scripts/publishdistro.py
+++ b/lib/lp/archivepublisher/scripts/publishdistro.py
@@ -7,9 +7,9 @@ __all__ = [
'PublishDistro',
]
-from itertools import ifilter
from optparse import OptionValueError
+from six.moves import filter as ifilter
from zope.component import getUtility
from lp.app.errors import NotFoundError
diff --git a/lib/lp/code/interfaces/branchlookup.py b/lib/lp/code/interfaces/branchlookup.py
index 8280d03..c364e8e 100644
--- a/lib/lp/code/interfaces/branchlookup.py
+++ b/lib/lp/code/interfaces/branchlookup.py
@@ -11,11 +11,10 @@ __all__ = [
'ILinkedBranchTraverser',
]
-from itertools import (
- ifilter,
- imap,
+from six.moves import (
+ filter as ifilter,
+ map as imap,
)
-
from zope.interface import Interface
from lp.code.interfaces.codehosting import (
diff --git a/lib/lp/registry/scripts/teamparticipation.py b/lib/lp/registry/scripts/teamparticipation.py
index ff7946c..4bd9135 100644
--- a/lib/lp/registry/scripts/teamparticipation.py
+++ b/lib/lp/registry/scripts/teamparticipation.py
@@ -19,10 +19,12 @@ from functools import partial
from itertools import (
chain,
count,
- imap,
- izip,
)
+from six.moves import (
+ map as imap,
+ zip as izip,
+ )
import transaction
from lp.registry.interfaces.teammembership import ACTIVE_STATES
diff --git a/lib/lp/services/features/scopes.py b/lib/lp/services/features/scopes.py
index 862b844..32f7ab8 100644
--- a/lib/lp/services/features/scopes.py
+++ b/lib/lp/services/features/scopes.py
@@ -23,9 +23,10 @@ __all__ = [
__metaclass__ = type
-from itertools import izip_longest
import re
+from six.moves import zip_longest as izip_longest
+
from lp.registry.interfaces.person import IPerson
import lp.services.config
from lp.services.propertycache import cachedproperty
diff --git a/lib/lp/services/testing/parallel.py b/lib/lp/services/testing/parallel.py
index 26d9e09..b169b0f 100644
--- a/lib/lp/services/testing/parallel.py
+++ b/lib/lp/services/testing/parallel.py
@@ -12,6 +12,7 @@ import sys
import tempfile
from breezy.osutils import local_concurrency
+from six.moves import zip as izip
from subunit import ProtocolTestCase
from subunit.run import SubunitTestRunner
from testtools import (
@@ -139,8 +140,7 @@ def partition_tests(test_ids, count):
# just one partition. So the slowest partition shouldn't be much slower
# than the fastest.
partitions = [list() for i in range(count)]
- for partition, test_id in itertools.izip(
- itertools.cycle(partitions), test_ids):
+ for partition, test_id in izip(itertools.cycle(partitions), test_ids):
partition.append(test_id)
return partitions
diff --git a/lib/lp/testing/utilities/retest.py b/lib/lp/testing/utilities/retest.py
index 172f536..46906bc 100755
--- a/lib/lp/testing/utilities/retest.py
+++ b/lib/lp/testing/utilities/retest.py
@@ -25,11 +25,13 @@ report (or a part of) can be piped in, for example by pasting it:
from __future__ import print_function
import fileinput
-from itertools import takewhile, imap
+from itertools import takewhile
import os
import re
import sys
+from six.moves import map as imap
+
from lp.services.config import config