diff --git a/python/mach/mach/config.py b/python/mach/mach/config.py --- a/python/mach/mach/config.py +++ b/python/mach/mach/config.py @@ -17,6 +17,7 @@ from __future__ import absolute_import, unicode_literals import collections +import collections.abc import os import sys import six @@ -146,7 +147,7 @@ return _ -class ConfigSettings(collections.Mapping): +class ConfigSettings(collections.abc.Mapping): """Interface for configuration settings. This is the main interface to the configuration. @@ -192,7 +193,7 @@ 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): @@ -317,13 +318,7 @@ self._config.write(fh) @classmethod - def _format_metadata( - cls, - type_cls, - description, - default=DefaultValue, - extra=None, - ): + def _format_metadata(cls, type_cls, description, default=DefaultValue, extra=None): """Formats and returns the metadata for a setting. Each setting must have: @@ -344,10 +339,7 @@ if isinstance(type_cls, string_types): type_cls = TYPE_CLASSES[type_cls] - meta = { - "description": description, - "type_cls": type_cls, - } + meta = {"description": description, "type_cls": type_cls} if default != DefaultValue: meta["default"] = default diff --git a/python/mach/mach/decorators.py b/python/mach/mach/decorators.py --- a/python/mach/mach/decorators.py +++ b/python/mach/mach/decorators.py @@ -6,6 +6,7 @@ import argparse import collections +import collections.abc from .base import MachError from .registrar import Registrar @@ -151,7 +152,7 @@ + "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 --- a/python/mach/mach/main.py +++ b/python/mach/mach/main.py @@ -16,7 +16,7 @@ import sys import traceback import uuid -from collections import Iterable +from collections.abc import Iterable from six import string_types @@ -34,10 +34,7 @@ from .logging import LoggingManager from .registrar import Registrar from .sentry import register_sentry, NoopErrorReporter -from .telemetry import ( - report_invocation_metrics, - create_telemetry_from_environment, -) +from .telemetry import report_invocation_metrics, create_telemetry_from_environment from .util import setenv, UserError SUGGEST_MACH_BUSTED_TEMPLATE = r""" diff --git a/python/mozbuild/mozbuild/backend/configenvironment.py b/python/mozbuild/mozbuild/backend/configenvironment.py --- a/python/mozbuild/mozbuild/backend/configenvironment.py +++ b/python/mozbuild/mozbuild/backend/configenvironment.py @@ -9,7 +9,8 @@ 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 @@ -62,10 +63,7 @@ compile(source, path, "exec", dont_inherit=1), ) - g = { - "__builtins__": __builtins__, - "__file__": path, - } + g = {"__builtins__": __builtins__, "__file__": path} l = {} try: exec(code_cache[path][1], g, l) diff --git a/python/mozbuild/mozbuild/makeutil.py b/python/mozbuild/mozbuild/makeutil.py --- a/python/mozbuild/mozbuild/makeutil.py +++ b/python/mozbuild/mozbuild/makeutil.py @@ -7,7 +7,7 @@ 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 --- a/python/mozbuild/mozbuild/util.py +++ b/python/mozbuild/mozbuild/util.py @@ -9,6 +9,7 @@ import argparse import collections +import collections.abc import ctypes import difflib import errno @@ -809,7 +810,7 @@ self._strings = StrictOrderingOnAppendList() self._children = {} - class StringListAdaptor(collections.Sequence): + class StringListAdaptor(collections.abc.Sequence): def __init__(self, hsl): self._hsl = hsl diff --git a/taskcluster/taskgraph/util/schema.py b/taskcluster/taskgraph/util/schema.py --- a/taskcluster/taskgraph/util/schema.py +++ b/taskcluster/taskgraph/util/schema.py @@ -7,6 +7,7 @@ import re import pprint import collections +import collections.abc import voluptuous from six import text_type, iteritems @@ -190,7 +191,7 @@ ) ) - if isinstance(sch, collections.Mapping): + if isinstance(sch, collections.abc.Mapping): for k, v in iteritems(sch): child = "{}[{!r}]".format(path, k) check_identifier(child, k) diff --git a/testing/mozbase/manifestparser/manifestparser/filters.py b/testing/mozbase/manifestparser/manifestparser/filters.py --- a/testing/mozbase/manifestparser/manifestparser/filters.py +++ b/testing/mozbase/manifestparser/manifestparser/filters.py @@ -12,7 +12,8 @@ import itertools import os -from collections import defaultdict, MutableSequence +from collections import defaultdict +from collections.abc import MutableSequence import six from six import string_types diff --git a/third_party/python/gyp/pylib/gyp/common.py b/third_party/python/gyp/pylib/gyp/common.py --- a/third_party/python/gyp/pylib/gyp/common.py +++ b/third_party/python/gyp/pylib/gyp/common.py @@ -5,6 +5,7 @@ from __future__ import with_statement import collections +import collections.abc import errno import filecmp import os.path @@ -494,7 +495,7 @@ # 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