• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utool.dict_take函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中utool.dict_take函数的典型用法代码示例。如果您正苦于以下问题:Python dict_take函数的具体用法?Python dict_take怎么用?Python dict_take使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了dict_take函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: score_chipmatch_csum

def score_chipmatch_csum(qaid, chipmatch, qreq_):
    """
    score_chipmatch_csum

    Args:
        chipmatch (tuple):

    Returns:
        tuple: aid_list, score_list

    Example:
        >>> # ENABLE_DOCTEST
        >>> from ibeis.model.hots.voting_rules2 import *  # NOQA
        >>> ibs, qreq_, qaid, chipmatch = get_chipmatch_testdata()
        >>> (aid_list, score_list) = score_chipmatch_csum(qaid, chipmatch, qreq_)
        >>> print(aid_list, score_list)
    """
    #(aid2_fm, aid2_fsv, aid2_fk, aid2_score, aid2_H) = chipmatch
    aid2_fsv = chipmatch.aid2_fsv
    if False:
        aid2_fs = {aid: fsv.prod(axis=1) for aid, fsv in six.iteritems(aid2_fsv)}
        aid_list = list(six.iterkeys(aid2_fs))
        fs_list = ut.dict_take(aid2_fs, aid_list)
        #fs_list  = list(six.itervalues(aid2_fs))
        score_list = [np.sum(fs) for fs in fs_list]
    else:
        aid_list = list(six.iterkeys(aid2_fsv))
        fsv_list = ut.dict_take(aid2_fsv, aid_list)
        fs_list = [fsv.prod(axis=1) for fsv in fsv_list]
        score_list = [np.sum(fs) for fs in fs_list]
    return (aid_list, score_list)
开发者ID:Erotemic,项目名称:ibeis,代码行数:31,代码来源:voting_rules2.py


示例2: from_cmtup_old

    def from_cmtup_old(cls, cmtup_old, qaid=None, fsv_col_lbls=None, daid_list=None):
        """ convert QueryResult styles fields to ChipMatch style fields """

        (aid2_fm_, aid2_fsv_, aid2_fk_, aid2_score_, aid2_H_) = cmtup_old
        assert len(aid2_fsv_) == len(aid2_fm_), "bad old cmtup_old"
        assert len(aid2_fk_) == len(aid2_fm_), "bad old cmtup_old"
        assert aid2_score_ is None or len(aid2_score_) == 0 or len(aid2_score_) == len(aid2_fm_), "bad old cmtup_old"
        assert aid2_H_ is None or len(aid2_H_) == len(aid2_fm_), "bad old cmtup_old"
        if daid_list is None:
            daid_list = list(six.iterkeys(aid2_fm_))

        # WARNING: dict_take will not copy these default items
        # Maybe these should be separate instances for different items?
        _empty_fm = np.empty((0, 2), dtype=hstypes.FM_DTYPE)
        _empty_fsv = np.empty((0, 1), dtype=hstypes.FS_DTYPE)
        _empty_fk = np.empty((0), dtype=hstypes.FK_DTYPE)
        # convert dicts to lists
        fm_list = ut.dict_take(aid2_fm_, daid_list, _empty_fm)
        fsv_list = ut.dict_take(aid2_fsv_, daid_list, _empty_fsv)
        fk_list = ut.dict_take(aid2_fk_, daid_list, _empty_fk)
        no_scores = aid2_score_ is None or (len(aid2_score_) == 0 and len(daid_list) > 0)
        score_list = None if no_scores else np.array(ut.dict_take(aid2_score_, daid_list, np.nan))
        H_list = None if aid2_H_ is None else ut.dict_take(aid2_H_, daid_list, None)
        fsv_col_lbls = fsv_col_lbls
        cm = cls(qaid, daid_list, fm_list, fsv_list, fk_list, score_list, H_list, fsv_col_lbls)
        return cm
开发者ID:Erotemic,项目名称:ibeis,代码行数:26,代码来源:old_chip_match.py


