NGPIris 5.2.0.dev1__tar.gz → 5.2.1.dev2__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 (131) hide show
  1. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris/cli/__init__.py +3 -1
  2. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris/hcp/hcp.py +27 -2
  3. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris.egg-info/PKG-INFO +3 -3
  4. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris.egg-info/SOURCES.txt +1 -0
  5. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris.egg-info/requires.txt +1 -1
  6. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/PKG-INFO +3 -3
  7. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/pyproject.toml +6 -2
  8. ngpiris-5.2.1.dev2/tests/data/.DS_Store +0 -0
  9. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/tests/test_hci.py +5 -1
  10. ngpiris-5.2.1.dev2/tests/test_hcp.py +222 -0
  11. ngpiris-5.2.0.dev1/tests/test_hcp.py +0 -216
  12. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/LICENSE +0 -0
  13. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/MANIFEST.in +0 -0
  14. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris/__init__.py +0 -0
  15. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris/hci/__init__.py +0 -0
  16. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris/hci/exceptions.py +0 -0
  17. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris/hci/hci.py +0 -0
  18. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris/hci/helpers.py +0 -0
  19. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris/hcp/__init__.py +0 -0
  20. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris/hcp/exceptions.py +0 -0
  21. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris/hcp/helpers.py +0 -0
  22. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris/hcp/statistics.py +0 -0
  23. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris/parse_credentials/__init__.py +0 -0
  24. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris/parse_credentials/parse_credentials.py +0 -0
  25. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris/utils/__init__.py +0 -0
  26. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris/utils/utils.py +0 -0
  27. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris.egg-info/dependency_links.txt +0 -0
  28. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris.egg-info/entry_points.txt +0 -0
  29. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/NGPIris.egg-info/top_level.txt +0 -0
  30. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/README.md +0 -0
  31. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/IRIS_5_changelog.md +0 -0
  32. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/Makefile +0 -0
  33. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/NGPIris.cli.rst +0 -0
  34. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/NGPIris.hci.rst +0 -0
  35. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/NGPIris.hcp.rst +0 -0
  36. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/NGPIris.parse_credentials.rst +0 -0
  37. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/NGPIris.rst +0 -0
  38. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/NGPIris.utils.rst +0 -0
  39. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/Tutorial.md +0 -0
  40. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/.DS_Store +0 -0
  41. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/doctrees/IRIS_5_changelog.doctree +0 -0
  42. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/doctrees/NGPIris.cli.doctree +0 -0
  43. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/doctrees/NGPIris.doctree +0 -0
  44. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/doctrees/NGPIris.hci.doctree +0 -0
  45. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/doctrees/NGPIris.hcp.doctree +0 -0
  46. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/doctrees/NGPIris.parse_credentials.doctree +0 -0
  47. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/doctrees/NGPIris.utils.doctree +0 -0
  48. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/doctrees/README.doctree +0 -0
  49. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/doctrees/Tutorial.doctree +0 -0
  50. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/doctrees/environment.pickle +0 -0
  51. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/doctrees/index.doctree +0 -0
  52. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/doctrees/modules.doctree +0 -0
  53. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/.buildinfo +0 -0
  54. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/IRIS_5_changelog.html +0 -0
  55. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/NGPIris.cli.html +0 -0
  56. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/NGPIris.hci.html +0 -0
  57. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/NGPIris.hcp.html +0 -0
  58. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/NGPIris.html +0 -0
  59. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/NGPIris.parse_credentials.html +0 -0
  60. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/NGPIris.utils.html +0 -0
  61. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/README.html +0 -0
  62. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/Tutorial.html +0 -0
  63. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_downloads/ee00c4f6f22dc2671c766f728f00006f/credentials_template.json +0 -0
  64. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_modules/NGPIris/cli.html +0 -0
  65. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_modules/NGPIris/hci/exceptions.html +0 -0
  66. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_modules/NGPIris/hci/hci.html +0 -0
  67. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_modules/NGPIris/hci/helpers.html +0 -0
  68. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_modules/NGPIris/hcp/exceptions.html +0 -0
  69. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_modules/NGPIris/hcp/hcp.html +0 -0
  70. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_modules/NGPIris/hcp/helpers.html +0 -0
  71. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_modules/NGPIris/hcp/statistics.html +0 -0
  72. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_modules/NGPIris/parse_credentials/parse_credentials.html +0 -0
  73. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_modules/NGPIris/utils/utils.html +0 -0
  74. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_modules/index.html +0 -0
  75. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_sources/IRIS_5_changelog.md.txt +0 -0
  76. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_sources/NGPIris.cli.rst.txt +0 -0
  77. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_sources/NGPIris.hci.rst.txt +0 -0
  78. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_sources/NGPIris.hcp.rst.txt +0 -0
  79. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_sources/NGPIris.parse_credentials.rst.txt +0 -0
  80. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_sources/NGPIris.rst.txt +0 -0
  81. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_sources/NGPIris.utils.rst.txt +0 -0
  82. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_sources/README.md.txt +0 -0
  83. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_sources/Tutorial.md.txt +0 -0
  84. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_sources/index.rst.txt +0 -0
  85. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_sources/modules.rst.txt +0 -0
  86. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/alabaster.css +0 -0
  87. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/basic.css +0 -0
  88. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/custom.css +0 -0
  89. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/debug.css +0 -0
  90. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/doctools.js +0 -0
  91. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/documentation_options.js +0 -0
  92. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/file.png +0 -0
  93. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/language_data.js +0 -0
  94. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/minus.png +0 -0
  95. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/plus.png +0 -0
  96. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/pygments.css +0 -0
  97. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/scripts/furo-extensions.js +0 -0
  98. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/scripts/furo.js +0 -0
  99. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/scripts/furo.js.LICENSE.txt +0 -0
  100. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/scripts/furo.js.map +0 -0
  101. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/searchtools.js +0 -0
  102. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/skeleton.css +0 -0
  103. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/sphinx_highlight.js +0 -0
  104. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/styles/furo-extensions.css +0 -0
  105. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/styles/furo-extensions.css.map +0 -0
  106. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/styles/furo.css +0 -0
  107. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/_static/styles/furo.css.map +0 -0
  108. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/genindex.html +0 -0
  109. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/index.html +0 -0
  110. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/modules.html +0 -0
  111. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/objects.inv +0 -0
  112. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/py-modindex.html +0 -0
  113. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/search.html +0 -0
  114. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/_build/html/searchindex.js +0 -0
  115. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/conf.py +0 -0
  116. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/index.rst +0 -0
  117. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/make.bat +0 -0
  118. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/docs/modules.rst +0 -0
  119. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/setup.cfg +0 -0
  120. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/tests/data/80MB_test_file +0 -0
  121. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/tests/data/a folder of data/80MB_test_file_0 +0 -0
  122. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/tests/data/a folder of data/80MB_test_file_1 +0 -0
  123. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/tests/data/complete_creds_0.json +0 -0
  124. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/tests/data/complete_creds_1.json +0 -0
  125. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/tests/data/complete_creds_2.json +0 -0
  126. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/tests/data/incomplete_creds_0.json +0 -0
  127. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/tests/data/incomplete_creds_1.json +0 -0
  128. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/tests/data/incomplete_creds_2.json +0 -0
  129. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/tests/data/incomplete_creds_3.json +0 -0
  130. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/tests/data/incomplete_creds_4.json +0 -0
  131. {ngpiris-5.2.0.dev1 → ngpiris-5.2.1.dev2}/tests/test_parse_credentials.py +0 -0
@@ -94,11 +94,13 @@ def upload(context : Context, bucket : str, source : str, destination : str):
94
94
  """
95
95
  hcph : HCPHandler = get_HCPHandler(context)
96
96
  hcph.mount_bucket(bucket)
97
- source = add_trailing_slash(source)
98
97
  destination = add_trailing_slash(destination)
99
98
  if Path(source).is_dir():
99
+ source = add_trailing_slash(source)
100
100
  hcph.upload_folder(source, destination)
101
101
  else:
102
+ file_name = Path(source).name
103
+ destination += file_name
102
104
  hcph.upload_file(source, destination)
103
105
 
104
106
  @cli.command()
@@ -67,15 +67,37 @@ class HCPHandler:
67
67
  self.hcp = credentials_handler.hcp
68
68
  self.endpoint = "https://" + self.hcp["endpoint"]
69
69
 
70
+ # A lookup table for GMC names to HCP tenant names
71
+ gmc_tenant_map = {
72
+ "gmc-joint" : "vgtn0008",
73
+ "gmc-west" : "vgtn0012",
74
+ "gmc-southeast" : "vgtn0014",
75
+ "gmc-south" : "vgtn0015",
76
+ "gmc-orebro" : "vgtn0016",
77
+ "gmc-karolinska" : "vgtn0017",
78
+ "gmc-north" : "vgtn0018",
79
+ "gmc-uppsala" : "vgtn0019"
80
+ }
81
+
70
82
  self.tenant = None
71
83
  for endpoint_format_string in ["https://{}.ngp-fs1000.vgregion.se", "https://{}.ngp-fs2000.vgregion.se", "https://{}.ngp-fs3000.vgregion.se", "https://{}.vgregion.sjunet.org"]:
72
84
  tenant_parse = parse(endpoint_format_string, self.endpoint)
73
85
  if type(tenant_parse) is Result:
74
- self.tenant = str(tenant_parse[0])
86
+ tenant = str(tenant_parse[0])
87
+ if endpoint_format_string == "https://{}.vgregion.sjunet.org": # Check if endpoint is Sjunet
88
+ mapped_tenant = gmc_tenant_map.get(tenant)
89
+ if mapped_tenant:
90
+ self.tenant = mapped_tenant
91
+ else:
92
+ raise RuntimeError("The provided tenant name, \"" + tenant + "\", could is not a valid tenant name. Hint: did you spell it correctly?")
93
+ else:
94
+ self.tenant = tenant
95
+
75
96
  break
76
97
 
98
+
77
99
  if not self.tenant:
78
- raise RuntimeError("Unable to parse endpoint. Make sure that you have entered the correct endpoint in your credentials JSON file. Hint: The endpoint should *not* contain \"https://\" or port numbers")
100
+ raise RuntimeError("Unable to parse endpoint, \"" + self.endpoint + "\". Make sure that you have entered the correct endpoint in your credentials JSON file. Hints:\n - The endpoint should *not* contain \"https://\" or port numbers\n - Is the endpoint spelled correctly?")
79
101
  self.base_request_url = self.endpoint + ":9090/mapi/tenants/" + self.tenant
80
102
  self.aws_access_key_id = self.hcp["aws_access_key_id"]
81
103
  self.aws_secret_access_key = self.hcp["aws_secret_access_key"]
@@ -403,6 +425,9 @@ class HCPHandler:
403
425
  file_name = Path(local_file_path).name
404
426
  key = file_name
405
427
 
428
+ if "\\" in local_file_path:
429
+ raise RuntimeError("The \"\\\" character is not allowed in the file path")
430
+
406
431
  if self.object_exists(key):
407
432
  raise ObjectAlreadyExist("The object \"" + key + "\" already exist in the mounted bucket")
408
433
  else:
@@ -1,12 +1,12 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: NGPIris
3
- Version: 5.2.0.dev1
3
+ Version: 5.2.1.dev2
4
4
  Author-email: Erik Brink <erik.brink@gu.se>, Isak Sylvin <isak.sylvin@gu.se>
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
7
7
  Requires-Dist: requests>=2.31.0
8
8
  Requires-Dist: urllib3==1.26.19
9
- Requires-Dist: boto3>=1.26.76
9
+ Requires-Dist: boto3==1.35.81
10
10
  Requires-Dist: parse>=1.19.1
11
11
  Requires-Dist: RapidFuzz>=3.10.1
12
12
  Requires-Dist: tqdm>=4.66.2
@@ -114,6 +114,7 @@ docs/_build/html/_static/styles/furo.css.map
114
114
  tests/test_hci.py
115
115
  tests/test_hcp.py
116
116
  tests/test_parse_credentials.py
117
+ tests/data/.DS_Store
117
118
  tests/data/80MB_test_file
118
119
  tests/data/complete_creds_0.json
119
120
  tests/data/complete_creds_1.json
@@ -1,6 +1,6 @@
1
1
  requests>=2.31.0
2
2
  urllib3==1.26.19
3
- boto3>=1.26.76
3
+ boto3==1.35.81
4
4
  parse>=1.19.1
5
5
  RapidFuzz>=3.10.1
6
6
  tqdm>=4.66.2
@@ -1,12 +1,12 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: NGPIris
3
- Version: 5.2.0.dev1
3
+ Version: 5.2.1.dev2
4
4
  Author-email: Erik Brink <erik.brink@gu.se>, Isak Sylvin <isak.sylvin@gu.se>
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
7
7
  Requires-Dist: requests>=2.31.0
8
8
  Requires-Dist: urllib3==1.26.19
9
- Requires-Dist: boto3>=1.26.76
9
+ Requires-Dist: boto3==1.35.81
10
10
  Requires-Dist: parse>=1.19.1
11
11
  Requires-Dist: RapidFuzz>=3.10.1
12
12
  Requires-Dist: tqdm>=4.66.2
@@ -1,11 +1,11 @@
1
1
  [project]
2
2
  name = "NGPIris"
3
- version = "5.2.0.dev1"
3
+ version = "5.2.1.dev2"
4
4
  readme = "README.md"
5
5
  dependencies = [
6
6
  "requests >= 2.31.0",
7
7
  "urllib3 == 1.26.19",
8
- "boto3 >= 1.26.76",
8
+ "boto3 == 1.35.81",
9
9
  "parse >= 1.19.1",
10
10
  "RapidFuzz >= 3.10.1",
11
11
  "tqdm >= 4.66.2",
@@ -32,6 +32,10 @@ inputs = ["NGPIris"]
32
32
  pythonpath = [
33
33
  "."
34
34
  ]
35
+ testpaths = [
36
+ "tests"
37
+ ]
38
+ addopts = "--strict-markers" # Adds command-line options
35
39
  filterwarnings = "ignore::urllib3.connectionpool.InsecureRequestWarning"
36
40
 
37
41
  [project.scripts]
Binary file
@@ -1,10 +1,14 @@
1
1
 
2
+ from configparser import ConfigParser
2
3
  from NGPIris.hci import HCIHandler
3
4
  from random import randint
4
5
  from json import dump
5
6
  from os import remove
6
7
 
7
- hci_h = HCIHandler("credentials/testCredentials.json")
8
+ ini_config = ConfigParser()
9
+ ini_config.read("tests/test_conf.ini")
10
+
11
+ hci_h = HCIHandler(ini_config.get("General", "credentials_path"))
8
12
  hci_h.request_token()
9
13
 
10
14
  def test_list_index_names_type() -> None:
@@ -0,0 +1,222 @@
1
+
2
+
3
+ from pathlib import Path
4
+ from filecmp import cmp
5
+ from typing import Any, Callable
6
+
7
+ from conftest import CustomConfig
8
+
9
+ from NGPIris.hcp import HCPHandler
10
+
11
+ # --------------------------- Helper fucntions ---------------------------------
12
+
13
+ def _without_mounting(hcp_h : HCPHandler, hcp_h_method : Callable[..., Any]) -> None:
14
+ hcp_h.bucket_name = None
15
+ try:
16
+ hcp_h_method(hcp_h)
17
+ except:
18
+ assert True
19
+ else: # pragma: no cover
20
+ assert False
21
+
22
+ # --------------------------- Test suite ---------------------------------------
23
+
24
+ def test_list_buckets(custom_config : CustomConfig) -> None:
25
+ assert custom_config.hcp_h.list_buckets()
26
+
27
+ def test_mount_bucket(custom_config : CustomConfig) -> None:
28
+ custom_config.hcp_h.mount_bucket(custom_config.test_bucket)
29
+
30
+ def test_mount_nonexisting_bucket(custom_config : CustomConfig) -> None:
31
+ try:
32
+ custom_config.hcp_h.mount_bucket("aBucketThatDoesNotExist")
33
+ except:
34
+ assert True
35
+ else: # pragma: no cover
36
+ assert False
37
+
38
+ def test_test_connection(custom_config : CustomConfig) -> None:
39
+ test_mount_bucket(custom_config)
40
+ custom_config.hcp_h.test_connection()
41
+
42
+ def test_test_connection_with_bucket_name(custom_config : CustomConfig) -> None:
43
+ custom_config.hcp_h.test_connection(bucket_name = custom_config.test_bucket)
44
+
45
+ def test_test_connection_without_mounting_bucket(custom_config : CustomConfig) -> None:
46
+ _hcp_h = custom_config.hcp_h
47
+ _without_mounting(_hcp_h, HCPHandler.test_connection)
48
+
49
+ def test_list_objects(custom_config : CustomConfig) -> None:
50
+ test_mount_bucket(custom_config)
51
+ assert type(list(custom_config.hcp_h.list_objects())) == list
52
+
53
+ def test_list_objects_without_mounting(custom_config : CustomConfig) -> None:
54
+ _hcp_h = custom_config.hcp_h
55
+ _without_mounting(_hcp_h, HCPHandler.list_objects)
56
+
57
+ def test_upload_file(custom_config : CustomConfig) -> None:
58
+ test_mount_bucket(custom_config)
59
+ custom_config.hcp_h.upload_file(custom_config.test_file_path)
60
+
61
+ def test_upload_file_without_mounting(custom_config : CustomConfig) -> None:
62
+ _hcp_h = custom_config.hcp_h
63
+ _without_mounting(_hcp_h, HCPHandler.upload_file)
64
+
65
+ def test_upload_file_in_sub_directory(custom_config : CustomConfig) -> None:
66
+ test_mount_bucket(custom_config)
67
+ custom_config.hcp_h.upload_file(custom_config.test_file_path, "a_sub_directory/a_file")
68
+
69
+ def test_upload_nonexistent_file(custom_config : CustomConfig) -> None:
70
+ test_mount_bucket(custom_config)
71
+ try:
72
+ custom_config.hcp_h.upload_file("tests/data/aTestFileThatDoesNotExist")
73
+ except:
74
+ assert True
75
+ else: # pragma: no cover
76
+ assert False
77
+
78
+ def test_upload_folder(custom_config : CustomConfig) -> None:
79
+ test_mount_bucket(custom_config)
80
+ custom_config.hcp_h.upload_folder("tests/data/a folder of data/", "a folder of data/")
81
+
82
+ def test_upload_folder_without_mounting(custom_config : CustomConfig) -> None:
83
+ _hcp_h = custom_config.hcp_h
84
+ _without_mounting(_hcp_h, HCPHandler.upload_folder)
85
+
86
+ def test_upload_nonexisting_folder(custom_config : CustomConfig) -> None:
87
+ test_mount_bucket(custom_config)
88
+ try:
89
+ custom_config.hcp_h.upload_folder("tests/data/aFolderOfFilesThatDoesNotExist")
90
+ except:
91
+ assert True
92
+ else: # pragma: no cover
93
+ assert False
94
+
95
+ def test_get_file(custom_config : CustomConfig) -> None:
96
+ test_mount_bucket(custom_config)
97
+ assert custom_config.hcp_h.object_exists("a_sub_directory/a_file")
98
+ assert custom_config.hcp_h.get_object("a_sub_directory/a_file")
99
+
100
+ def test_get_folder_without_mounting(custom_config : CustomConfig) -> None:
101
+ _hcp_h = custom_config.hcp_h
102
+ _without_mounting(_hcp_h, HCPHandler.object_exists)
103
+ _without_mounting(_hcp_h, HCPHandler.get_object)
104
+
105
+ def test_get_file_in_sub_directory(custom_config : CustomConfig) -> None:
106
+ test_mount_bucket(custom_config)
107
+ test_file = Path(custom_config.test_file_path).name
108
+ assert custom_config.hcp_h.object_exists(test_file)
109
+ assert custom_config.hcp_h.get_object(test_file)
110
+
111
+ def test_download_file(custom_config : CustomConfig) -> None:
112
+ test_mount_bucket(custom_config)
113
+ Path(custom_config.result_path).mkdir()
114
+ test_file = Path(custom_config.test_file_path).name
115
+ custom_config.hcp_h.download_file(test_file, custom_config.result_path + test_file)
116
+ assert cmp(custom_config.result_path + test_file, custom_config.test_file_path)
117
+
118
+ def test_download_file_without_mounting(custom_config : CustomConfig) -> None:
119
+ _hcp_h = custom_config.hcp_h
120
+ _without_mounting(_hcp_h, HCPHandler.download_file)
121
+
122
+ def test_download_nonexistent_file(custom_config : CustomConfig) -> None:
123
+ test_mount_bucket(custom_config)
124
+ try:
125
+ custom_config.hcp_h.download_file("aFileThatDoesNotExist", custom_config.result_path + "aFileThatDoesNotExist")
126
+ except:
127
+ assert True
128
+ else: # pragma: no cover
129
+ assert False
130
+
131
+ def test_download_folder(custom_config : CustomConfig) -> None:
132
+ test_mount_bucket(custom_config)
133
+ custom_config.hcp_h.download_folder("a folder of data/", custom_config.result_path)
134
+
135
+ def test_search_in_bucket(custom_config : CustomConfig) -> None:
136
+ test_mount_bucket(custom_config)
137
+ test_file = Path(custom_config.test_file_path).name
138
+ custom_config.hcp_h.search_in_bucket(test_file)
139
+
140
+ def test_search_in_bucket_without_mounting(custom_config : CustomConfig) -> None:
141
+ _hcp_h = custom_config.hcp_h
142
+ _without_mounting(_hcp_h, HCPHandler.search_in_bucket)
143
+
144
+ def test_fuzzy_search_in_bucket(custom_config : CustomConfig) -> None:
145
+ test_mount_bucket(custom_config)
146
+ test_file = Path(custom_config.test_file_path).name
147
+ custom_config.hcp_h.fuzzy_search_in_bucket(test_file)
148
+
149
+ def test_fuzzy_search_in_bucket_without_mounting(custom_config : CustomConfig) -> None:
150
+ _hcp_h = custom_config.hcp_h
151
+ _without_mounting(_hcp_h, HCPHandler.fuzzy_search_in_bucket)
152
+
153
+ def test_get_object_acl(custom_config : CustomConfig) -> None:
154
+ test_mount_bucket(custom_config)
155
+ test_file = Path(custom_config.test_file_path).name
156
+ custom_config.hcp_h.get_object_acl(test_file)
157
+
158
+ def test_get_object_acl_without_mounting(custom_config : CustomConfig) -> None:
159
+ _hcp_h = custom_config.hcp_h
160
+ _without_mounting(_hcp_h, HCPHandler.get_object_acl)
161
+
162
+ def test_get_bucket_acl(custom_config : CustomConfig) -> None:
163
+ test_mount_bucket(custom_config)
164
+ custom_config.hcp_h.get_bucket_acl()
165
+
166
+ def test_get_bucket_acl_without_mounting(custom_config : CustomConfig) -> None:
167
+ _hcp_h = custom_config.hcp_h
168
+ _without_mounting(_hcp_h, HCPHandler.get_bucket_acl)
169
+
170
+ # ------------------ Possibly future ACL tests ---------------------------------
171
+
172
+ #def test_modify_single_object_acl(custom_config : CustomConfig) -> None:
173
+ # test_mount_bucket(custom_config)
174
+ # custom_config.hcp_h.modify_single_object_acl()
175
+ #
176
+ #def test_modify_single_bucket_acl(custom_config : CustomConfig) -> None:
177
+ # test_mount_bucket(custom_config)
178
+ # custom_config.hcp_h.modify_single_bucket_acl()
179
+ #
180
+ #def test_modify_object_acl(custom_config : CustomConfig) -> None:
181
+ # test_mount_bucket(custom_config)
182
+ # custom_config.hcp_h.modify_object_acl()
183
+ #
184
+ #def test_modify_bucket_acl(custom_config : CustomConfig) -> None:
185
+ # test_mount_bucket(custom_config)
186
+ # custom_config.hcp_h.modify_bucket_acl()
187
+
188
+ # ------------------------------------------------------------------------------
189
+
190
+ def test_delete_file(custom_config : CustomConfig) -> None:
191
+ test_mount_bucket(custom_config)
192
+ test_file = Path(custom_config.test_file_path).name
193
+ custom_config.hcp_h.delete_object(test_file)
194
+ custom_config.hcp_h.delete_object("a_sub_directory/a_file")
195
+ custom_config.hcp_h.delete_object("a_sub_directory")
196
+
197
+ def test_delete_file_without_mounting(custom_config : CustomConfig) -> None:
198
+ _hcp_h = custom_config.hcp_h
199
+ _without_mounting(_hcp_h, HCPHandler.delete_object)
200
+
201
+ def test_delete_folder_with_sub_directory(custom_config : CustomConfig) -> None:
202
+ test_mount_bucket(custom_config)
203
+ custom_config.hcp_h.upload_file(custom_config.test_file_path, "a folder of data/a sub dir/a file")
204
+ try:
205
+ custom_config.hcp_h.delete_folder("a folder of data/")
206
+ except:
207
+ assert True
208
+ else: # pragma: no cover
209
+ assert False
210
+ custom_config.hcp_h.delete_folder("a folder of data/a sub dir/")
211
+
212
+ def test_delete_folder(custom_config : CustomConfig) -> None:
213
+ test_mount_bucket(custom_config)
214
+ custom_config.hcp_h.delete_folder("a folder of data/")
215
+
216
+ def test_delete_folder_without_mounting(custom_config : CustomConfig) -> None:
217
+ _hcp_h = custom_config.hcp_h
218
+ _without_mounting(_hcp_h, HCPHandler.delete_folder)
219
+
220
+ def test_delete_nonexistent_files(custom_config : CustomConfig) -> None:
221
+ test_mount_bucket(custom_config)
222
+ custom_config.hcp_h.delete_objects(["some", "files", "that", "does", "not", "exist"])
@@ -1,216 +0,0 @@
1
-
2
- from typing import Callable
3
- from NGPIris.hcp import HCPHandler
4
- from configparser import ConfigParser
5
- from pathlib import Path
6
- from shutil import rmtree
7
- from filecmp import cmp
8
-
9
- hcp_h = HCPHandler("credentials/testCredentials.json")
10
-
11
- ini_config = ConfigParser()
12
- ini_config.read("tests/test_conf.ini")
13
-
14
- test_bucket = ini_config.get("hcp_tests", "bucket")
15
-
16
- test_file = ini_config.get("hcp_tests","data_test_file")
17
- test_file_path = "tests/data/" + test_file
18
-
19
- result_path = "tests/data/results/"
20
-
21
- def _without_mounting(test : Callable) -> None:
22
- try:
23
- test()
24
- except:
25
- assert True
26
- else: # pragma: no cover
27
- assert False
28
-
29
- def test_list_buckets() -> None:
30
- assert hcp_h.list_buckets()
31
-
32
- def test_mount_bucket() -> None:
33
- hcp_h.mount_bucket(test_bucket)
34
-
35
- def test_mount_nonexisting_bucket() -> None:
36
- try:
37
- hcp_h.mount_bucket("aBucketThatDoesNotExist")
38
- except:
39
- assert True
40
- else: # pragma: no cover
41
- assert False
42
-
43
- def test_test_connection() -> None:
44
- test_mount_bucket()
45
- hcp_h.test_connection()
46
-
47
- def test_test_connection_with_bucket_name() -> None:
48
- hcp_h.test_connection(bucket_name = test_bucket)
49
-
50
- def test_test_connection_without_mounting_bucket() -> None:
51
- _hcp_h = HCPHandler("credentials/testCredentials.json")
52
- try:
53
- _hcp_h.test_connection()
54
- except:
55
- assert True
56
- else: # pragma: no cover
57
- assert False
58
-
59
- def test_list_objects() -> None:
60
- test_mount_bucket()
61
- assert type(list(hcp_h.list_objects())) == list
62
-
63
- def test_list_objects_without_mounting() -> None:
64
- _hcp_h = HCPHandler("credentials/testCredentials.json")
65
- _without_mounting(_hcp_h.list_objects)
66
-
67
- def test_upload_file() -> None:
68
- test_mount_bucket()
69
- hcp_h.upload_file(test_file_path)
70
-
71
- def test_upload_file_without_mounting() -> None:
72
- _hcp_h = HCPHandler("credentials/testCredentials.json")
73
- _without_mounting(_hcp_h.upload_file)
74
-
75
- def test_upload_file_in_sub_directory() -> None:
76
- test_mount_bucket()
77
- hcp_h.upload_file(test_file_path, "a_sub_directory/a_file")
78
-
79
- def test_upload_nonexistent_file() -> None:
80
- test_mount_bucket()
81
- try:
82
- hcp_h.upload_file("tests/data/aTestFileThatDoesNotExist")
83
- except:
84
- assert True
85
- else: # pragma: no cover
86
- assert False
87
-
88
- def test_upload_folder() -> None:
89
- test_mount_bucket()
90
- hcp_h.upload_folder("tests/data/a folder of data/", "a folder of data/")
91
-
92
- def test_upload_folder_without_mounting() -> None:
93
- _hcp_h = HCPHandler("credentials/testCredentials.json")
94
- _without_mounting(_hcp_h.upload_folder)
95
-
96
- def test_upload_nonexisting_folder() -> None:
97
- test_mount_bucket()
98
- try:
99
- hcp_h.upload_folder("tests/data/aFolderOfFilesThatDoesNotExist")
100
- except:
101
- assert True
102
- else: # pragma: no cover
103
- assert False
104
-
105
- def test_get_file() -> None:
106
- test_mount_bucket()
107
- assert hcp_h.object_exists("a_sub_directory/a_file")
108
- assert hcp_h.get_object("a_sub_directory/a_file")
109
-
110
- def test_get_folder_without_mounting() -> None:
111
- _hcp_h = HCPHandler("credentials/testCredentials.json")
112
- _without_mounting(_hcp_h.object_exists)
113
- _without_mounting(_hcp_h.get_object)
114
-
115
- def test_get_file_in_sub_directory() -> None:
116
- test_mount_bucket()
117
- assert hcp_h.object_exists(test_file)
118
- assert hcp_h.get_object(test_file)
119
-
120
- def test_download_file() -> None:
121
- test_mount_bucket()
122
- Path(result_path).mkdir()
123
- hcp_h.download_file(test_file, result_path + test_file)
124
- assert cmp(result_path + test_file, test_file_path)
125
-
126
- def test_download_file_without_mounting() -> None:
127
- _hcp_h = HCPHandler("credentials/testCredentials.json")
128
- _without_mounting(_hcp_h.download_file)
129
-
130
- def test_download_nonexistent_file() -> None:
131
- test_mount_bucket()
132
- try:
133
- hcp_h.download_file("aFileThatDoesNotExist", result_path + "aFileThatDoesNotExist")
134
- except:
135
- assert True
136
- else: # pragma: no cover
137
- assert False
138
-
139
- def test_download_folder() -> None:
140
- test_mount_bucket()
141
- hcp_h.download_folder("a folder of data/", result_path)
142
-
143
- def test_search_objects_in_bucket() -> None:
144
- test_mount_bucket()
145
- hcp_h.search_objects_in_bucket(test_file)
146
-
147
- def test_search_objects_in_bucket_without_mounting() -> None:
148
- _hcp_h = HCPHandler("credentials/testCredentials.json")
149
- _without_mounting(_hcp_h.search_objects_in_bucket)
150
-
151
- def test_get_object_acl() -> None:
152
- test_mount_bucket()
153
- hcp_h.get_object_acl(test_file)
154
-
155
- def test_get_object_acl_without_mounting() -> None:
156
- _hcp_h = HCPHandler("credentials/testCredentials.json")
157
- _without_mounting(_hcp_h.get_object_acl)
158
-
159
- def test_get_bucket_acl() -> None:
160
- test_mount_bucket()
161
- hcp_h.get_bucket_acl()
162
-
163
- def test_get_bucket_acl_without_mounting() -> None:
164
- _hcp_h = HCPHandler("credentials/testCredentials.json")
165
- _without_mounting(_hcp_h.get_bucket_acl)
166
-
167
- #def test_modify_single_object_acl() -> None:
168
- # test_mount_bucket()
169
- # hcp_h.modify_single_object_acl()
170
- #
171
- #def test_modify_single_bucket_acl() -> None:
172
- # test_mount_bucket()
173
- # hcp_h.modify_single_bucket_acl()
174
- #
175
- #def test_modify_object_acl() -> None:
176
- # test_mount_bucket()
177
- # hcp_h.modify_object_acl()
178
- #
179
- #def test_modify_bucket_acl() -> None:
180
- # test_mount_bucket()
181
- # hcp_h.modify_bucket_acl()
182
-
183
- def test_delete_file() -> None:
184
- test_mount_bucket()
185
- hcp_h.delete_object(test_file)
186
- hcp_h.delete_object("a_sub_directory/a_file")
187
- hcp_h.delete_object("a_sub_directory")
188
-
189
- def test_delete_file_without_mounting() -> None:
190
- _hcp_h = HCPHandler("credentials/testCredentials.json")
191
- _without_mounting(_hcp_h.delete_object)
192
-
193
- def test_delete_folder_with_sub_directory() -> None:
194
- test_mount_bucket()
195
- hcp_h.upload_file(test_file_path, "a folder of data/a sub dir/a file")
196
- try:
197
- hcp_h.delete_folder("a folder of data/")
198
- except:
199
- assert True
200
- else: # pragma: no cover
201
- assert False
202
- hcp_h.delete_folder("a folder of data/a sub dir/")
203
-
204
- def test_delete_folder() -> None:
205
- test_mount_bucket()
206
- hcp_h.delete_folder("a folder of data/")
207
-
208
- def test_delete_folder_without_mounting() -> None:
209
- _hcp_h = HCPHandler("credentials/testCredentials.json")
210
- _without_mounting(_hcp_h.delete_folder)
211
-
212
- def test_delete_nonexistent_files() -> None:
213
- hcp_h.delete_objects(["some", "files", "that", "does", "not", "exist"])
214
-
215
- def test_clean_up() -> None:
216
- rmtree(result_path)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes