NGPIris 5.4.2.dev6__tar.gz → 5.4.3__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 (54) hide show
  1. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris/cli/__init__.py +3 -1
  2. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris/hci/hci.py +30 -3
  3. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris/hci/helpers.py +3 -3
  4. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3/NGPIris.egg-info}/PKG-INFO +1 -1
  5. {ngpiris-5.4.2.dev6/NGPIris.egg-info → ngpiris-5.4.3}/PKG-INFO +1 -1
  6. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/pyproject.toml +1 -1
  7. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/tests/test_hci.py +5 -4
  8. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/LICENSE +0 -0
  9. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/MANIFEST.in +0 -0
  10. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris/__init__.py +0 -0
  11. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris/hci/__init__.py +0 -0
  12. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris/hci/exceptions.py +0 -0
  13. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris/hcp/__init__.py +0 -0
  14. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris/hcp/exceptions.py +0 -0
  15. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris/hcp/hcp.py +0 -0
  16. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris/hcp/helpers.py +0 -0
  17. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris/hcp/statistics.py +0 -0
  18. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris/parse_credentials/__init__.py +0 -0
  19. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris/parse_credentials/parse_credentials.py +0 -0
  20. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris/utils/__init__.py +0 -0
  21. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris/utils/utils.py +0 -0
  22. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris.egg-info/SOURCES.txt +0 -0
  23. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris.egg-info/dependency_links.txt +0 -0
  24. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris.egg-info/entry_points.txt +0 -0
  25. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris.egg-info/requires.txt +0 -0
  26. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/NGPIris.egg-info/top_level.txt +0 -0
  27. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/README.md +0 -0
  28. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/docs/IRIS_5_changelog.md +0 -0
  29. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/docs/Makefile +0 -0
  30. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/docs/NGPIris.cli.rst +0 -0
  31. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/docs/NGPIris.hci.rst +0 -0
  32. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/docs/NGPIris.hcp.rst +0 -0
  33. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/docs/NGPIris.parse_credentials.rst +0 -0
  34. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/docs/NGPIris.rst +0 -0
  35. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/docs/NGPIris.utils.rst +0 -0
  36. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/docs/Tutorial.md +0 -0
  37. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/docs/conf.py +0 -0
  38. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/docs/index.rst +0 -0
  39. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/docs/make.bat +0 -0
  40. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/docs/modules.rst +0 -0
  41. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/setup.cfg +0 -0
  42. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/tests/data/80MB_test_file +0 -0
  43. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/tests/data/a folder of data/80MB_test_file_0 +0 -0
  44. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/tests/data/a folder of data/80MB_test_file_1 +0 -0
  45. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/tests/data/complete_creds_0.json +0 -0
  46. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/tests/data/complete_creds_1.json +0 -0
  47. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/tests/data/complete_creds_2.json +0 -0
  48. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/tests/data/incomplete_creds_0.json +0 -0
  49. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/tests/data/incomplete_creds_1.json +0 -0
  50. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/tests/data/incomplete_creds_2.json +0 -0
  51. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/tests/data/incomplete_creds_3.json +0 -0
  52. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/tests/data/incomplete_creds_4.json +0 -0
  53. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/tests/test_hcp.py +0 -0
  54. {ngpiris-5.4.2.dev6 → ngpiris-5.4.3}/tests/test_parse_credentials.py +0 -0
@@ -6,6 +6,7 @@ from pathlib import Path
6
6
  from boto3 import set_stream_logger
7
7
  from typing import Any, Generator
8
8
  from bitmath import Byte, TiB
9
+ import sys
9
10
 
10
11
  from NGPIris.hcp import HCPHandler
11
12
 
@@ -108,7 +109,8 @@ def upload(context : Context, bucket : str, source : str, destination : str, dry
108
109
  """
109
110
 
110
111
  if equal_parts <= 0:
111
- exit("Error: --equal_parts value must be a positive integer")
112
+ click.echo("Error: --equal_parts value must be a positive integer", err=True)
113
+ sys.exit(1)
112
114
 
113
115
  upload_mode_choice = HCPHandler.UploadMode(upload_mode.lower())
114
116
 
@@ -26,11 +26,13 @@ class HCIHandler:
26
26
  """
27
27
  credentials_handler = CredentialsHandler(credentials_path)
28
28
  self.hci = credentials_handler.hci
29
+
29
30
  self.username = self.hci["username"]
30
31
  self.password = self.hci["password"]
31
32
  self.address = self.hci["address"]
32
33
  self.auth_port = self.hci["auth_port"]
33
34
  self.api_port = self.hci["api_port"]
35
+
34
36
  self.token = ""
35
37
 
36
38
  self.use_ssl = use_ssl
@@ -94,12 +96,12 @@ class HCIHandler:
94
96
 
95
97
  return {}
96
98
 
97
- def raw_query(self, query_dict : dict[str, str]) -> dict:
99
+ def raw_query(self, query_dict : dict[str, str | list | dict]) -> dict:
98
100
  """
99
101
  Make query to an HCI index, with a dictionary
100
102
 
101
103
  :param query_dict: Dictionary consisting of the query
102
- :type query_dict: dict[str, str]
104
+ :type query_dict: dict[str, str | list | dict]
103
105
 
104
106
  :return: Dictionary containing the raw query
105
107
  :rtype: dict
@@ -129,4 +131,29 @@ class HCIHandler:
129
131
  self.api_port,
130
132
  self.token,
131
133
  self.use_ssl
132
- ).json())
134
+ ).json())
135
+
136
+ def query(self, index_name : str, query_string : str = "", facets : list[str] = []) -> dict:
137
+ """
138
+ Make a query to the HCI based on the parameters of this method
139
+
140
+ :param index_name: Name of the index
141
+ :type index_name: str
142
+
143
+ :param query_string: The Solr query string. Defaults to the empty string
144
+ :type query_string: str, optional
145
+
146
+ :param facets: List of facets that should be returned included in the response. Defaults to []
147
+ :type facets: list[str], optional
148
+
149
+ :return: The response in the form of a dictionary
150
+ :rtype: dict
151
+ """
152
+ facetRequests = [{"fieldName" : facet } for facet in facets]
153
+ return self.raw_query(
154
+ {
155
+ "indexName" : index_name,
156
+ "queryString" : query_string,
157
+ "facetRequests" : facetRequests
158
+ }
159
+ )
@@ -44,7 +44,7 @@ def get_index_response(address : str, api_port : str, token : str, use_ssl : boo
44
44
  return response
45
45
 
46
46
  def get_query_response(
47
- query_dict : dict[str, str],
47
+ query_dict : dict[str, str | list | dict],
48
48
  address : str,
49
49
  api_port : str,
50
50
  token : str,
@@ -55,7 +55,7 @@ def get_query_response(
55
55
  Retrieve the query response given the address, API port and token.
56
56
 
57
57
  :param query_dict: The query dictionary
58
- :type query_dict: dict[str, str]
58
+ :type query_dict: dict[str, str | list | dict]
59
59
 
60
60
  :param address: The address where request is to be made
61
61
  :type address: str
@@ -79,7 +79,7 @@ def get_query_response(
79
79
  raise RuntimeError("Field indexName is missing in the query dictionary")
80
80
 
81
81
  url : str = "https://" + address + ":" + api_port + "/api/search/query/" + path_extension
82
- query : dict[str, str] = query_dict
82
+ query : dict[str, str | list | dict] = query_dict
83
83
  headers : dict[str, str] = {
84
84
  "Content-Type": "application/json",
85
85
  "Accept": "application/json",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: NGPIris
3
- Version: 5.4.2.dev6
3
+ Version: 5.4.3
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: NGPIris
3
- Version: 5.4.2.dev6
3
+ Version: 5.4.3
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "NGPIris"
3
- version = "5.4.2.dev6"
3
+ version = "5.4.3"
4
4
  readme = "README.md"
5
5
  dependencies = [
6
6
  "requests >= 2.31.0",
@@ -26,10 +26,11 @@ def test_fail_index_look_up() -> None:
26
26
  def test_make_simple_raw_query() -> None:
27
27
  list_of_indexes = hci_h.list_index_names()
28
28
  arbitrary_index = list_of_indexes[randint(0, len(list_of_indexes) - 1)]
29
- query = {
30
- "indexName" : arbitrary_index
31
- }
32
- result = hci_h.raw_query(query)
29
+ result = hci_h.raw_query(
30
+ {
31
+ "indexName" : arbitrary_index
32
+ }
33
+ )
33
34
  assert result["indexName"] == arbitrary_index
34
35
 
35
36
  def test_raw_query_with_results() -> None:
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