示例3: show_normalizers

    def show_normalizers(match, fnum=None, pnum=None, update=True):
        import plottool as pt
        from plottool import plot_helpers as ph

        # hack keys out of namespace
        keys = ["rchip", "kpts"]
        rchip1, kpts1 = ut.dict_take(match.annot1.__dict__, keys)
        rchip2, kpts2 = ut.dict_take(match.annot2.__dict__, keys)
        fs, fm = match.fs, match.fm_norm
        cmap = "cool"
        draw_lines = True
        if fnum is None:
            fnum = pt.next_fnum()
        pt.figure(fnum=fnum, pnum=pnum)
        # doclf=True, docla=True)
        ax, xywh1, xywh2 = pt.show_chipmatch2(
            rchip1, rchip2, kpts1, kpts2, fm=fm, fs=fs, fnum=fnum, cmap=cmap, draw_lines=draw_lines
        )
        ph.set_plotdat(ax, "viztype", "matches")
        ph.set_plotdat(ax, "key", match.key)
        title = match.key + "\n num=%d, sum=%.2f" % (len(fm), sum(fs))
        pt.set_title(title)
        if update:
            pt.update()
        return ax, xywh1, xywh2
开发者ID:Erotemic,项目名称:vtool,代码行数:25,代码来源:constrained_matching.py


示例4: baseline_match

 def baseline_match(annot, annot2):
     cfgdict = {}
     annot1 = annot
     keys = ["kpts", "vecs"]
     kpts1, vecs1 = ut.dict_take(annot1.__dict__, keys)
     kpts2, vecs2 = ut.dict_take(annot2.__dict__, keys)
     dlen_sqrd2 = annot2.dlen_sqrd
     basetup, base_meta = baseline_vsone_ratio_matcher_(kpts1, vecs1, kpts2, vecs2, dlen_sqrd2, cfgdict)
     (fm_ORIG, fs_ORIG, fm_RAT, fs_RAT, fm_SV, fs_SV, H_RAT) = basetup
     (fm_norm_RAT, fm_norm_SV) = base_meta
     match_ORIG = AnnotMatch(annot1, annot2, fm_ORIG, fs_ORIG, "ORIG")  # NOQA
     match_RAT = AnnotMatch(annot1, annot2, fm_RAT, fs_RAT, "RAT", fm_norm_RAT)  # NOQA
     match_SV = AnnotMatch(annot1, annot2, fm_SV, fs_SV, "SV", fm_norm_SV)
     match_SV.H = H_RAT
     return match_ORIG, match_RAT, match_SV
开发者ID:Erotemic,项目名称:vtool,代码行数:15,代码来源:constrained_matching.py


示例5: make_match_interaction

def make_match_interaction(matches, metadata, type_='RAT+SV', **kwargs):
    import plottool.interact_matches
    #import plottool as pt
    fm, fs = matches[type_][0:2]
    H1 = metadata['H_' + type_.split('+')[0]]
    #fm, fs = matches['RAT'][0:2]
    annot1 = metadata['annot1']
    annot2 = metadata['annot2']
    rchip1, kpts1, vecs1 = ut.dict_take(annot1, ['rchip', 'kpts', 'vecs'])
    rchip2, kpts2, vecs2 = ut.dict_take(annot2, ['rchip', 'kpts', 'vecs'])
    #pt.show_chipmatch2(rchip1, rchip2, kpts1, kpts2, fm=fm, fs=fs)
    fsv = fs[:, None]
    interact = plottool.interact_matches.MatchInteraction2(
        rchip1, rchip2, kpts1, kpts2, fm, fs, fsv, vecs1, vecs2, H1=H1,
        **kwargs)
    return interact
开发者ID:Erotemic,项目名称:vtool,代码行数:16,代码来源:matching.py


示例6: metric

 def metric(aidx1, aidx2, hidden_nids=hidden_nids, toy_params=toy_params):
     if aidx1 == aidx2:
         return 0
     rng = np.random.RandomState(int(aidx1 + aidx2))
     same = hidden_nids[int(aidx1)] == hidden_nids[int(aidx2)]
     mu, sigma = ut.dict_take(toy_params[same], ['mu', 'sigma'])
     return np.clip(rng.normal(mu, sigma), 0, np.inf)
开发者ID:Erotemic,项目名称:ibeis,代码行数:7,代码来源:crf.py


示例7: testdata_pre_baselinefilter

def testdata_pre_baselinefilter(defaultdb='testdb1', qaid_list=None, daid_list=None, codename='vsmany'):
    cfgdict = dict(codename=codename)
    ibs, qreq_ = get_pipeline_testdata(
        qaid_list=qaid_list, daid_list=daid_list, defaultdb=defaultdb, cfgdict=cfgdict)
    locals_ = testrun_pipeline_upto(qreq_, 'baseline_neighbor_filter')
    nns_list, impossible_daids_list = ut.dict_take(locals_, ['nns_list', 'impossible_daids_list'])
    return qreq_, nns_list, impossible_daids_list
