Merge N different HyperLogLogs into a single one.
351732
def pfmerge(self, destkey, sourcekey, *sourcekeys):
        """"""
        fut = self.execute(b'PFMERGE', destkey, sourcekey, *sourcekeys)
        return wait_ok(fut)
1076461
def merge (d, o):
    """"""
    for k in o.keys():
        if type(o[k]) is dict and k in d:
            merge(d[k], o[k])
        else:
            d[k] = o[k]
    return d
560390
def merge(self, ontologies):
        
        if self.xref_graph is None:
            self.xref_graph = nx.MultiGraph()
        logger.info("Merging source: {} xrefs: {}".format(self, len(self.xref_graph.edges())))
        for ont in ontologies:
            logger.info("Merging {} into {}".format(ont, self))
            g = self.get_graph()
            srcg = ont.get_graph()
            for n in srcg.nodes():
                g.add_node(n, **srcg.node[n])
            for (o,s,m) in srcg.edges(data=True):
                g.add_edge(o,s,**m)
            if ont.xref_graph is not None:
                for (o,s,m) in ont.xref_graph.edges(data=True):
                    self.xref_graph.add_edge(o,s,**m)
729802
def _merge_list(self, key, lst):
    
    self[key] += [x for x in lst if x not in self[key]]
549899
def merge(value,
          default='',
          omit_opts=False,
          omit_master=False,
          omit_pillar=False):
    '''
    
    '''
    ret = None
    if not omit_opts:
        if value in __opts__:
            ret = __opts__[value]
            if isinstance(ret, six.string_types):
                return ret
    if not omit_master:
        if value in __pillar__.get('master', {}):
            tmp = __pillar__['master'][value]
            if ret is None:
                ret = tmp
                if isinstance(ret, six.string_types):
                    return ret
            elif isinstance(ret, dict) and isinstance(tmp, dict):
                tmp.update(ret)
                ret = tmp
            elif (isinstance(ret, (list, tuple)) and
                    isinstance(tmp, (list, tuple))):
                ret = list(ret) + list(tmp)
    if not omit_pillar:
        if value in __pillar__:
            tmp = __pillar__[value]
            if ret is None:
                ret = tmp
                if isinstance(ret, six.string_types):
                    return ret
            elif isinstance(ret, dict) and isinstance(tmp, dict):
                tmp.update(ret)
                ret = tmp
            elif (isinstance(ret, (list, tuple)) and
                    isinstance(tmp, (list, tuple))):
                ret = list(ret) + list(tmp)
    if ret is None and value in DEFAULTS:
        return DEFAULTS[value]
    return ret or default
858581
def zip_dict(*dicts):
  """"""
  for key in set(itertools.chain(*dicts)):  # set merge all keys
    # Will raise KeyError if the dict don't have the same keys
    yield key, tuple(d[key] for d in dicts)
140234
def MergeLines(self, lines, message):
    """"""
    self._allow_multiple_scalars = True
    self._ParseOrMerge(lines, message)
    return message
398502
def merge_values(src, new):
    """"""
    if isinstance(src, dict) and isinstance(new, dict):
        return merge_dicts(src, new)
    else:
        if not isinstance(src, list):
            src = [src]
        if not isinstance(new, list):
            new = [new]

        return merge_lists(src, new)
334514
def merge_dicts(*dicts, **kwargs):
    """"""
    result = {}
    for d in dicts:
        result.update(d)
    result.update(kwargs)
    return result
127293
def merge_parts(self, version_id=None, **kwargs):
        """"""
        self.file.update_checksum(**kwargs)
        with db.session.begin_nested():
            obj = ObjectVersion.create(
                self.bucket,
                self.key,
                _file_id=self.file_id,
                version_id=version_id
            )
            self.delete()
        return obj
1242165
def merge_lists(src, new):
    """"""
    l_min, l_max = (src, new) if len(src) < len(new) else (new, src)

    l_min.extend(None for i in range(len(l_min), len(l_max)))

    for i, val in enumerate(new):
        if isinstance(val, dict) and isinstance(src[i], dict):
            new[i] = merge_dicts(src[i], val)
        elif isinstance(val, list) and isinstance(src[i], list):
            new[i] = merge_lists(src[i], val)
        elif val is not None:
            new[i] = val
        else:
            new[i] = src[i]

    return new
1368353
def merge_dicts(src, patch):
    """"""
    for key in patch:
        if key in src:
            if isinstance(src[key], dict) and isinstance(patch[key], dict):
                merge_dicts(src[key], patch[key])
            else:
                src[key] = merge_values(src[key], patch[key])
        else:
            src[key] = patch[key]

    return src
785461
def combine_dfs(dfs, names, method):
    """"""
    if method == "track":
        res = list()
        for df, identifier in zip(dfs, names):
            df["dataset"] = identifier
            res.append(df)
        return pd.concat(res, ignore_index=True)
    elif method == "simple":
        return pd.concat(dfs, ignore_index=True)
105619
def _bg_combine(self, bgs):
        """"""
        out = np.ones(self.h5["raw"].shape, dtype=float)
        # bg is an h5py.DataSet
        for bg in bgs:
            out *= bg[:]
        return out
777251
def _merge_logfiles(self):
        """"""
        # open files, read first lines, extract first dates
        lines = [next(iter(logfile), None) for logfile in self.args['logfile']]

        # adjust lines by timezone
        for i in range(len(lines)):
            if lines[i] and lines[i].datetime:
                lines[i]._datetime = (lines[i].datetime +
                                      timedelta(hours=self.args['timezone']
                                                [i]))

        while any(lines):
            min_line = min(lines, key=self._datetime_key_for_merge)
            min_idx = lines.index(min_line)

            if self.args['markers'][min_idx]:
                min_line.merge_marker_str = self.args['markers'][min_idx]

            yield min_line

            # update lines array with a new line from the min_idx'th logfile
            lines[min_idx] = next(iter(self.args['logfile'][min_idx]), None)
            if lines[min_idx] and lines[min_idx].datetime:
                lines[min_idx]._datetime = (
                    lines[min_idx].datetime +
                    timedelta(hours=self.args['timezone'][min_idx]))
1206298
def combine_comments(comments):
    '''
    
    '''
    if not isinstance(comments, list):
        comments = [comments]
    ret = []
    for comment in comments:
        if not isinstance(comment, six.string_types):
            comment = str(comment)
        # Normalize for any spaces (or lack thereof) after the #
        ret.append('# {0}\n'.format(comment.lstrip('#').lstrip()))
    return ''.join(ret)
231120
def merge_domaindata(self, docnames, otherdata):
        
        for fullname, (fn, objtype) in otherdata['objects'].items():
            if fn in docnames:
                self.data['objects'][fullname] = (fn, objtype)
        for modname, data in otherdata['modules'].items():
            if data[0] in docnames:
                self.data['modules'][modname] = data
        for labelname, data in otherdata['labels'].items():
            if data[0] in docnames:
                self.data['labels'][labelname] = data
        for anonlabelname, data in otherdata['anonlabels'].items():
            if data[0] in docnames:
                self.data['anonlabels'][anonlabelname] = data