本文整理匯總了Python中datalad.support.annexrepo.AnnexRepo.annex_add方法的典型用法代碼示例。如果您正苦於以下問題:Python AnnexRepo.annex_add方法的具體用法?Python AnnexRepo.annex_add怎麽用?Python AnnexRepo.annex_add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類datalad.support.annexrepo.AnnexRepo
的用法示例。
在下文中一共展示了AnnexRepo.annex_add方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_AnnexRepo_annex_add
# 需要導入模塊: from datalad.support.annexrepo import AnnexRepo [as 別名]
# 或者: from datalad.support.annexrepo.AnnexRepo import annex_add [as 別名]
def test_AnnexRepo_annex_add(src, annex_path):
ar = AnnexRepo(annex_path, src)
filename = 'file_to_annex.dat'
filename_abs = os.path.join(annex_path, filename)
f = open(filename_abs, 'w')
f.write("What to write?")
f.close()
ar.annex_add(filename)
if not ar.is_direct_mode():
assert_true(os.path.islink(filename_abs), "Annexed file is not a link.")
else:
assert_false(os.path.islink(filename_abs), "Annexed file is link in direct mode.")
key = ar.get_file_key(filename)
assert_false(key == '')