當前位置: 首頁>>代碼示例>>Python>>正文


Python AnnexRepo.remove_remote方法代碼示例

本文整理匯總了Python中datalad.support.annexrepo.AnnexRepo.remove_remote方法的典型用法代碼示例。如果您正苦於以下問題:Python AnnexRepo.remove_remote方法的具體用法?Python AnnexRepo.remove_remote怎麽用?Python AnnexRepo.remove_remote使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在datalad.support.annexrepo.AnnexRepo的用法示例。


在下文中一共展示了AnnexRepo.remove_remote方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: len

# 需要導入模塊: from datalad.support.annexrepo import AnnexRepo [as 別名]
# 或者: from datalad.support.annexrepo.AnnexRepo import remove_remote [as 別名]
        annex._annex_custom_command([], ["git", "annex", "enableremote", "datalad"])
        # go through each and see where urls aren't yet under web
        # seems might have also --in=datalad to restrict
        w = annex.whereis([], options=['--all'], output='full')
        lgr.info("Got %d entries", len(w))
        for k, rec in tqdm(w.items()):
            datalad_urls = get_remote_urls(rec, 'datalad')
            web_urls = set(get_remote_urls(rec, 'web'))
            for url in datalad_urls:
                if url not in web_urls:
                    if 'openneuro.s3' in url or 'openfmri.s3' in url:
                        urls_to_register[k].append(url)
                    else:
                        lgr.warning("Found unexpected url %s" % url)

    finally:
        # disable datalad special remote
        annex.remove_remote("datalad") # need to disable it first
    lgr.info(
        "Got %d entries which could get new urls",
        len(urls_to_register)
    )
    for k, urls in tqdm(urls_to_register.items()):
        for url in urls:
            annex._annex_custom_command(
                [],
                ["git", "annex", "registerurl", '-c', 'annex.alwayscommit=false', k, url]
            )
    # to cause annex to commit all the changes
    annex._annex_custom_command([], ["git", "annex", "merge"])
    annex.gc(allow_background=False)
開發者ID:datalad,項目名稱:datalad,代碼行數:33,代碼來源:copy_urls_from_datalad.py


注:本文中的datalad.support.annexrepo.AnnexRepo.remove_remote方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。