123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- from .constraints import (
- EnsureDatasetSiblingName,
- EnsureExistingDirectory,
- )
- # each item is a command that is allowed in the API
- # the key is the command name in the Python API.
- # the values are dicts with the following keys
- # - exclude_parameters: set with parameter names to
- # exclude from the API
- api = dict(
- clone=dict(
- name='&Clone a dataset',
- exclude_parameters=set((
- 'git_clone_opts',
- 'reckless',
- 'description',
- )),
- parameter_display_names=dict(
- source='Clone from',
- path='Clone into',
- dataset='Register in superdataset',
- ),
- parameter_order=dict(
- source=0,
- path=1,
- dataset=2,
- ),
- parameter_constraints=dict(
- path=EnsureExistingDirectory(),
- ),
- ),
- create=dict(
- name='C&reate a dataset',
- exclude_parameters=set((
- 'initopts',
- 'description',
- 'fake_dates',
- )),
- parameter_display_names=dict(
- force='OK if target directory not empty',
- path='Create at',
- dataset='Register in superdataset',
- ),
- parameter_order=dict(
- path=0,
- annex=1,
- dataset=2,
- ),
- parameter_constraints=dict(
- path=EnsureExistingDirectory(),
- ),
- ),
- create_sibling_gitlab=dict(
- name='Create a Git&Lab sibling',
- exclude_parameters=set((
- 'dryrun',
- )),
- ),
- create_sibling_gin=dict(
- name='Create a GI&N sibling',
- ),
- create_sibling_github=dict(
- name='Create a Git&Hub sibling',
- exclude_parameters=set((
- 'dryrun',
- )),
- ),
- create_sibling_webdav=dict(
- name='Create a &WebDAV sibling',
- ),
- drop=dict(
- name='Dr&op content',
- exclude_parameters=set((
- 'check',
- 'if_dirty',
- 'reckless',
- )),
- parameter_order=dict(
- dataset=0,
- what=1,
- path=2,
- recursive=3,
- ),
- ),
- get=dict(
- name='&Get content',
- exclude_parameters=set((
- 'description',
- 'reckless',
- 'source',
- )),
- parameter_display_names=dict(
- path='Only get',
- # 'all' because we have no recursion_limit enabled
- recursive='Also get all subdatasets',
- get_data='Get file content',
- ),
- parameter_order=dict(
- dataset=0,
- get_data=1,
- path=2,
- recursive=3,
- ),
- ),
- push=dict(
- name='&Push data/updates to a sibling',
- exclude_parameters=set((
- 'since',
- )),
- parameter_constraints=dict(
- to=EnsureDatasetSiblingName(),
- ),
- ),
- save=dict(
- name='&Save the state in a dataset',
- exclude_parameters=set((
- 'updated',
- 'message_file',
- )),
- parameter_display_names=dict(
- dataset='Save changes in dataset at',
- message='Description of change',
- path='Only save',
- recursive='Include changes in subdatasets',
- to_git='Do not put files in annex',
- version_tag='Tag for saved dataset state',
- amend='Amend last saved state',
- ),
- parameter_order=dict(
- dataset=0,
- message=1,
- path=2,
- recursive=3,
- to_git=4,
- version_tag=5,
- amend=6,
- ),
- ),
- update=dict(
- name='&Update from a sibling',
- exclude_parameters=set((
- 'merge',
- 'fetch_all',
- 'how_subds',
- 'follow',
- 'reobtain_data',
- )),
- parameter_constraints=dict(
- sibling=EnsureDatasetSiblingName(),
- ),
- ),
- )
- exclude_parameters = set((
- 'result_renderer',
- 'return_type',
- 'result_filter',
- 'result_xfm',
- 'on_failure',
- 'jobs',
- 'recursion_limit',
- ))
- parameter_display_names = dict(
- annex='Dataset with file annex',
- cfg_proc='Configuration procedure(s)',
- dataset='Dataset location',
- )
- dataset_api = {
- c: s for c, s in api.items()
- if c in (
- 'clone', 'create',
- 'create_sibling_gitlab', 'create_sibling_gin',
- 'create_sibling_github', 'create_sibling_webdav',
- 'drop', 'get', 'push', 'save', 'update'
- )
- }
- directory_api = {
- c: s for c, s in api.items() if c in ('clone', 'create')
- }
- directory_in_ds_api = {
- c: s for c, s in api.items()
- if c in ('clone', 'create', 'drop', 'get', 'push', 'save')
- }
- file_api = None
- file_in_ds_api = {
- c: s for c, s in api.items() if c in ('save')
- }
- annexed_file_api = {
- c: s for c, s in api.items()
- if c in ('drop', 'get', 'push', 'save')
- }
- # simplified API has no groups
- api_group_order = {}
|