本文整理汇总了Python中datalad.support.annexrepo.AnnexRepo.get_special_remotes方法的典型用法代码示例。如果您正苦于以下问题:Python AnnexRepo.get_special_remotes方法的具体用法?Python AnnexRepo.get_special_remotes怎么用?Python AnnexRepo.get_special_remotes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datalad.support.annexrepo.AnnexRepo
的用法示例。
在下文中一共展示了AnnexRepo.get_special_remotes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _handle_possible_annex_dataset
# 需要导入模块: from datalad.support.annexrepo import AnnexRepo [as 别名]
# 或者: from datalad.support.annexrepo.AnnexRepo import get_special_remotes [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)