bpo-30143: 2to3 now generates a code that uses abstract collection cl… · python/cpython@0a2abdf (original) (raw)

`@@ -2,8 +2,8 @@

`

2

2

``

3

3

`operator.isCallable(obj) -> hasattr(obj, 'call')

`

4

4

`operator.sequenceIncludes(obj) -> operator.contains(obj)

`

5

``

`-

operator.isSequenceType(obj) -> isinstance(obj, collections.Sequence)

`

6

``

`-

operator.isMappingType(obj) -> isinstance(obj, collections.Mapping)

`

``

5

`+

operator.isSequenceType(obj) -> isinstance(obj, collections.abc.Sequence)

`

``

6

`+

operator.isMappingType(obj) -> isinstance(obj, collections.abc.Mapping)

`

7

7

`operator.isNumberType(obj) -> isinstance(obj, numbers.Number)

`

8

8

`operator.repeat(obj, n) -> operator.mul(obj, n)

`

9

9

`operator.irepeat(obj, n) -> operator.imul(obj, n)

`

`@@ -63,13 +63,13 @@ def _repeat(self, node, results):

`

63

63

`def _irepeat(self, node, results):

`

64

64

`return self._handle_rename(node, results, "imul")

`

65

65

``

66

``

`-

@invocation("isinstance(%s, collections.Sequence)")

`

``

66

`+

@invocation("isinstance(%s, collections.abc.Sequence)")

`

67

67

`def _isSequenceType(self, node, results):

`

68

``

`-

return self._handle_type2abc(node, results, "collections", "Sequence")

`

``

68

`+

return self._handle_type2abc(node, results, "collections.abc", "Sequence")

`

69

69

``

70

``

`-

@invocation("isinstance(%s, collections.Mapping)")

`

``

70

`+

@invocation("isinstance(%s, collections.abc.Mapping)")

`

71

71

`def _isMappingType(self, node, results):

`

72

``

`-

return self._handle_type2abc(node, results, "collections", "Mapping")

`

``

72

`+

return self._handle_type2abc(node, results, "collections.abc", "Mapping")

`

73

73

``

74

74

`@invocation("isinstance(%s, numbers.Number)")

`

75

75

`def _isNumberType(self, node, results):

`