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


Python AnnexRepo._init方法代碼示例

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


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

示例1: _handle_possible_annex_dataset

# 需要導入模塊: from datalad.support.annexrepo import AnnexRepo [as 別名]
# 或者: from datalad.support.annexrepo.AnnexRepo import _init [as 別名]
def _handle_possible_annex_dataset(dataset, reckless, description=None):
    """If dataset "knows annex" -- annex init it, set into reckless etc

    Provides additional tune up to a possibly an annex repo, e.g.
    "enables" reckless mode, sets up description
    """
    # in any case check whether we need to annex-init the installed thing:
    if not knows_annex(dataset.path):
        # not for us
        return

    # init annex when traces of a remote annex can be detected
    if reckless:
        lgr.debug(
            "Instruct annex to hardlink content in %s from local "
            "sources, if possible (reckless)", dataset.path)
        dataset.config.add(
            'annex.hardlink', 'true', where='local', reload=True)
    lgr.debug("Initializing annex repo at %s", dataset.path)
    # XXX this is rather convoluted, init does init, but cannot
    # set a description without `create=True`
    repo = AnnexRepo(dataset.path, init=True)
    # so do manually see #1403
    if description:
        repo._init(description=description)
    if reckless:
        repo._run_annex_command('untrust', annex_options=['here'])
    # go through list of special remotes and issue info message that
    # some additional ones are present and were not auto-enabled
    remote_names = repo.get_remotes(
        with_urls_only=False,
        exclude_special_remotes=False)
    for k, v in repo.get_special_remotes().items():
        sr_name = v.get('name', None)
        if sr_name and sr_name not in remote_names:
            # if it is not listed among the remotes, it wasn't enabled
            lgr.info(
                'access to dataset sibling "%s" not auto-enabled, enable with:\n\t\tdatalad siblings -d "%s" enable -s %s',
                sr_name,
                dataset.path,
                sr_name)
開發者ID:datalad,項目名稱:datalad,代碼行數:43,代碼來源:utils.py


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