Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

simplified_api.py 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. from .constraints import (
  2. EnsureDatasetSiblingName,
  3. EnsureExistingDirectory,
  4. )
  5. # each item is a command that is allowed in the API
  6. # the key is the command name in the Python API.
  7. # the values are dicts with the following keys
  8. # - exclude_parameters: set with parameter names to
  9. # exclude from the API
  10. api = dict(
  11. clone=dict(
  12. name='&Clone a dataset',
  13. exclude_parameters=set((
  14. 'git_clone_opts',
  15. 'reckless',
  16. 'description',
  17. )),
  18. parameter_display_names=dict(
  19. source='Clone from',
  20. path='Clone into',
  21. dataset='Register in superdataset',
  22. ),
  23. parameter_order=dict(
  24. source=0,
  25. path=1,
  26. dataset=2,
  27. ),
  28. parameter_constraints=dict(
  29. path=EnsureExistingDirectory(),
  30. ),
  31. ),
  32. create=dict(
  33. name='C&reate a dataset',
  34. exclude_parameters=set((
  35. 'initopts',
  36. 'description',
  37. 'fake_dates',
  38. )),
  39. parameter_display_names=dict(
  40. force='OK if target directory not empty',
  41. path='Create at',
  42. dataset='Register in superdataset',
  43. ),
  44. parameter_order=dict(
  45. path=0,
  46. annex=1,
  47. dataset=2,
  48. ),
  49. parameter_constraints=dict(
  50. path=EnsureExistingDirectory(),
  51. ),
  52. ),
  53. create_sibling_gitlab=dict(
  54. name='Create a Git&Lab sibling',
  55. exclude_parameters=set((
  56. 'dryrun',
  57. )),
  58. ),
  59. create_sibling_gin=dict(
  60. name='Create a GI&N sibling',
  61. ),
  62. create_sibling_github=dict(
  63. name='Create a Git&Hub sibling',
  64. exclude_parameters=set((
  65. 'dryrun',
  66. )),
  67. ),
  68. create_sibling_webdav=dict(
  69. name='Create a &WebDAV sibling',
  70. ),
  71. drop=dict(
  72. name='Dr&op content',
  73. exclude_parameters=set((
  74. 'check',
  75. 'if_dirty',
  76. 'reckless',
  77. )),
  78. parameter_order=dict(
  79. dataset=0,
  80. what=1,
  81. path=2,
  82. recursive=3,
  83. ),
  84. ),
  85. get=dict(
  86. name='&Get content',
  87. exclude_parameters=set((
  88. 'description',
  89. 'reckless',
  90. 'source',
  91. )),
  92. parameter_display_names=dict(
  93. path='Only get',
  94. # 'all' because we have no recursion_limit enabled
  95. recursive='Also get all subdatasets',
  96. get_data='Get file content',
  97. ),
  98. parameter_order=dict(
  99. dataset=0,
  100. get_data=1,
  101. path=2,
  102. recursive=3,
  103. ),
  104. ),
  105. push=dict(
  106. name='&Push data/updates to a sibling',
  107. exclude_parameters=set((
  108. 'since',
  109. )),
  110. parameter_constraints=dict(
  111. to=EnsureDatasetSiblingName(),
  112. ),
  113. ),
  114. save=dict(
  115. name='&Save the state in a dataset',
  116. exclude_parameters=set((
  117. 'updated',
  118. 'message_file',
  119. )),
  120. parameter_display_names=dict(
  121. dataset='Save changes in dataset at',
  122. message='Description of change',
  123. path='Only save',
  124. recursive='Include changes in subdatasets',
  125. to_git='Do not put files in annex',
  126. version_tag='Tag for saved dataset state',
  127. amend='Amend last saved state',
  128. ),
  129. parameter_order=dict(
  130. dataset=0,
  131. message=1,
  132. path=2,
  133. recursive=3,
  134. to_git=4,
  135. version_tag=5,
  136. amend=6,
  137. ),
  138. ),
  139. update=dict(
  140. name='&Update from a sibling',
  141. exclude_parameters=set((
  142. 'merge',
  143. 'fetch_all',
  144. 'how_subds',
  145. 'follow',
  146. 'reobtain_data',
  147. )),
  148. parameter_constraints=dict(
  149. sibling=EnsureDatasetSiblingName(),
  150. ),
  151. ),
  152. )
  153. exclude_parameters = set((
  154. 'result_renderer',
  155. 'return_type',
  156. 'result_filter',
  157. 'result_xfm',
  158. 'on_failure',
  159. 'jobs',
  160. 'recursion_limit',
  161. ))
  162. parameter_display_names = dict(
  163. annex='Dataset with file annex',
  164. cfg_proc='Configuration procedure(s)',
  165. dataset='Dataset location',
  166. )
  167. dataset_api = {
  168. c: s for c, s in api.items()
  169. if c in (
  170. 'clone', 'create',
  171. 'create_sibling_gitlab', 'create_sibling_gin',
  172. 'create_sibling_github', 'create_sibling_webdav',
  173. 'drop', 'get', 'push', 'save', 'update'
  174. )
  175. }
  176. directory_api = {
  177. c: s for c, s in api.items() if c in ('clone', 'create')
  178. }
  179. directory_in_ds_api = {
  180. c: s for c, s in api.items()
  181. if c in ('clone', 'create', 'drop', 'get', 'push', 'save')
  182. }
  183. file_api = None
  184. file_in_ds_api = {
  185. c: s for c, s in api.items() if c in ('save')
  186. }
  187. annexed_file_api = {
  188. c: s for c, s in api.items()
  189. if c in ('drop', 'get', 'push', 'save')
  190. }
  191. # simplified API has no groups
  192. api_group_order = {}