hcs-core 0.1.287__tar.gz → 0.1.288__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 (70) hide show
  1. {hcs_core-0.1.287 → hcs_core-0.1.288}/PKG-INFO +1 -1
  2. hcs_core-0.1.288/hcs_core/__init__.py +1 -0
  3. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/cli_options.py +1 -1
  4. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/data_util.py +19 -0
  5. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/recent.py +2 -2
  6. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/util.py +16 -3
  7. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/sglib/ez_client.py +2 -1
  8. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/sglib/login_support.py +1 -0
  9. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/util/versions.py +2 -2
  10. hcs_core-0.1.287/hcs_core/__init__.py +0 -1
  11. {hcs_core-0.1.287 → hcs_core-0.1.288}/.gitignore +0 -0
  12. {hcs_core-0.1.287 → hcs_core-0.1.288}/README.md +0 -0
  13. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/__init__.py +0 -0
  14. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/_init.py +0 -0
  15. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/built_in_cmds/__init__.py +0 -0
  16. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/built_in_cmds/_ut.py +0 -0
  17. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/built_in_cmds/context.py +0 -0
  18. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/built_in_cmds/profile.py +0 -0
  19. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/cli_processor.py +0 -0
  20. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/cmd_util.py +0 -0
  21. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/config.py +0 -0
  22. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/context.py +0 -0
  23. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/dispatcher.py +0 -0
  24. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/duration.py +0 -0
  25. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/extension.py +0 -0
  26. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/fn_util.py +0 -0
  27. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/fstore.py +0 -0
  28. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/jsondot.py +0 -0
  29. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/logger.py +0 -0
  30. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/profile.py +0 -0
  31. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/profile_store.py +0 -0
  32. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/state.py +0 -0
  33. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/task_schd.py +0 -0
  34. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/template_util.py +0 -0
  35. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/timeutil.py +0 -0
  36. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/ctxp/var_template.py +0 -0
  37. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/plan/__init__.py +0 -0
  38. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/plan/actions.py +0 -0
  39. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/plan/base_provider.py +0 -0
  40. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/plan/context.py +0 -0
  41. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/plan/core.py +0 -0
  42. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/plan/dag.py +0 -0
  43. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/plan/helper.py +0 -0
  44. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/plan/kop.py +0 -0
  45. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/plan/provider/__init__.py +0 -0
  46. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/plan/provider/dev/__init__.py +0 -0
  47. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/plan/provider/dev/_prepare.py +0 -0
  48. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/plan/provider/dev/dummy.py +0 -0
  49. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/plan/provider/dev/fibonacci.py +0 -0
  50. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/sglib/__init__.py +0 -0
  51. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/sglib/auth.py +0 -0
  52. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/sglib/cli_options.py +0 -0
  53. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/sglib/client_util.py +0 -0
  54. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/sglib/csp.py +0 -0
  55. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/sglib/hcs_client.py +0 -0
  56. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/sglib/init.py +0 -0
  57. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/sglib/payload_util.py +0 -0
  58. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/sglib/requtil.py +0 -0
  59. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/sglib/utils.py +0 -0
  60. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/util/__init__.py +0 -0
  61. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/util/check_license.py +0 -0
  62. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/util/duration.py +0 -0
  63. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/util/exit.py +0 -0
  64. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/util/hcs_constants.py +0 -0
  65. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/util/job_view.py +0 -0
  66. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/util/pki_util.py +0 -0
  67. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/util/query_util.py +0 -0
  68. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/util/scheduler.py +0 -0
  69. {hcs_core-0.1.287 → hcs_core-0.1.288}/hcs_core/util/ssl_util.py +0 -0
  70. {hcs_core-0.1.287 → hcs_core-0.1.288}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hcs-core
3
- Version: 0.1.287
3
+ Version: 0.1.288
4
4
  Summary: Horizon Cloud Service CLI module.
5
5
  Project-URL: Homepage, https://github.com/euc-eng/hcs-cli
6
6
  Project-URL: Bug Tracker, https://github.com/euc-eng/hcs-cli/issues
