deriva 1.7.6__tar.gz → 1.7.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. {deriva-1.7.6/deriva.egg-info → deriva-1.7.8}/PKG-INFO +1 -2
  2. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/__init__.py +1 -1
  3. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/base_cli.py +5 -0
  4. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/hatrac_store.py +6 -1
  5. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/__init__.py +2 -2
  6. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/deriva_download.py +5 -10
  7. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/deriva_export.py +20 -8
  8. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/query/base_query_processor.py +5 -6
  9. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/query/file_download_query_processor.py +1 -2
  10. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/upload/deriva_upload.py +15 -9
  11. {deriva-1.7.6 → deriva-1.7.8/deriva.egg-info}/PKG-INFO +1 -2
  12. {deriva-1.7.6 → deriva-1.7.8}/deriva.egg-info/requires.txt +0 -1
  13. {deriva-1.7.6 → deriva-1.7.8}/setup.py +0 -1
  14. {deriva-1.7.6 → deriva-1.7.8}/.gitignore +0 -0
  15. {deriva-1.7.6 → deriva-1.7.8}/CHANGELOG.md +0 -0
  16. {deriva-1.7.6 → deriva-1.7.8}/LICENSE +0 -0
  17. {deriva-1.7.6 → deriva-1.7.8}/README.md +0 -0
  18. {deriva-1.7.6 → deriva-1.7.8}/deriva/__init__.py +0 -0
  19. {deriva-1.7.6 → deriva-1.7.8}/deriva/config/__init__.py +0 -0
  20. {deriva-1.7.6 → deriva-1.7.8}/deriva/config/acl_config.py +0 -0
  21. {deriva-1.7.6 → deriva-1.7.8}/deriva/config/annotation_config.py +0 -0
  22. {deriva-1.7.6 → deriva-1.7.8}/deriva/config/annotation_validate.py +0 -0
  23. {deriva-1.7.6 → deriva-1.7.8}/deriva/config/base_config.py +0 -0
  24. {deriva-1.7.6 → deriva-1.7.8}/deriva/config/dump_catalog_annotations.py +0 -0
  25. {deriva-1.7.6 → deriva-1.7.8}/deriva/config/examples/group_owner_policy.json +0 -0
  26. {deriva-1.7.6 → deriva-1.7.8}/deriva/config/examples/self_serve_policy.json +0 -0
  27. {deriva-1.7.6 → deriva-1.7.8}/deriva/config/rollback_annotation.py +0 -0
  28. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/annotation.py +0 -0
  29. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/catalog_cli.py +0 -0
  30. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/datapath.py +0 -0
  31. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/deriva_binding.py +0 -0
  32. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/deriva_server.py +0 -0
  33. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/ermrest_catalog.py +0 -0
  34. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/ermrest_model.py +0 -0
  35. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/hatrac_cli.py +0 -0
  36. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/mmo.py +0 -0
  37. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/polling_ermrest_catalog.py +0 -0
  38. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/app_links.schema.json +0 -0
  39. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/asset.schema.json +0 -0
  40. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/bulk_upload.schema.json +0 -0
  41. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/chaise_config.schema.json +0 -0
  42. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/citation.schema.json +0 -0
  43. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/column_display.schema.json +0 -0
  44. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/display.schema.json +0 -0
  45. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/export.schema.json +0 -0
  46. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/export_2019.schema.json +0 -0
  47. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/foreign_key.schema.json +0 -0
  48. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/generated.schema.json +0 -0
  49. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/immutable.schema.json +0 -0
  50. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/indexing_preferences.schema.json +0 -0
  51. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/key_display.schema.json +0 -0
  52. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/non_deletable.schema.json +0 -0
  53. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/required.schema.json +0 -0
  54. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/source_definitions.schema.json +0 -0
  55. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/table_alternatives.schema.json +0 -0
  56. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/table_display.schema.json +0 -0
  57. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/visible_columns.schema.json +0 -0
  58. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/schemas/visible_foreign_keys.schema.json +0 -0
  59. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/tests/__init__.py +0 -0
  60. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/utils/__init__.py +0 -0
  61. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/utils/core_utils.py +0 -0
  62. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/utils/globus_auth_utils.py +0 -0
  63. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/utils/hash_utils.py +0 -0
  64. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/utils/mime_utils.py +0 -0
  65. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/utils/version_utils.py +0 -0
  66. {deriva-1.7.6 → deriva-1.7.8}/deriva/core/utils/webauthn_utils.py +0 -0
  67. {deriva-1.7.6 → deriva-1.7.8}/deriva/seo/README.md +0 -0
  68. {deriva-1.7.6 → deriva-1.7.8}/deriva/seo/__init__.py +0 -0
  69. {deriva-1.7.6 → deriva-1.7.8}/deriva/seo/sitemap_builder.py +0 -0
  70. {deriva-1.7.6 → deriva-1.7.8}/deriva/seo/sitemap_cli.py +0 -0
  71. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/backup/__init__.py +0 -0
  72. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/backup/__main__.py +0 -0
  73. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/backup/deriva_backup.py +0 -0
  74. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/backup/deriva_backup_cli.py +0 -0
  75. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/__init__.py +0 -0
  76. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/__main__.py +0 -0
  77. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/deriva_download_cli.py +0 -0
  78. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/__init__.py +0 -0
  79. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/base_processor.py +0 -0
  80. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/postprocess/__init__.py +0 -0
  81. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/postprocess/identifier_post_processor.py +0 -0
  82. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/postprocess/transfer_post_processor.py +0 -0
  83. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/postprocess/url_post_processor.py +0 -0
  84. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/query/__init__.py +0 -0
  85. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/query/bag_fetch_query_processor.py +0 -0
  86. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/transform/__init__.py +0 -0
  87. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/transform/base_transform_processor.py +0 -0
  88. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/transform/column_transform_processor.py +0 -0
  89. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/transform/fasta_transform_processor.py +0 -0
  90. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/transform/format_transform_processor.py +0 -0
  91. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/transform/geo_transform_processor.py +0 -0
  92. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/processors/transform/string_transform_processor.py +0 -0
  93. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/__init__.py +0 -0
  94. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test1.json +0 -0
  95. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test10.json +0 -0
  96. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test11.json +0 -0
  97. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test12.json +0 -0
  98. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test13.json +0 -0
  99. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test14.json +0 -0
  100. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test15.json +0 -0
  101. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test16.json +0 -0
  102. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test19.json +0 -0
  103. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test2.json +0 -0
  104. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test20.json +0 -0
  105. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test3.json +0 -0
  106. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test4.json +0 -0
  107. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test5.json +0 -0
  108. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test6.json +0 -0
  109. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test7.json +0 -0
  110. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test8.json +0 -0
  111. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/download/tests/test9.json +0 -0
  112. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/restore/__init__.py +0 -0
  113. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/restore/__main__.py +0 -0
  114. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/restore/deriva_restore.py +0 -0
  115. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/restore/deriva_restore_cli.py +0 -0
  116. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/upload/__init__.py +0 -0
  117. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/upload/__main__.py +0 -0
  118. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/upload/deriva_upload_cli.py +0 -0
  119. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/upload/processors/__init__.py +0 -0
  120. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/upload/processors/archive_processor.py +0 -0
  121. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/upload/processors/base_processor.py +0 -0
  122. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/upload/processors/logging_processor.py +0 -0
  123. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/upload/processors/metadata_update_processor.py +0 -0
  124. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/upload/processors/rename_processor.py +0 -0
  125. {deriva-1.7.6 → deriva-1.7.8}/deriva/transfer/upload/tests/__init__.py +0 -0
  126. {deriva-1.7.6 → deriva-1.7.8}/deriva/utils/__init__.py +0 -0
  127. {deriva-1.7.6 → deriva-1.7.8}/deriva.egg-info/SOURCES.txt +0 -0
  128. {deriva-1.7.6 → deriva-1.7.8}/deriva.egg-info/dependency_links.txt +0 -0
  129. {deriva-1.7.6 → deriva-1.7.8}/deriva.egg-info/entry_points.txt +0 -0
  130. {deriva-1.7.6 → deriva-1.7.8}/deriva.egg-info/top_level.txt +0 -0
  131. {deriva-1.7.6 → deriva-1.7.8}/docs/BUILD.md +0 -0
  132. {deriva-1.7.6 → deriva-1.7.8}/docs/Makefile +0 -0
  133. {deriva-1.7.6 → deriva-1.7.8}/docs/README.md +0 -0
  134. {deriva-1.7.6 → deriva-1.7.8}/docs/_static/README.txt +0 -0
  135. {deriva-1.7.6 → deriva-1.7.8}/docs/api/deriva.config.rst +0 -0
  136. {deriva-1.7.6 → deriva-1.7.8}/docs/api/deriva.core.rst +0 -0
  137. {deriva-1.7.6 → deriva-1.7.8}/docs/api/deriva.core.utils.rst +0 -0
  138. {deriva-1.7.6 → deriva-1.7.8}/docs/api/deriva.rst +0 -0
  139. {deriva-1.7.6 → deriva-1.7.8}/docs/api/deriva.seo.rst +0 -0
  140. {deriva-1.7.6 → deriva-1.7.8}/docs/api/deriva.transfer.backup.rst +0 -0
  141. {deriva-1.7.6 → deriva-1.7.8}/docs/api/deriva.transfer.download.processors.postprocess.rst +0 -0
  142. {deriva-1.7.6 → deriva-1.7.8}/docs/api/deriva.transfer.download.processors.query.rst +0 -0
  143. {deriva-1.7.6 → deriva-1.7.8}/docs/api/deriva.transfer.download.processors.rst +0 -0
  144. {deriva-1.7.6 → deriva-1.7.8}/docs/api/deriva.transfer.download.processors.transform.rst +0 -0
  145. {deriva-1.7.6 → deriva-1.7.8}/docs/api/deriva.transfer.download.rst +0 -0
  146. {deriva-1.7.6 → deriva-1.7.8}/docs/api/deriva.transfer.restore.rst +0 -0
  147. {deriva-1.7.6 → deriva-1.7.8}/docs/api/deriva.transfer.rst +0 -0
  148. {deriva-1.7.6 → deriva-1.7.8}/docs/api/deriva.transfer.upload.rst +0 -0
  149. {deriva-1.7.6 → deriva-1.7.8}/docs/cli/commands.md +0 -0
  150. {deriva-1.7.6 → deriva-1.7.8}/docs/cli/deriva-acl-config.md +0 -0
  151. {deriva-1.7.6 → deriva-1.7.8}/docs/cli/deriva-annotation-config.md +0 -0
  152. {deriva-1.7.6 → deriva-1.7.8}/docs/cli/deriva-annotation-validate.md +0 -0
  153. {deriva-1.7.6 → deriva-1.7.8}/docs/cli/deriva-backup-cli.md +0 -0
  154. {deriva-1.7.6 → deriva-1.7.8}/docs/cli/deriva-download-cli.md +0 -0
  155. {deriva-1.7.6 → deriva-1.7.8}/docs/cli/deriva-hatrac-cli.md +0 -0
  156. {deriva-1.7.6 → deriva-1.7.8}/docs/cli/deriva-restore-cli.md +0 -0
  157. {deriva-1.7.6 → deriva-1.7.8}/docs/cli/deriva-sitemap-cli.md +0 -0
  158. {deriva-1.7.6 → deriva-1.7.8}/docs/conf.py +0 -0
  159. {deriva-1.7.6 → deriva-1.7.8}/docs/derivapy-catalog-snapshot.ipynb +0 -0
  160. {deriva-1.7.6 → deriva-1.7.8}/docs/derivapy-catalog.ipynb +0 -0
  161. {deriva-1.7.6 → deriva-1.7.8}/docs/derivapy-datapath-example-1.ipynb +0 -0
  162. {deriva-1.7.6 → deriva-1.7.8}/docs/derivapy-datapath-example-2.ipynb +0 -0
  163. {deriva-1.7.6 → deriva-1.7.8}/docs/derivapy-datapath-example-3.ipynb +0 -0
  164. {deriva-1.7.6 → deriva-1.7.8}/docs/derivapy-datapath-example-4.ipynb +0 -0
  165. {deriva-1.7.6 → deriva-1.7.8}/docs/derivapy-datapath-update.ipynb +0 -0
  166. {deriva-1.7.6 → deriva-1.7.8}/docs/get-started.ipynb +0 -0
  167. {deriva-1.7.6 → deriva-1.7.8}/docs/index.rst +0 -0
  168. {deriva-1.7.6 → deriva-1.7.8}/docs/install.md +0 -0
  169. {deriva-1.7.6 → deriva-1.7.8}/docs/make.bat +0 -0
  170. {deriva-1.7.6 → deriva-1.7.8}/docs/project-tutorial.md +0 -0
  171. {deriva-1.7.6 → deriva-1.7.8}/docs/using-r.md +0 -0
  172. {deriva-1.7.6 → deriva-1.7.8}/requirements_dev.txt +0 -0
  173. {deriva-1.7.6 → deriva-1.7.8}/setup.cfg +0 -0
  174. {deriva-1.7.6 → deriva-1.7.8}/tests/__init__.py +0 -0
  175. {deriva-1.7.6 → deriva-1.7.8}/tests/deriva/__init__.py +0 -0
  176. {deriva-1.7.6 → deriva-1.7.8}/tests/deriva/core/__init__.py +0 -0
  177. {deriva-1.7.6 → deriva-1.7.8}/tests/deriva/core/mmo/__init__.py +0 -0
  178. {deriva-1.7.6 → deriva-1.7.8}/tests/deriva/core/mmo/base.py +0 -0
  179. {deriva-1.7.6 → deriva-1.7.8}/tests/deriva/core/mmo/test_mmo_drop.py +0 -0
  180. {deriva-1.7.6 → deriva-1.7.8}/tests/deriva/core/mmo/test_mmo_find.py +0 -0
  181. {deriva-1.7.6 → deriva-1.7.8}/tests/deriva/core/mmo/test_mmo_prune.py +0 -0
  182. {deriva-1.7.6 → deriva-1.7.8}/tests/deriva/core/mmo/test_mmo_rename.py +0 -0
  183. {deriva-1.7.6 → deriva-1.7.8}/tests/deriva/core/mmo/test_mmo_replace.py +0 -0
  184. {deriva-1.7.6 → deriva-1.7.8}/tests/deriva/core/test_datapath.py +0 -0
  185. {deriva-1.7.6 → deriva-1.7.8}/tests/deriva/core/test_ermrest_model.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: deriva
