예제 #1
0
        def keys(self):
            """Set-like object providing a view of index keys.

            >>> index = Index('/tmp/diskcache/index')
            >>> index.clear()
            >>> index.update({'a': 1, 'b': 2, 'c': 3})
            >>> keys_view = index.keys()
            >>> 'b' in keys_view
            True

            :return: keys view

            """
            return KeysView(self)
예제 #2
0
 def viewkeys(self):
     "OMD.viewkeys() -> a set-like object providing a view on OMD's keys"
     return KeysView(self)
예제 #3
0
 def viewkeys(self):
     "od.viewkeys() -> a set-like object providing a view on od's keys"
     return KeysView(self)
예제 #4
0
    if PYMINOR < 7:  # pragma: no cover
        warn('Python < 2.7 is not officially supported.')

    # 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
예제 #5
0
 def keys(self):
     return KeysView(self)
예제 #6
0
 def keys(self):
     """ Get a view object on member names """
     return KeysView(self)
예제 #7
0
 def keys(self):
     "D.keys() -> a set-like object providing a view on D's keys"
     return KeysView(self)
예제 #8
0
 def keys(self) -> KeysView:
     return KeysView(self)
예제 #9
0
 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))
예제 #10
0
 def keys(self):
     """
     Get all the keys of the configuration.
     :return tuple: The keys of the configuration.
     """
     return KeysView(self)