@@ -0,0 +1 @@
1
+ __version__ = "0.1.288"
@@ -27,7 +27,7 @@ verbose = click.option(
27
27
  output = click.option(
28
28
  "--output",
29
29
  "-o",
30
- type=click.Choice(["json", "json-compact", "yaml", "text", "table"]),
30
+ type=click.Choice(["json", "json-compact", "yaml", "text", "table"], case_sensitive=False),
31
31
  default=None,
32
32
  hidden=True,
33
33
  help="Specify output format",
@@ -391,6 +391,25 @@ def get_common_items(iter1, iter2):
391
391
  return common_items
392
392
 
393
393
 
394
+ def get_delta(dict_base, dict_update):
395
+ delta = {}
396
+ for k, v2 in dict_update.items():
397
+ v1 = dict_base.get(k)
398
+ if not deep_equals(v1, v2):
399
+ delta[k] = v2
400
+ return delta
401
+
402
+
403
+ def deep_equals(v1, v2):
404
+ if v1 is None and v2 is None:
405
+ return True
406
+ if v1 is None or v2 is None:
407
+ return False
408
+ if v1 == v2:
409
+ return True
410
+ return json.dumps(v1) == json.dumps(v2)
411
+
412
+
394
413
  def _evaluate(value, smart_search):
395
414
  # If we found an exact match, return 2 immediately
396
415
  if value == smart_search:
@@ -79,9 +79,9 @@ def of(k: str):
79
79
 
80
80
  class helper:
81
81
  @staticmethod
82
- def default_list(array: list, name: str):
82
+ def default_list(array: list, name: str, field_name: str = "id"):
83
83
  with of(name) as r:
84
84
  if len(array) == 1:
85
- r.set(array[0]["id"])
85
+ r.set(array[0][field_name])
86
86
  else:
87
87
  r.unset()
@@ -89,7 +89,18 @@ def print_output(data: Any, args: dict, file=sys.stdout):
89
89
  if isinstance(data, list):
90
90
  text = ""
91
91
  for i in data:
92
- line = i if type(i) is str else json.dumps(i)
92
+ t = type(i)
93
+ if t is str:
94
+ line = i
95
+ elif isinstance(i, dict):
96
+ if len(i) == 0:
97
+ continue
98
+ if len(i) == 1:
99
+ line = str(next(iter(i.values())))
100
+ else:
101
+ line = json.dumps(i)
102
+ else:
103
+ line = json.dumps(i)
93
104
  text += line + "\n"
94
105
  elif isinstance(data, dict):
95
106
  text = json.dumps(data, indent=4)
@@ -319,10 +330,12 @@ def format_table(data: list, fields_mapping: dict, columns_to_sum: list = None):
319
330
  if isinstance(v, str):
320
331
  v = strip_ansi(v)
321
332
  v = int(v)
322
- elif isinstance(v, int):
333
+ elif isinstance(v, int) or isinstance(v, float):
323
334
  pass
335
+ elif v is None:
336
+ continue
324
337
  else:
325
- raise Exception(f"Unexpected cell value type. Type={type(v)}, value={v}")
338
+ raise Exception(f"Unexpected cell value type. Type={type(v)}, value={v}, col={col_name}")
326
339
  total += v
327
340
  footer[col_index] = total
328
341
  separator = ["-" * len(header) for header in headers]
@@ -173,11 +173,12 @@ class EzClient:
173
173
  files=None,
174
174
  headers: dict = None,
175
175
  type: Optional[Type[BaseModel]] = None,
176
+ timeout: float = 30.0,
176
177
  ):
177
178
  # import json as jsonlib
178
179
  # print(url, jsonlib.dumps(json, indent=4))
179
180
  try:
180
- resp = self._client().post(url, json=json, content=text, files=files, headers=headers)
181
+ resp = self._client().post(url, json=json, content=text, files=files, headers=headers, timeout=timeout)
181
182
  except httpx.HTTPStatusError as e:
182
183
  _raise_http_error(e)
183
184
  data = _parse_resp(resp)
@@ -33,6 +33,7 @@ _callback_url = "/hcs-cli/oauth/callback"
33
33
 
34
34
  _public_client_ids = {
35
35
  "production": "ldjmWbBAUcSB1w3HSbzoYcdKoloYFqT2dWK",
36
+ # "production": "WbvEYXK4abljPJUuY2zODLpOaX5ddH2uhMX", #collie mobile
36
37
  "staging": "BbwHlgWt0vFwPUZMJTb5IKltynXjDmb46IO",
37
38
  }
38
39
 
@@ -15,9 +15,9 @@ limitations under the License.
15
15
 
16
16
  import logging
17
17
  import time
18
+ from importlib.metadata import version
18
19
 
19
20
  import httpx
20
- import pkg_resources
21
21
  from packaging.version import Version
22
22
 
23
23
  import hcs_core
@@ -43,7 +43,7 @@ def check_upgrade():
43
43
 
44
44
 
45
45
  def get_version():
46
- return pkg_resources.require("hcs-cli")[0].version
46
+ return version("hcs-cli")
47
47
 
48
48
 
49
49
  def get_latest_version() -> Version:
@@ -1 +0,0 @@
1
- __version__ = "0.1.287"
File without changes
File without changes
File without changes