开发者ID:heroinlin,项目名称:ibeis,代码行数:7,代码来源:_pipeline_helpers.py


示例8: show_single_coverage_mask

def show_single_coverage_mask(qreq_, cm, weight_mask_m, weight_mask, daids, fnum=None):
    import plottool as pt
    from ibeis import viz
    fnum = pt.ensure_fnum(fnum)
    idx_list = ut.dict_take(cm.daid2_idx, daids)
    nPlots = len(idx_list) + 1
    nRows, nCols = pt.get_square_row_cols(nPlots)
    pnum_ = pt.make_pnum_nextgen(nRows, nCols)
    pt.figure(fnum=fnum, pnum=(1, 2, 1))
    # Draw coverage masks with bbox
    # <FlipHack>
    #weight_mask_m = np.fliplr(np.flipud(weight_mask_m))
    #weight_mask = np.fliplr(np.flipud(weight_mask))
    # </FlipHack>
    stacked_weights, offset_tup, sf_tup = vt.stack_images(weight_mask_m, weight_mask, return_sf=True)
    (woff, hoff) = offset_tup[1]
    wh1 = weight_mask_m.shape[0:2][::-1]
    wh2 = weight_mask.shape[0:2][::-1]
    pt.imshow(255 * (stacked_weights), fnum=fnum, pnum=pnum_(0), title='(query image) What did match vs what should match')
    pt.draw_bbox((   0,    0) + wh1, bbox_color=(0, 0, 1))
    pt.draw_bbox((woff, hoff) + wh2, bbox_color=(0, 0, 1))
    # Get contributing matches
    qaid = cm.qaid
    daid_list = daids
    fm_list = ut.take(cm.fm_list, idx_list)
    fs_list = ut.take(cm.fs_list, idx_list)
    # Draw matches
    for px, (daid, fm, fs) in enumerate(zip(daid_list, fm_list, fs_list), start=1):
        viz.viz_matches.show_matches2(qreq_.ibs, qaid, daid, fm, fs,
                                      draw_pts=False, draw_lines=True,
                                      draw_ell=False, fnum=fnum, pnum=pnum_(px),
                                      darken=.5)
    coverage_score = score_matching_mask(weight_mask_m, weight_mask)
    pt.set_figtitle('score=%.4f' % (coverage_score,))
开发者ID:Erotemic,项目名称:ibeis,代码行数:34,代码来源:scoring.py


示例9: extract_connected_compoments

 def extract_connected_compoments(graph):
     import scipy.sparse as spsparse
     import utool as ut
     # I think this is how extraction is done?
     # only returns edge info
     # so singletons are not represented
     shape = graph.shape
     csr_graph = graph.tocsr()
     num_components, labels = spsparse.csgraph.connected_components(csr_graph)
     unique_labels = np.unique(labels)
     group_flags_list = [labels == groupid for groupid in unique_labels]
     subgraph_list = []
     for label, group_flags in zip(unique_labels, group_flags_list):
         num_members = group_flags.sum()
         ixs = list(range(num_members))
         if num_members == 0:
             continue
         group_rowix, group_cols = csr_graph[group_flags, :].nonzero()
         if len(group_cols) == 0:
             continue
         ix2_row = dict(zip(ixs, np.nonzero(group_flags)[0]))
         group_rows = ut.dict_take(ix2_row, group_rowix)
         component = (group_rows, group_cols.tolist())
         data = csr_graph[component].tolist()[0]
         subgraph = spsparse.coo_matrix((data, component), shape=shape)
         subgraph_list.append(subgraph)
     #assert len(compoment_list) == num_components, 'bad impl'
     return subgraph_list
开发者ID:heroinlin,项目名称:ibeis,代码行数:28,代码来源:viz_graph.py