3
- Version: 1.7.6
3
+ Version: 1.7.8
4
4
  Summary: Python APIs and CLIs (Command-Line Interfaces) for the DERIVA platform.
5
5
  Home-page: https://github.com/informatics-isi-edu/deriva-py
6
6
  Author: USC Information Sciences Institute, Informatics Systems Research Division
@@ -25,7 +25,6 @@ Description-Content-Type: text/markdown
25
25
  License-File: LICENSE
26
26
  Requires-Dist: packaging
27
27
  Requires-Dist: requests
28
- Requires-Dist: certifi
29
28
  Requires-Dist: pika
30
29
  Requires-Dist: urllib3<3,>=1.26
31
30
  Requires-Dist: portalocker>=1.2.1
@@ -1,4 +1,4 @@
1
- __version__ = "1.7.6"
1
+ __version__ = "1.7.8"
2
2
 
3
3
  from deriva.core.utils.core_utils import *
4
4
  from deriva.core.base_cli import BaseCLI, KeyValuePairArgs
@@ -53,6 +53,11 @@ class BaseCLI(object):
53
53
 
54
54
  return args
55
55
 
56
+ # Function to convert comma-separated CLI input into a tuple
57
+ @staticmethod
58
+ def parse_tuple(value):
59
+ # Split the input by commas and convert to a tuple
60
+ return tuple(map(float, value.split(',')))
56
61
 
