third_party/blink/tools/blinkpy/web_tests/merge_results.py
def merge_dictlike(self,
                       dicts,
                       name=None,
                       order_cls=collections.OrderedDict):
        """Merge things which are dictionaries.

        Args:
            dicts (list of dict): Dictionary like objects to merge (should all
                be the same type).
            name (str): Name of the objects being merged (used for error
                messages).
            order_cls: Dict like object class used to produce key ordering.
                Defaults to collections.OrderedDict which means all keys in
                dicts[0] come before all keys in dicts[1], etc.

        Returns:
            dict: Merged dictionary object of same type as the objects in
            dicts.
        """
        MergeFailure.assert_type_eq(name, dicts)

        dict_mid = order_cls()
        for dobj in dicts:
            for key in dobj:
                dict_mid.setdefault(key, []).append(dobj[key])

        dict_out = dicts[0].__class__({})
        for k, v in dict_mid.items():
            assert v
            if len(v) == 1:
                dict_out[k] = v[0]
            elif len(v) > 1:
                dict_out[k] = self.merge(v, name=join_name(name, k))
        return dict_out
Merge things which are dictionaries.

        Args:
            dicts (list of dict): Dictionary like objects to merge (should all
                be the same type).
            name (str): Name of the objects being merged (used for error
                messages).
            order_cls: Dict like object class used to produce key ordering.
                Defaults to collections.OrderedDict which means all keys in
                dicts[0] come before all keys in dicts[1], etc.

        Returns:
            dict: Merged dictionary object of same type as the objects in
            dicts.
        
Merge things which are dictionaries.
Merge things which are dictionaries .
def merge_dictlike(self,
                       dicts,
                       name=None,
                       order_cls=collections.OrderedDict):
        MergeFailure.assert_type_eq(name, dicts)
        dict_mid = order_cls()
        for dobj in dicts:
            for key in dobj:
                dict_mid.setdefault(key, []).append(dobj[key])
        dict_out = dicts[0].__class__({})
        for k, v in dict_mid.items():
            assert v
            if len(v) == 1:
                dict_out[k] = v[0]
            elif len(v) > 1:
                dict_out[k] = self.merge(v, name=join_name(name, k))
        return dict_out
def merge_dictlike ( self , dicts , name = None , order_cls = collections . OrderedDict ) : MergeFailure . assert_type_eq ( name , dicts ) dict_mid = order_cls ( ) for dobj in dicts : for key in dobj : dict_mid . setdefault ( key , [ ] ) . append ( dobj [ key ] ) dict_out = dicts [ 0 ] . __class__ ( { } ) for k , v in dict_mid . items ( ) : assert v if len ( v ) == 1 : dict_out [ k ] = v [ 0 ] elif len ( v ) > 1 : dict_out [ k ] = self . merge ( v , name = join_name ( name , k ) ) return dict_out
Merge things which are dictionaries.
Merge things which are dictionaries .
"""Merge things which are dictionaries.

        Args:
            dicts (list of dict): Dictionary like objects to merge (should all
                be the same type).
            name (str): Name of the objects being merged (used for error
                messages).
            order_cls: Dict like object class used to produce key ordering.
                Defaults to collections.OrderedDict which means all keys in
                dicts[0] come before all keys in dicts[1], etc.

        Returns:
            dict: Merged dictionary object of same type as the objects in
            dicts.
        """
Merged dictionary object of same type as the objects in
dicts.
Merged dictionary object of same type as the objects in dicts .
dict
self
dicts
Dictionary like objects to merge (should all
be the same type).
Dictionary like objects to merge ( should all be the same type ) .
name
Name of the objects being merged (used for error
messages).
Name of the objects being merged ( used for error messages ) .
order_cls
Dict like object class used to produce key ordering.
Defaults to collections.OrderedDict which means all keys in
dicts[0] come before all keys in dicts[1], etc.
Dict like object class used to produce key ordering . Defaults to collections . OrderedDict which means all keys in dicts [ 0 ] come before all keys in dicts [ 1 ] etc .