Python UserDict.DictMixin.values() Examples

The following are 4 code examples of UserDict.DictMixin.values(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module UserDict.DictMixin , or try the search function .
Example #1
Source File: inirama.py    From linter-pylama with MIT License 6 votes vote down vote up
def read(self, *files, **params):
        """ Read and parse INI files.

        :param *files: Files for reading
        :param **params: Params for parsing

        Set `update=False` for prevent values redefinition.

        """
        for f in files:
            try:
                with io.open(f, encoding='utf-8') as ff:
                    NS_LOGGER.info('Read from `{0}`'.format(ff.name))
                    self.parse(ff.read(), **params)
            except (IOError, TypeError, SyntaxError, io.UnsupportedOperation):
                if not self.silent_read:
                    NS_LOGGER.error('Reading error `{0}`'.format(ff.name))
                    raise 
Example #2
Source File: python2x.py    From D-VAE with MIT License 5 votes vote down vote up
def __delitem__(self, elem):
            '''Like dict.__delitem__() but does not raise KeyError for
            missing values.'''
            if elem in self:
                dict.__delitem__(self, elem) 
Example #3
Source File: python2x.py    From attention-lvcsr with MIT License 5 votes vote down vote up
def __delitem__(self, elem):
            '''Like dict.__delitem__() but does not raise KeyError for
            missing values.'''
            if elem in self:
                dict.__delitem__(self, elem) 
Example #4
Source File: utils.py    From RaceCapture_App with GNU General Public License v3.0 4 votes vote down vote up
def kvquery(root, **kwargs):
    '''kvquery provides a convinient way of finding widgets in an
    application that uses the kv style language.

    example:
        lets say you have a .kv file with the following Rule:
        <MovieWidget>:
            BoxLayout:
                Video:
                    kvid: 'video'
                Label:
                    text: root.movie_title
                Label:
                    text: root.movie_description

        in your python code, you may want to get the reference to
        Video widget nested inside the widget you have a handle to.

        # video will be the first node that jas a 'kvid' property == 'video'
        video = kvquery(movie, kvid='video').next()


        #lets get all teh labels in a list
        labels = list(kvquery(movie, __class__=Label))


    :Parameters:
    `root`: root of the tree to queried
        this node and all decendants will be iterated by the
        returned generator.

    `**kwargs`: **kwargs, key/value pairs
        The keys corrosponf to porperty names, and values to the
        property values of the widget nodes being queried.  If a node
        has at least one attr such that (gettattr(node, key) == value)
        is true; it will be included in the iteration.
    '''

    def _query(w):
        '''iternal query function / predicate for tree query
        '''
        for k, v in kwargs.iteritems():
            if (v == getattr(w, k, None)):
                return True


    return filter_tree(root, _query)