57
62
  class KeyValuePairArgs(argparse.Action):
58
63
  def __init__(self, option_strings, dest, nargs=None, **kwargs):
@@ -184,6 +184,7 @@ class HatracStore(DerivaBinding):
184
184
 
185
185
  headers = headers.copy()
186
186
 
187
+ file_opened = False
187
188
  if hasattr(data, 'read') and hasattr(data, 'seek'):
188
189
  data.seek(0, os.SEEK_END)
189
190
  file_size = data.tell()
@@ -192,6 +193,7 @@ class HatracStore(DerivaBinding):
192
193
  else:
193
194
  file_size = os.path.getsize(data)
194
195
  f = open(data, 'rb')
196
+ file_opened = True
195
197
 
196
198
  if not (md5 or sha256):
197
199
  md5 = hu.compute_hashes(f, hashes=['md5'])['md5'][1]
@@ -208,7 +210,8 @@ class HatracStore(DerivaBinding):
208
210
  if (md5 and r.headers.get('Content-MD5') == md5 or
209
211
  sha256 and r.headers.get('Content-SHA256') == sha256):
210
212
  # object already has same content so skip upload
211
- f.close()
213
+ if file_opened:
214
+ f.close()
212
215
  return r.headers.get('Content-Location')
213
216
  elif not allow_versioning:
214
217
  raise NotModified("The data cannot be uploaded because content already exists for this object "
@@ -232,6 +235,8 @@ class HatracStore(DerivaBinding):
232
235
  url = '%s%s' % (url.rstrip("/") if url.endswith("/") else url,
233
236
  "" if not parents else "?parents=%s" % str(parents).lower())
234
237
  r = self._session.put(url, data=f, headers=headers)
238
+ if file_opened:
239
+ f.close()
235
240
  self._response_raise_for_status(r)
236
241
  loc = r.text.strip() or r.url
237
242
  if loc.startswith(self._server_uri):
@@ -4,8 +4,8 @@ from deriva.transfer.download.deriva_download import DerivaDownload, GenericDown
4
4
  from deriva.transfer.download.deriva_download_cli import DerivaDownloadCLI
5
5
  from deriva.transfer.download.deriva_export import DerivaExport, DerivaExportCLI
6
6
 
7
- from deriva.transfer.upload.deriva_upload import DerivaUpload, GenericUploader, DerivaUploadError, DerivaUploadError, \
8
- DerivaUploadConfigurationError, DerivaUploadCatalogCreateError, DerivaUploadCatalogUpdateError, \
7
+ from deriva.transfer.upload.deriva_upload import DerivaUpload, GenericUploader, UploadState, DerivaUploadError, \
8
+ DerivaUploadError, DerivaUploadConfigurationError, DerivaUploadCatalogCreateError, DerivaUploadCatalogUpdateError, \
9
9
  DerivaUploadAuthenticationError
10
10
  from deriva.transfer.upload.deriva_upload_cli import DerivaUploadCLI
11
11
 
@@ -8,8 +8,8 @@ import requests
8
8
  from requests.exceptions import HTTPError
9
9
  from bdbag import bdbag_api as bdb, bdbag_ro as ro, BAG_PROFILE_TAG, BDBAG_RO_PROFILE_ID
10
10
  from bdbag.bdbagit import BagValidationError
11
- from deriva.core import ErmrestCatalog, HatracStore, format_exception, get_credential, format_credential, read_config, \
12
- stob, Megabyte, __version__ as VERSION
11
+ from deriva.core import DerivaServer, ErmrestCatalog, HatracStore, format_exception, get_credential, \
12
+ format_credential, read_config, stob, Megabyte, __version__ as VERSION
13
13
  from deriva.core.utils.version_utils import get_installed_version
14
14
  from deriva.transfer.download.processors import find_query_processor, find_transform_processor, find_post_processor
15
15
  from deriva.transfer.download.processors.base_processor import LOCAL_PATH_KEY, REMOTE_PATHS_KEY, SERVICE_URL_KEY, \
@@ -76,14 +76,9 @@ class DerivaDownload(object):
76
76
  password=password)
77
77
 
78
78
  # catalog and file store initialization
79
- if self.catalog:
80
- del self.catalog
81
- self.catalog = ErmrestCatalog(
82
- protocol, self.hostname, catalog_id, self.credentials, session_config=session_config)
83
- if self.store:
84
- del self.store
85
- self.store = HatracStore(
86
- protocol, self.hostname, self.credentials, session_config=session_config)
79
+ server = DerivaServer(protocol, self.hostname, credentials=self.credentials, session_config=session_config)
80
+ self.catalog = server.connect_ermrest(catalog_id)
81
+ self.store = HatracStore(protocol, self.hostname, self.credentials, session_config=session_config)
87
82
 
88
83
  # init dcctx cid
89
84
  self.set_dcctx_cid(kwargs.get("dcctx_cid", "api/" + self.__class__.__name__))
@@ -5,7 +5,6 @@ import traceback
5
5
  import requests
6
6
  import argparse
7
7
  import logging
8
- import certifi
9
8
  import datetime
10
9
  from collections.abc import Mapping, Iterable
11
10
  from requests.exceptions import HTTPError, ConnectionError, Timeout
@@ -29,7 +28,8 @@ Client tool for interacting with DERIVA Export service.
29
28
  :param envars (dict): A dictionary of variables used for template substitution. Optional.
30
29
  :param output_dir (str): The directory where exported data will be stored (default: "."). Optional.
31
30
  :param defer_download (bool): Whether to defer the actual data download. Optional.
32
- :param timeout (int): Timeout value for export operations. Optional.
31
+ :param timeout (tuple) OR (float): Timeout value as a tuple of floats in seconds for (connect,read) export operations.
32
+ If a single float value is passed, it will apply to both connect and read operations. Optional.
33
33
  :param export_type (str): The type of export to perform (default: "bdbag"). Optional.
34
34
 
35
35
  :return: The full path to the downloaded file. If "defer_download" is True, the URL(s) where the export can be downloaded.
@@ -47,10 +47,20 @@ class DerivaExport:
47
47
  self.base_server_uri = "https://" + self.host
48
48
  self.service_url = self.base_server_uri + EXPORT_SERVICE_PATH % self.export_type
49
49
  self.session_config = DEFAULT_SESSION_CONFIG.copy()
50
- if self.timeout is not None:
51
- self.session_config["timeout"] = self.timeout
50
+ if isinstance(self.timeout, tuple):
51
+ if len(self.timeout) == 2:
52
+ self.session_config["timeout"] = self.timeout
53
+ else:
54
+ self.session_config["timeout"] = float(self.timeout[0])
55
+ elif self.timeout is not None:
56
+ try:
57
+ self.session_config["timeout"] = float(self.timeout)
58
+ except ValueError:
59
+ logger.warning("Unparseable timeout value: %r. Defaults will be used: %r." %
60
+ (self.timeout, self.session_config["timeout"]))
52
61
  self.session = get_new_requests_session(self.service_url, self.session_config)
53
62
  self.dcctx = DerivaClientContext()
63
+ self.dcctx['cid'] = kwargs.get("dcctx_cid", "api/" + self.__class__.__name__)
54
64
  self.session.headers.update({'deriva-client-context': self.dcctx.encoded()})
55
65
 
56
66
  # credential initialization
@@ -114,7 +124,7 @@ class DerivaExport:
114
124
 
115
125
  filename = parse_content_disposition(content_disposition)
116
126
  output_path = os.path.abspath(os.path.join(self.output_dir, filename))
117
- with self.session.get(url, stream=True, verify=certifi.where()) as r:
127
+ with self.session.get(url, stream=True) as r:
118
128
  if r.status_code != 200:
119
129
  file_error = "File [%s] transfer failed." % output_path
120
130
  url_error = 'HTTP GET Failed for url: %s' % url
@@ -190,8 +200,10 @@ class DerivaExportCLI(BaseCLI):
190
200
  BaseCLI.__init__(self, description, epilog, **kwargs)
191
201
  self.parser.add_argument("--defer-download", action="store_true",
192
202
  help="Do not download exported file(s). Default: False")
193
- self.parser.add_argument("--timeout", metavar="<seconds>",
194
- help="Total number of seconds elapsed before the download is aborted.")
203
+ self.parser.add_argument("--timeout", metavar="<connect,read>", type=BaseCLI.parse_tuple,
204
+ help="Timeout value(s) in seconds (int or float) for connect and read operations. "
205
+ "Separate using commas. If a single value is provided it will be used for both "
206
+ "connect and read timeouts.")
195
207
  self.parser.add_argument("--export-type", choices=["bdbag", "file"], default="bdbag",
196
208
  help="Export type: {bdbag|file}. Default is bdbag.",)
197
209
  self.parser.add_argument("--output-dir", metavar="<output dir>", default=".",
@@ -212,7 +224,7 @@ class DerivaExportCLI(BaseCLI):
212
224
  sys.stderr.write("\n")
213
225
 
214
226
  try:
215
- exporter = DerivaExport(**vars(args))
227
+ exporter = DerivaExport(**vars(args), dcctx_cid="cli/" + self.__class__.__name__)
216
228
  exporter.export()
217
229
  except (DerivaDownloadError, DerivaDownloadConfigurationError, DerivaDownloadAuthenticationError,
218
230
  DerivaDownloadAuthorizationError, DerivaDownloadTimeoutError) as e:
@@ -1,8 +1,7 @@
1
1
  import os
2
2
  import errno
3
- import certifi
4
3
  import requests
5
- from deriva.core import urlsplit, get_new_requests_session, stob, make_dirs, DEFAULT_SESSION_CONFIG
4
+ from deriva.core import urlsplit, get_new_requests_session, stob, make_dirs, format_exception, DEFAULT_SESSION_CONFIG
6
5
  from deriva.transfer.download import DerivaDownloadError, DerivaDownloadConfigurationError, \
7
6
  DerivaDownloadAuthenticationError, DerivaDownloadAuthorizationError
8
7
  from deriva.transfer.download.processors.base_processor import BaseProcessor, \
@@ -83,12 +82,12 @@ class BaseQueryProcessor(BaseProcessor):
83
82
  return self.catalog.get(self.query, headers=headers).json()
84
83
  except requests.HTTPError as e:
85
84
  if e.response.status_code == 401:
86
- raise DerivaDownloadAuthenticationError(e)
85
+ raise DerivaDownloadAuthenticationError(format_exception(e))
87
86
  if e.response.status_code == 403:
88
- raise DerivaDownloadAuthorizationError(e)
87
+ raise DerivaDownloadAuthorizationError(format_exception(e))
89
88
  if as_file:
90
89
  os.remove(self.output_abspath)
91
- raise DerivaDownloadError("Error executing catalog query: %s" % e)
90
+ raise DerivaDownloadError("Error executing catalog query: %s" % format_exception(e))
92
91
  except Exception:
93
92
  if as_file:
94
93
  os.remove(self.output_abspath)
@@ -162,7 +161,7 @@ class BaseQueryProcessor(BaseProcessor):
162
161
  if cookies:
163
162
  session.cookies.update(cookies)
164
163
  if login_params and auth_url:
165
- r = session.post(auth_url, data=login_params, verify=certifi.where())
164
+ r = session.post(auth_url, data=login_params)
166
165
  if r.status_code > 203:
167
166
  raise DerivaDownloadError(
168
167
  'GetExternalSession Failed with Status Code: %s\n%s\n' % (r.status_code, r.text))
@@ -4,7 +4,6 @@ import uuid
4
4
  import datetime
5
5
  import logging
6
6
  import requests
7
- import certifi
8
7
  from bdbag import bdbag_ro as ro
9
8
  from deriva.core import urlsplit, format_exception, get_transfer_summary, make_dirs, DEFAULT_CHUNK_SIZE
10
9
  from deriva.core.utils.mime_utils import parse_content_disposition
@@ -39,7 +38,7 @@ class FileDownloadQueryProcessor(BaseQueryProcessor):
39
38
  else:
40
39
  headers.update(self.HEADERS)
41
40
  session = self.getExternalSession(host)
42
- with session.get(url, headers=headers, stream=True, verify=certifi.where()) as r:
41
+ with session.get(url, headers=headers, stream=True) as r:
43
42
  if r.status_code != 200:
44
43
  file_error = "File [%s] transfer failed." % output_path
45
44
  url_error = 'HTTP GET Failed for url: %s' % url
@@ -157,8 +157,12 @@ class DerivaUpload(object):
157
157
 
158
158
  # determine identity
159
159
  if self.credentials:
160
- attributes = self.catalog.get_authn_session().json()
161
- self.identity = attributes.get("client", self.identity)
160
+ try:
161
+ attributes = self.catalog.get_authn_session().json()
162
+ self.identity = attributes.get("client", self.identity)
163
+ except Exception as e:
164
+ # not a big deal since the credential token being used could be expired
165
+ logger.debug("Unable to determine user identity from existing credential (may be expired): %s" % e)
162
166
 
163
167
  # init dcctx cid to a default
164
168
  self.set_dcctx_cid(self.dcctx_cid)
@@ -342,7 +346,7 @@ class DerivaUpload(object):
342
346
  return '%s:%s' % (urlquote(schema_name), urlquote(table_name))
343
347
 
344
348
  @staticmethod
345
- def interpolateDict(src, dst, allowNone=False):
349
+ def interpolateDict(src, dst, allow_none=False, allow_none_column_list=[]):
346
350
  if not (isinstance(src, dict) and isinstance(dst, dict)):
347
351
  raise ValueError("Invalid input parameter type(s): (src = %s, dst = %s), expected (dict, dict)" % (
348
352
  type(src).__name__, type(dst).__name__))
@@ -362,10 +366,10 @@ class DerivaUpload(object):
362
366
  if value.startswith('{') and value.endswith('}'):
363
367
  value = None
364
368
  dst.update({k: value})
365
- # remove all None valued entries in the dest, if disallowed
366
- if not allowNone:
367
- empty = [k for k, v in dst.items() if v is None]
368
- for k in empty:
369
+ # remove all None valued entries in the dest, if globally disallowed or the column is not explicitly allowed
370
+ empty = [k for k, v in dst.items() if v is None]
371
+ for k in empty:
372
+ if not allow_none or (allow_none and k not in allow_none_column_list):
369
373
  del dst[k]
370
374
 
371
375
  return dst
@@ -720,7 +724,9 @@ class DerivaUpload(object):
720
724
 
721
725
  # 8. Update an existing record, if necessary
722
726
  column_map = asset_mapping.get("column_map", {})
723
- updated_record = self.interpolateDict(self.metadata, column_map)
727
+ allow_none_col_list = asset_mapping.get("allow_empty_columns_on_update", [])
728
+ allow_none = True if allow_none_col_list else False
729
+ updated_record = self.interpolateDict(self.metadata, column_map, allow_none, allow_none_col_list)
724
730
  if updated_record != record:
725
731
  record_update_template = asset_mapping.get("record_update_template")
726
732
  require_record_update_template = stob(asset_mapping.get("require_record_update_template", False))
@@ -794,7 +800,7 @@ class DerivaUpload(object):
794
800
  if result:
795
801
  record = result[0]
796
802
  self._updateFileMetadata(record)
797
- return self.interpolateDict(self.metadata, column_map, allowNone=True), record
803
+ return self.interpolateDict(self.metadata, column_map, allow_none=True), record
798
804
 
799
805
  def _urlEncodeMetadata(self, safe_overrides=None):
800
806
  urlencoded = dict()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: deriva
3
- Version: 1.7.6
3
+ Version: 1.7.8
4
4
  Summary: Python APIs and CLIs (Command-Line Interfaces) for the DERIVA platform.
5
5
  Home-page: https://github.com/informatics-isi-edu/deriva-py
6
6
  Author: USC Information Sciences Institute, Informatics Systems Research Division
@@ -25,7 +25,6 @@ Description-Content-Type: text/markdown
25
25
  License-File: LICENSE
26
26
  Requires-Dist: packaging
27
27
  Requires-Dist: requests
28
- Requires-Dist: certifi
29
28
  Requires-Dist: pika
30
29
  Requires-Dist: urllib3<3,>=1.26
31
30
  Requires-Dist: portalocker>=1.2.1
@@ -1,6 +1,5 @@
1
1
  packaging
2
2
  requests
3
- certifi
4
3
  pika
5
4
  urllib3<3,>=1.26
6
5
  portalocker>=1.2.1
@@ -64,7 +64,6 @@ setup(
64
64
  install_requires=[
65
65
  'packaging',
66
66
  'requests',
67
- 'certifi',
68
67
  'pika',
69
68
  'urllib3>=1.26,<3',
70
69
  'portalocker>=1.2.1',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes