本文整理汇总了Python中datalad.distribution.dataset.Dataset.clean方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.clean方法的具体用法?Python Dataset.clean怎么用?Python Dataset.clean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datalad.distribution.dataset.Dataset
的用法示例。
在下文中一共展示了Dataset.clean方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_basics
# 需要导入模块: from datalad.distribution.dataset import Dataset [as 别名]
# 或者: from datalad.distribution.dataset.Dataset import clean [as 别名]
def test_basics(path, super_path):
ds = Dataset(path).create(force=True)
ds.run_procedure('setup_yoda_dataset')
ok_clean_git(ds.path)
assert_false(ds.repo.is_under_annex("README.md"))
# configure dataset to look for procedures in its code folder
ds.config.add(
'datalad.locations.dataset-procedures',
'code',
where='dataset')
# commit this procedure config for later use in a clone:
ds.add(op.join('.datalad', 'config'))
# configure dataset to run the demo procedure prior to the clean command
ds.config.add(
'datalad.clean.proc-pre',
'datalad_test_proc',
where='dataset')
# run command that should trigger the demo procedure
ds.clean()
# look for traces
ok_file_has_content(op.join(ds.path, 'fromproc.txt'), 'hello\n')
ok_clean_git(ds.path, index_modified=[op.join('.datalad', 'config')])
# make a fresh dataset:
super = Dataset(super_path).create()
# configure dataset to run the demo procedure prior to the clean command
super.config.add(
'datalad.clean.proc-pre',
'datalad_test_proc',
where='dataset')
# 'super' doesn't know any procedures but should get to know one by
# installing the above as a subdataset
super.install('sub', source=ds.path)
# run command that should trigger the demo procedure
super.clean()
# look for traces
ok_file_has_content(op.join(super.path, 'fromproc.txt'), 'hello\n')
ok_clean_git(super.path, index_modified=[op.join('.datalad', 'config')])