launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24370
[Merge] ~cjwatson/launchpad:no-operator-istype into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:no-operator-istype into launchpad:master.
Commit message:
Convert from operator.is*Type to ABC tests
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/379673
The operator.is*Type functions no longer exist in Python 3.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:no-operator-istype into launchpad:master.
diff --git a/lib/lp/services/webapp/batching.py b/lib/lp/services/webapp/batching.py
index 7cba096..ce4d3ea 100644
--- a/lib/lp/services/webapp/batching.py
+++ b/lib/lp/services/webapp/batching.py
@@ -4,7 +4,6 @@
__metaclass__ = type
from datetime import datetime
-from operator import isSequenceType
import re
from iso8601 import (
@@ -14,6 +13,7 @@ from iso8601 import (
import lazr.batchnavigator
from lazr.batchnavigator.interfaces import IRangeFactory
import simplejson
+from six.moves.collections_abc import Sequence
from storm import Undef
from storm.expr import (
And,
@@ -220,7 +220,8 @@ class ShadowedList:
BatchNavigator and Batch.
"""
def __init__(self, values, shadow_values):
- if not isSequenceType(values) or not isSequenceType(shadow_values):
+ if (not isinstance(values, Sequence) or
+ not isinstance(shadow_values, Sequence)):
raise TypeError("values and shadow_values must be sequences.")
if len(values) != len(shadow_values):
raise ValueError(
diff --git a/lib/lp/testing/factory.py b/lib/lp/testing/factory.py
index bac9b17..7932f65 100644
--- a/lib/lp/testing/factory.py
+++ b/lib/lp/testing/factory.py
@@ -34,10 +34,6 @@ from email.utils import (
)
import hashlib
from itertools import count
-from operator import (
- isMappingType,
- isSequenceType,
- )
import os
from StringIO import StringIO
import sys
@@ -53,6 +49,10 @@ from lazr.jobrunner.jobrunner import SuspendJobException
import pytz
from pytz import UTC
import six
+from six.moves.collections_abc import (
+ Mapping,
+ Sequence,
+ )
from twisted.conch.ssh.common import (
MP,
NS,
@@ -5039,11 +5039,11 @@ def is_security_proxied_or_harmless(obj):
return True
if type(obj) in unwrapped_types:
return True
- if isSequenceType(obj) or isinstance(obj, (set, frozenset)):
+ if isinstance(obj, Sequence) or isinstance(obj, (set, frozenset)):
return all(
is_security_proxied_or_harmless(element)
for element in obj)
- if isMappingType(obj):
+ if isinstance(obj, Mapping):
return all(
(is_security_proxied_or_harmless(key) and
is_security_proxied_or_harmless(obj[key]))