示例10: annot_to_class_feats2

 def annot_to_class_feats2(aid, aid2_nid, top=None):
     pair_list = []
     score_list = []
     nexemplar_list = []
     for nid in unique_nids:
         label = (aid2_nid[aid] == nid)
         num_exemplars = nid2_nexemp.get(nid, 0)
         if num_exemplars == 0:
             continue
         params = toy_params[label]
         mu, sigma = ut.dict_take(params, ['mu', 'sigma'])
         score_ = rng.normal(mu, sigma, size=num_exemplars).max()
         score = np.clip(score_, 0, np.inf)
         pair_list.append((aid, nid))
         score_list.append(score)
         nexemplar_list.append(num_exemplars)
     rank_list = ut.argsort(score_list, reverse=True)
     feat_list = np.array([score_list, rank_list, nexemplar_list]).T
     sortx = np.argsort(rank_list)
     feat_list = feat_list.take(sortx, axis=0)
     pair_list = np.array(pair_list).take(sortx, axis=0)
     if top is not None:
         feat_list = feat_list[:top]
         pair_list = pair_list[0:top]
     return pair_list, feat_list
开发者ID:heroinlin,项目名称:ibeis,代码行数:25,代码来源:demobayes.py


示例11: on_click_inside

        def on_click_inside(self, event, ax):
            self.ax = ax
            self.event = event
            event = self.event
            #print(ax)
            #print(event.x)
            #print(event.y)
            aids = list(self.pos.keys())
            pos_list = ut.dict_take(self.pos, aids)
            #x = 10
            #y = 10
            import numpy as np  # NOQA
            x, y = event.xdata, event.ydata
            point = np.array([x, y])
            pos_list = np.array(pos_list)
            index, dist = vt.closest_point(point, pos_list, distfunc=vt.L2)
            print('dist = %r' % (dist,))

            aid = aids[index]
            context_shown = False

            CHECK_PAIR = True
            if CHECK_PAIR:
                if self.event.button == 3 and not context_shown:
                    if len(self.selected_aids) != 2:
                        print('This funciton only work if exactly 2 are selected')
                    else:
                        from ibeis.gui import inspect_gui
                        context_shown = True
                        aid1, aid2 = (self.selected_aids)
                        qres = None
                        qreq_ = None
                        options = inspect_gui.get_aidpair_context_menu_options(ibs, aid1, aid2, qres, qreq_=qreq_)
                        self.show_popup_menu(options, event)

            SELECT_ANNOT = dist < 35
            if SELECT_ANNOT:
                print(ut.obj_str(ibs.get_annot_info(aid, default=True, name=False, gname=False)))

                if self.event.button == 1:
                    self.toggle_selected_aid(aid)

                if self.event.button == 3 and not context_shown:
                    # right click
                    from ibeis.viz.interact import interact_chip
                    context_shown = True
                    #refresh_func = functools.partial(viz.show_name, ibs, nid, fnum=fnum, sel_aids=sel_aids)
                    refresh_func = None
                    config2_ = None
                    options = interact_chip.build_annot_context_options(
                        ibs, aid, refresh_func=refresh_func,
                        with_interact_name=False,
                        config2_=config2_)
                    self.show_popup_menu(options, event)
            else:
                if self.event.button == 3:
                    options = [
                        ('Toggle images', self.toggle_images),
                    ]
                    self.show_popup_menu(options, event)
开发者ID:heroinlin,项目名称:ibeis,代码行数:60,代码来源:viz_graph.py


示例12: compute_fgweight_mask

 def compute_fgweight_mask(annot):
     keys = ["kpts", "chipshape", "fgweights"]
     kpts, chipshape, fgweights = ut.dict_take(annot.__dict__, keys)
     chipsize = chipshape[0:2][::-1]
     fgweight_mask = coverage_kpts.make_kpts_coverage_mask(
         kpts, chipsize, fgweights, mode="max", resize=True, return_patch=False
     )
     annot.fgweight_mask = fgweight_mask
开发者ID:Erotemic,项目名称:vtool,代码行数:8,代码来源:constrained_matching.py


示例13: compute_dstncvs_mask

 def compute_dstncvs_mask(annot):
     keys = ["kpts", "chipshape", "dstncvs"]
     kpts, chipshape, dstncvs = ut.dict_take(annot.__dict__, keys)
     chipsize = chipshape[0:2][::-1]
     dstncvs_mask = coverage_kpts.make_kpts_coverage_mask(
         kpts, chipsize, dstncvs, mode="max", resize=True, return_patch=False
     )
     annot.dstncvs_mask = dstncvs_mask
