Map values from match into a dictionary.
963920
def match_to_dict(self, match, gids):
        
        values = {}
        for gid in gids:
            try:
                values[gid] = self.map_value(match.group(gid), gid)
            except IndexError:
                pass
        return values
543448
def _split_index(params):
    
    result = {}
    for key in params:
        if isinstance(params[key], dict):
            value = params[key]['_value']
        else:
            value = params[key]
        result[key] = value
    return result
1027490
def to_dict(self):
        """"""
        if self.operator == '$eq':
            return {self.q: self.value}
        if self.q is None:
            return {self.operator: self.value}
        return {self.q: {self.operator: self.value}}
939229
def fromDictionary(value):
        """"""
        if isinstance(value, dict):
            pp = PortalParameters()
            for k,v in value.items():
                setattr(pp, "_%s" % k, v)
            return pp
        else:
            raise AttributeError("Invalid input.")
1329667
def clean_dict(d, test=lambda v: v):
    
    return {k: v for k, v in d.items() if test(v)}
703962
def valuestodict(key):
    """"""
    dict = {}
    size = winreg.QueryInfoKey(key)[1]
    for i in range(size):
        data = winreg.EnumValue(key, i)
        dict[data[0]] = data[1]
    return dict
111734
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'document' in _dict:
            args['document'] = DocumentEmotionResults._from_dict(
                _dict.get('document'))
        if 'targets' in _dict:
            args['targets'] = [
                TargetedEmotionResults._from_dict(x)
                for x in (_dict.get('targets'))
            ]
        return cls(**args)
220707
def _many_to_one(input_dict):
    """"""
    return dict((key, val)
                for keys, val in input_dict.items()
                for key in keys)
23039
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self,
                   'matching_results') and self.matching_results is not None:
            _dict['matching_results'] = self.matching_results
        if hasattr(self, 'results') and self.results is not None:
            _dict['results'] = [x._to_dict() for x in self.results]
        if hasattr(self, 'aggregations') and self.aggregations is not None:
            _dict['aggregations'] = [x._to_dict() for x in self.aggregations]
        if hasattr(self, 'passages') and self.passages is not None:
            _dict['passages'] = [x._to_dict() for x in self.passages]
        if hasattr(
                self,
                'duplicates_removed') and self.duplicates_removed is not None:
            _dict['duplicates_removed'] = self.duplicates_removed
        return _dict
298842
def to_python(self, value):
        """"""
        if value is None or value == '':
            return {}

        if isinstance(value, six.string_types):
            res = loads(value)
        else:
            res = value

        if isinstance(res, dict):
            return JSONDict(**res)
        elif isinstance(res, list):
            return JSONList(res)

        return res
389829
def compile_patterns_in_dictionary(dictionary):
    
    for key, value in dictionary.items():
        if isinstance(value, str):
            dictionary[key] = re.compile(value)
        elif isinstance(value, dict):
            compile_patterns_in_dictionary(value)
    return dictionary
1029756
def list2dict(list_of_options):
    """"""
    d = {}
    for key, value in list_of_options:
        d[key] = value
    return d
1153611
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'tokens' in _dict:
            args['tokens'] = [
                TokenResult._from_dict(x) for x in (_dict.get('tokens'))
            ]
        if 'sentences' in _dict:
            args['sentences'] = [
                SentenceResult._from_dict(x) for x in (_dict.get('sentences'))
            ]
        return cls(**args)
180748
def key_str(self, match):
        '''
        
        '''
        ret = {}
        for status, keys in six.iteritems(self.name_match(match)):
            ret[status] = {}
            for key in salt.utils.data.sorted_ignorecase(keys):
                path = os.path.join(self.opts['pki_dir'], status, key)
                with salt.utils.files.fopen(path, 'r') as fp_:
                    ret[status][key] = \
                        salt.utils.stringutils.to_unicode(fp_.read())
        return ret
1227479
def to_python(self):
        """"""
        mapping = {}
        for row in self.rows:
            mapping[row[0]] = _format_python_value(row[1])
        return mapping
598065
def fromkeys (cls, iterable, value=None):
        """"""
        d = cls()
        for k in iterable:
            dict.__setitem__(d, k.lower(), value)
        return d
551329
def dict_match(a, b):
    
    res = []
    for k, v in a.items():
        try:
            res.append(b[k] == v)
        except KeyError:
            pass
    return all(res)