Example #1
0
 def keys(self):
     return KeysView(self)
Example #2
0
        raise ImportError('Python 2.7 or 3.5+ is required.')
    warn('Python 2 support will be dropped in a future release.')

    # abstractproperty deprecated in Python 3.3 in favor of using @property with @abstractmethod.
    # Before 3.3, this silently fails to detect when an abstract property has not been overridden.
    from abc import abstractproperty  #:

    from itertools import izip  #:

    # In Python 3, the collections ABCs were moved into collections.abc, which does not exist in
    # Python 2. Support for importing them directly from collections is dropped in Python 3.8.
    import collections as collections_abc  # noqa: F401 (imported but unused)
    from collections import (  # noqa: F401 (imported but unused)
        Mapping, MutableMapping, KeysView, ValuesView, ItemsView)

    viewkeys = lambda m: m.viewkeys() if hasattr(m, 'viewkeys') else KeysView(
        m)  #:
    viewvalues = lambda m: m.viewvalues() if hasattr(m, 'viewvalues'
                                                     ) else ValuesView(m)  #:
    viewitems = lambda m: m.viewitems() if hasattr(m, 'viewitems'
                                                   ) else ItemsView(m)  #:

    iterkeys = lambda m: m.iterkeys() if hasattr(m, 'iterkeys') else iter(
        m.keys())  #:
    itervalues = lambda m: m.itervalues() if hasattr(
        m, 'itervalues') else iter(m.values())  #:
    iteritems = lambda m: m.iteritems() if hasattr(m, 'iteritems') else iter(
        m.items())  #:

else:
    # Assume Python 3 when not PY2, but explicitly check before showing this warning.
    if PYMAJOR == 3 and PYMINOR < 5:  # pragma: no cover
Example #3
0
 def viewkeys(self):
     "od.viewkeys() -> a set-like object providing a view on od's keys"
     return KeysView(self)
Example #4
0
 def viewkeys(self):
     "OMD.viewkeys() -> a set-like object providing a view on OMD's keys"
     return KeysView(self)
Example #5
0
 def keys(self):
     """ Get a view object on member names """
     return KeysView(self)
 def _keys_proxy(self, getter):
     for u in self.units:
         self.assertRaises(TypeError, itemgetter(0), getter(u.frz))
         self.assertEqual(getter(u.frz), KeysView(u.orig))
Example #7
0
 def keys(self):
     "D.keys() -> a set-like object providing a view on D's keys"
     return KeysView(self)
Example #8
0
 def keys(self):
     """
     Get all the keys of the configuration.
     :return tuple: The keys of the configuration.
     """
     return KeysView(self)