Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-17088: Replace collections with collections.abc #33

Merged
merged 1 commit into from
Jan 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions python/lsst/pex/config/configChoiceField.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
__all__ = ["ConfigChoiceField"]

import copy
import collections
import collections.abc

from .config import Config, Field, FieldValidationError, _typeStr, _joinNamePath
from .comparison import getComparisonName, compareScalars, compareConfigs
from .callStack import getCallStack, getStackFrame


class SelectionSet(collections.MutableSet):
class SelectionSet(collections.abc.MutableSet):
"""
Custom set class used to track the selection of multi-select
ConfigChoiceField.
Expand Down Expand Up @@ -107,14 +107,14 @@ def __str__(self):
return str(list(self._set))


class ConfigInstanceDict(collections.Mapping):
class ConfigInstanceDict(collections.abc.Mapping):
"""A dict of instantiated configs, used to populate a ConfigChoiceField.

typemap must support the following:
- typemap[name]: return the config class associated with the given name
"""
def __init__(self, config, field):
collections.Mapping.__init__(self)
collections.abc.Mapping.__init__(self)
self._dict = dict()
self._selection = None
self._config = config
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/pex/config/dictField.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

__all__ = ["DictField"]

import collections
import collections.abc

from .config import Field, FieldValidationError, _typeStr, _autocast, _joinNamePath
from .comparison import getComparisonName, compareScalars
from .callStack import getCallStack, getStackFrame


class Dict(collections.MutableMapping):
class Dict(collections.abc.MutableMapping):
"""
Config-Internal mapping container
Emulates a dict, but adds validation and provenance.
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/pex/config/listField.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

__all__ = ["ListField"]

import collections
import collections.abc

from .config import Field, FieldValidationError, _typeStr, _autocast, _joinNamePath
from .comparison import compareScalars, getComparisonName
from .callStack import getCallStack, getStackFrame


class List(collections.MutableSequence):
class List(collections.abc.MutableSequence):
def __init__(self, config, field, value, at, label, setHistory=True):
self._field = field
self._config = config
Expand Down
6 changes: 3 additions & 3 deletions python/lsst/pex/config/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

__all__ = ("Registry", "makeRegistry", "RegistryField", "registerConfig", "registerConfigurable")

import collections
import collections.abc
import copy

from .config import Config, FieldValidationError, _typeStr
Expand All @@ -43,7 +43,7 @@ def __call__(self, *args, **kwargs):
return self._target(*args, **kwargs)


class Registry(collections.Mapping):
class Registry(collections.abc.Mapping):
"""A base class for global registries, mapping names to configurables.

There are no hard requirements on configurable, but they typically create an algorithm
Expand Down Expand Up @@ -125,7 +125,7 @@ def makeField(self, doc, default=None, optional=False, multi=False):
return RegistryField(doc, self, default, optional, multi)


class RegistryAdaptor(collections.Mapping):
class RegistryAdaptor(collections.abc.Mapping):
"""Private class that makes a Registry behave like the thing a ConfigChoiceField expects."""

def __init__(self, registry):
Expand Down