加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0002-fix-from-collections-import-Iterable.patch 7.75 KB
一键复制 编辑 原始数据 按行查看 历史
diff --git a/python/mach/mach/config.py b/python/mach/mach/config.py
index 7210eca..edb4d2e 100644
--- a/python/mach/mach/config.py
+++ b/python/mach/mach/config.py
@@ -144,7 +144,7 @@ def reraise_attribute_error(func):
return _
-class ConfigSettings(collections.Mapping):
+class ConfigSettings(collections.abc.Mapping):
"""Interface for configuration settings.
This is the main interface to the configuration.
@@ -190,7 +190,7 @@ class ConfigSettings(collections.Mapping):
will result in exceptions being raised.
"""
- class ConfigSection(collections.MutableMapping, object):
+ class ConfigSection(collections.abc.MutableMapping, object):
"""Represents an individual config section."""
def __init__(self, config, name, settings):
object.__setattr__(self, '_config', config)
diff --git a/python/mach/mach/decorators.py b/python/mach/mach/decorators.py
index f69a75b..afc1797 100644
--- a/python/mach/mach/decorators.py
+++ b/python/mach/mach/decorators.py
@@ -5,7 +5,7 @@
from __future__ import absolute_import, unicode_literals
import argparse
-import collections
+import collections.abc
import inspect
import sys
@@ -159,7 +159,7 @@ def CommandProvider(cls):
'Conditions argument must take a list ' + \
'of functions. Found %s instead.'
- if not isinstance(command.conditions, collections.Iterable):
+ if not isinstance(command.conditions, collections.abc.Iterable):
msg = msg % (command.name, type(command.conditions))
raise MachError(msg)
diff --git a/python/mach/mach/main.py b/python/mach/mach/main.py
index 95f492f..5b8d205 100644
--- a/python/mach/mach/main.py
+++ b/python/mach/mach/main.py
@@ -16,7 +16,7 @@ import os
import sys
import traceback
import uuid
-from collections import Iterable
+from collections.abc import Iterable
from mach.sentry import register_sentry, report_exception
from six import string_types
diff --git a/python/mozbuild/mozbuild/backend/configenvironment.py b/python/mozbuild/mozbuild/backend/configenvironment.py
index 20d1a9f..898cabb 100644
--- a/python/mozbuild/mozbuild/backend/configenvironment.py
+++ b/python/mozbuild/mozbuild/backend/configenvironment.py
@@ -9,7 +9,8 @@ import six
import sys
import json
-from collections import Iterable, OrderedDict
+from collections.abc import Iterable
+from collections import OrderedDict
from types import ModuleType
import mozpack.path as mozpath
diff --git a/python/mozbuild/mozbuild/makeutil.py b/python/mozbuild/mozbuild/makeutil.py
index 4da1a3b..4ce5684 100644
--- a/python/mozbuild/mozbuild/makeutil.py
+++ b/python/mozbuild/mozbuild/makeutil.py
@@ -7,7 +7,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import os
import re
import six
-from collections import Iterable
+from collections.abc import Iterable
class Makefile(object):
diff --git a/python/mozbuild/mozbuild/util.py b/python/mozbuild/mozbuild/util.py
index 044cf64..98ed3ef 100644
--- a/python/mozbuild/mozbuild/util.py
+++ b/python/mozbuild/mozbuild/util.py
@@ -782,7 +782,7 @@ class HierarchicalStringList(object):
self._strings = StrictOrderingOnAppendList()
self._children = {}
- class StringListAdaptor(collections.Sequence):
+ class StringListAdaptor(collections.abc.Sequence):
def __init__(self, hsl):
self._hsl = hsl
diff --git a/testing/mozbase/manifestparser/manifestparser/filters.py b/testing/mozbase/manifestparser/manifestparser/filters.py
index 9b57b2f..9bcca5b 100644
--- a/testing/mozbase/manifestparser/manifestparser/filters.py
+++ b/testing/mozbase/manifestparser/manifestparser/filters.py
@@ -12,7 +12,8 @@ from __future__ import absolute_import
import itertools
import os
-from collections import defaultdict, MutableSequence
+from collections.abc import MutableSequence
+from collections import defaultdict
import six
from six import string_types
diff --git a/testing/mozbase/versioninfo.py b/testing/mozbase/versioninfo.py
index 91d1a04..8c16800 100755
--- a/testing/mozbase/versioninfo.py
+++ b/testing/mozbase/versioninfo.py
@@ -11,7 +11,7 @@ from commit messages.
from __future__ import absolute_import, print_function
-from collections import Iterable
+from collections.abc import Iterable
from distutils.version import StrictVersion
import argparse
import os
diff --git a/third_party/python/gyp/pylib/gyp/common.py b/third_party/python/gyp/pylib/gyp/common.py
index b268d22..4f9cb0e 100644
--- a/third_party/python/gyp/pylib/gyp/common.py
+++ b/third_party/python/gyp/pylib/gyp/common.py
@@ -494,7 +494,7 @@ def uniquer(seq, idfun=None):
# Based on http://code.activestate.com/recipes/576694/.
-class OrderedSet(collections.MutableSet):
+class OrderedSet(collections.abc.MutableSet):
def __init__(self, iterable=None):
self.end = end = []
end += [None, end, end] # sentinel node for doubly linked list
diff --git a/third_party/python/gyp/pylib/gyp/msvs_emulation.py b/third_party/python/gyp/pylib/gyp/msvs_emulation.py
index 63d40e6..43fbbbb 100644
--- a/third_party/python/gyp/pylib/gyp/msvs_emulation.py
+++ b/third_party/python/gyp/pylib/gyp/msvs_emulation.py
@@ -91,7 +91,7 @@ def _AddPrefix(element, prefix):
"""Add |prefix| to |element| or each subelement if element is iterable."""
if element is None:
return element
- if (isinstance(element, collections.Iterable) and
+ if (isinstance(element, collections.abc.Iterable) and
not isinstance(element, basestring)):
return [prefix + e for e in element]
else:
@@ -104,7 +104,7 @@ def _DoRemapping(element, map):
if map is not None and element is not None:
if not callable(map):
map = map.get # Assume it's a dict, otherwise a callable to do the remap.
- if (isinstance(element, collections.Iterable) and
+ if (isinstance(element, collections.abc.Iterable) and
not isinstance(element, basestring)):
element = filter(None, [map(elem) for elem in element])
else:
@@ -117,7 +117,7 @@ def _AppendOrReturn(append, element):
then add |element| to it, adding each item in |element| if it's a list or
tuple."""
if append is not None and element is not None:
- if (isinstance(element, collections.Iterable) and
+ if (isinstance(element, collections.abc.Iterable) and
not isinstance(element, basestring)):
append.extend(element)
else:
diff --git a/third_party/python/virtualenv/virtualenv.py b/third_party/python/virtualenv/virtualenv.py
index 9eaedaf..3ef431c 100755
--- a/third_party/python/virtualenv/virtualenv.py
+++ b/third_party/python/virtualenv/virtualenv.py
@@ -1804,7 +1804,7 @@ def fix_local_scheme(home_dir, symlink=True):
pass
else:
# noinspection PyProtectedMember
- if sysconfig._get_default_scheme() == "posix_local":
+ if sysconfig.get_default_scheme() == "posix_local":
local_path = os.path.join(home_dir, "local")
if not os.path.exists(local_path):
os.mkdir(local_path)
diff --git a/third_party/python/voluptuous/voluptuous/schema_builder.py b/third_party/python/voluptuous/voluptuous/schema_builder.py
index 8d7a81a..92b60ac 100644
--- a/third_party/python/voluptuous/voluptuous/schema_builder.py
+++ b/third_party/python/voluptuous/voluptuous/schema_builder.py
@@ -1,4 +1,4 @@
-import collections
+import collections.abc
import inspect
import re
from functools import wraps
@@ -280,7 +280,7 @@ class Schema(object):
return schema.__voluptuous_compile__(self)
if isinstance(schema, Object):
return self._compile_object(schema)
- if isinstance(schema, collections.Mapping):
+ if isinstance(schema, collections.abc.Mapping):
return self._compile_dict(schema)
elif isinstance(schema, list):
return self._compile_list(schema)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化