开发者ID:Erotemic,项目名称:vtool,代码行数:8,代码来源:constrained_matching.py


示例14: testdata_pre_baselinefilter

def testdata_pre_baselinefilter(defaultdb='testdb1', qaid_list=None, daid_list=None, codename='vsmany'):
    cfgdict = dict(codename=codename)
    import ibeis
    p = 'default' + ut.get_cfg_lbl(cfgdict)
    qreq_ = ibeis.testdata_qreq_(defaultdb=defaultdb, default_qaids=qaid_list, default_daids=daid_list, p=p)
    locals_ = testrun_pipeline_upto(qreq_, 'baseline_neighbor_filter')
    nns_list, impossible_daids_list = ut.dict_take(locals_, ['nns_list', 'impossible_daids_list'])
    return qreq_, nns_list, impossible_daids_list
开发者ID:Erotemic,项目名称:ibeis,代码行数:8,代码来源:_pipeline_helpers.py


示例15: get_annotmatch_rowids_from_aid2

def get_annotmatch_rowids_from_aid2(ibs, aid2_list, eager=True, nInput=None,
                                    force_method=None):
    """
    # This one is slow because aid2 is the second part of the index

    TODO autogenerate

    Returns a list of the aids that were reviewed as candidate matches to the input aid

    aid_list = ibs.get_valid_aids()

    CommandLine:
        python -m ibeis.annotmatch_funcs --exec-get_annotmatch_rowids_from_aid2 --show

    Example2:
        >>> # TIME TEST
        >>> # setup_pzmtest_subgraph()
        >>> from ibeis.annotmatch_funcs import *  # NOQA
        >>> import ibeis
        >>> ibs = ibeis.opendb(defaultdb='PZ_Master1')
        >>> aid2_list = ibs.get_valid_aids()
        >>> func_list = [
        >>>     partial(ibs.get_annotmatch_rowids_from_aid2, force_method=1),
        >>>     partial(ibs.get_annotmatch_rowids_from_aid2, force_method=2),
        >>> ]
        >>> num_list = [1, 10, 50, 100, 300, 325, 350, 400, 500]
        >>> def args_list(count, aid2_list=aid2_list, num_list=num_list):
        >>>    return (aid2_list[0:num_list[count]],)
        >>> searchkw = dict(
        >>>     func_labels=['sql', 'numpy'],
        >>>     count_to_xtick=lambda count, args: len(args[0]),
        >>>     title='Timings of get_annotmatch_rowids_from_aid2',
        >>> )
        >>> niters = len(num_list)
        >>> time_result = ut.gridsearch_timer(func_list, args_list, niters, **searchkw)
        >>> time_result['plot_timings']()
        >>> ut.show_if_requested()
    """
    from ibeis.control import _autogen_annotmatch_funcs
    if force_method != 2 and (nInput < 128 or (force_method == 1)):
        colnames = (_autogen_annotmatch_funcs.ANNOTMATCH_ROWID,)
        # FIXME: col_rowid is not correct
        params_iter = zip(aid2_list)
        andwhere_colnames = [_autogen_annotmatch_funcs.ANNOT_ROWID2]
        annotmatch_rowid_list = ibs.db.get_where2(
            ibs.const.ANNOTMATCH_TABLE, colnames, params_iter, andwhere_colnames,
            eager=eager, nInput=nInput, unpack_scalars=False)
    elif force_method == 2:
        import vtool as vt
        all_annotmatch_rowids = np.array(ibs._get_all_annotmatch_rowids())
        aids2 = np.array(ibs.get_annotmatch_aid2(all_annotmatch_rowids))
        unique_aid2, groupxs2 = vt.group_indices(aids2)
        rowids2_ = vt.apply_grouping(all_annotmatch_rowids, groupxs2)
        rowids2_ = [_.tolist() for _ in rowids2_]
        maping2 = ut.defaultdict(list, zip(unique_aid2, rowids2_))
        annotmatch_rowid_list = ut.dict_take(maping2, aid2_list)
    annotmatch_rowid_list = list(map(sorted, annotmatch_rowid_list))
    return annotmatch_rowid_list
开发者ID:heroinlin,项目名称:ibeis,代码行数:58,代码来源:annotmatch_funcs.py


示例16: constrained_match

 def constrained_match(annot, match_SV):
     cfgdict = {}
     annot1 = match_SV.annot1
     assert annot1 is annot
     annot2 = match_SV.annot2
     keys = ["kpts", "vecs"]
     kpts1, vecs1 = ut.dict_take(annot1.__dict__, keys)
     kpts2, vecs2 = ut.dict_take(annot2.__dict__, keys)
     dlen_sqrd2 = annot2.dlen_sqrd
     H_RAT = match_SV.H
     nexttup, next_meta = spatially_constrianed_matcher_(kpts1, vecs1, kpts2, vecs2, dlen_sqrd2, H_RAT, cfgdict)
     (fm_SC, fs_SC, fm_SCR, fs_SCR, fm_SCRSV, fs_SCRSV, H_SCR) = nexttup
     (fm_norm_SC, fm_norm_SCR, fm_norm_SCRSV) = next_meta
     match_SC = AnnotMatch(annot1, annot2, fm_SC, fs_SC, "SC", fm_norm_SC)  # NOQA
     match_SCR = AnnotMatch(annot1, annot2, fm_SCR, fs_SCR, "SCR", fm_norm_SCR)  # NOQA
     match_SCRSV = AnnotMatch(annot1, annot2, fm_SCRSV, fs_SCRSV, "SCRSV", fm_norm_SCRSV)
     match_SCRSV.H = H_SCR
     return match_SC, match_SCR, match_SCRSV
开发者ID:Erotemic,项目名称:vtool,代码行数:18,代码来源:constrained_matching.py


示例17: set_name_sex_text

def set_name_sex_text(ibs, name_rowid_list, name_sex_text_list):
    r"""

    RESTful:
        Method: PUT
        URL:    /api/name/sex_text/
    """
    name_sex_list = ut.dict_take(const.SEX_TEXT_TO_INT, name_sex_text_list)
    return ibs.set_name_sex(name_rowid_list, name_sex_list)
开发者ID:Erotemic,项目名称:ibeis,代码行数:9,代码来源:manual_name_funcs.py


示例18: testdata_pre_weight_neighbors

def testdata_pre_weight_neighbors(defaultdb='testdb1', qaid_list=[1, 2], daid_list=None, codename='vsmany', cfgdict=None):
    if cfgdict is None:
        cfgdict = dict(codename=codename)
    ibs, qreq_ = get_pipeline_testdata(
        qaid_list=qaid_list, daid_list=daid_list, defaultdb=defaultdb, cfgdict=cfgdict)
    locals_ = testrun_pipeline_upto(qreq_, 'weight_neighbors')
    nns_list, nnvalid0_list = ut.dict_take(locals_, ['nns_list', 'nnvalid0_list'])

    # qreq_, args = testdata_pre('weight_neighbors', defaultdb=defaultdb, p=['default:bar_l2_on=True,fg_on=False'])
    return ibs, qreq_, nns_list, nnvalid0_list
开发者ID:heroinlin,项目名称:ibeis,代码行数:10,代码来源:_pipeline_helpers.py


示例19: get_name_sex_text

def get_name_sex_text(ibs, name_rowid_list, eager=True, nInput=None):
    r"""

    RESTful:
        Method: GET
        URL:    /api/name/sex_text/
    """
    name_sex_list = ibs.get_name_sex(name_rowid_list, eager=eager, nInput=nInput)
    name_sex_text_list = ut.dict_take(const.SEX_INT_TO_TEXT, name_sex_list)
    return name_sex_text_list
开发者ID:Erotemic,项目名称:ibeis,代码行数:10,代码来源:manual_name_funcs.py


示例20: config_graph_subattrs

def config_graph_subattrs(cfg, depc):
    # TODO: if this hack is fully completed need a way of getting the
    # full config belonging to both chip + feat
    # cfg = request.config.feat_cfg
    import networkx as netx
    tablename = ut.invert_dict(depc.configclass_dict)[cfg.__class__]
    #tablename = cfg.get_config_name()
    ancestors = netx.dag.ancestors(depc.graph, tablename)
    subconfigs_ = ut.dict_take(depc.configclass_dict, ancestors, None)
    subconfigs = ut.filter_Nones(subconfigs_)  # NOQA
开发者ID:Erotemic,项目名称:dtool,代码行数:10,代码来源:base.py



注:本文中的utool.dict_take函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utool.ensuredir函数代码示例发布时间:2022-05-26
下一篇:
Python utool.dict_str函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap