hcs-core 0.1.287__py3-none-any.whl → 0.1.288__py3-none-any.whl
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.
- hcs_core/__init__.py +1 -1
- hcs_core/ctxp/cli_options.py +1 -1
- hcs_core/ctxp/data_util.py +19 -0
- hcs_core/ctxp/recent.py +2 -2
- hcs_core/ctxp/util.py +16 -3
- hcs_core/sglib/ez_client.py +2 -1
- hcs_core/sglib/login_support.py +1 -0
- hcs_core/util/versions.py +2 -2
- {hcs_core-0.1.287.dist-info → hcs_core-0.1.288.dist-info}/METADATA +1 -1
- {hcs_core-0.1.287.dist-info → hcs_core-0.1.288.dist-info}/RECORD +11 -11
- {hcs_core-0.1.287.dist-info → hcs_core-0.1.288.dist-info}/WHEEL +0 -0
hcs_core/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.288"
|
hcs_core/ctxp/cli_options.py
CHANGED
|
@@ -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",
|
hcs_core/ctxp/data_util.py
CHANGED
|
@@ -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:
|
hcs_core/ctxp/recent.py
CHANGED
|
@@ -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][
|
|
85
|
+
r.set(array[0][field_name])
|
|
86
86
|
else:
|
|
87
87
|
r.unset()
|
hcs_core/ctxp/util.py
CHANGED
|
@@ -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
|
-
|
|
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]
|
hcs_core/sglib/ez_client.py
CHANGED
|
@@ -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)
|
hcs_core/sglib/login_support.py
CHANGED
hcs_core/util/versions.py
CHANGED
|
@@ -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
|
|
46
|
+
return version("hcs-cli")
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
def get_latest_version() -> Version:
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
hcs_core/__init__.py,sha256=
|
|
1
|
+
hcs_core/__init__.py,sha256=h2YaDwqNzDQolRs8e5QZZuOdmuGRXaYq2mLZASylOIc,24
|
|
2
2
|
hcs_core/ctxp/__init__.py,sha256=bHVHhJP10Luz1a3Kk3zFx14dAO4SY6Q20Lrv8rNWWGc,1075
|
|
3
3
|
hcs_core/ctxp/_init.py,sha256=yq46VOty4zs_WcLt1SrtePxbW8S4RIz4YUCP3xIBvCA,2797
|
|
4
|
-
hcs_core/ctxp/cli_options.py,sha256=
|
|
4
|
+
hcs_core/ctxp/cli_options.py,sha256=5CkwKVIUNJxumBHUmrefawiIZR5Yf3bWEcpJBaEMuDU,2554
|
|
5
5
|
hcs_core/ctxp/cli_processor.py,sha256=2RhBz7zFm2UDRwbMDwBpeAQQCt4sjZJzn1nePAcMA_o,7329
|
|
6
6
|
hcs_core/ctxp/cmd_util.py,sha256=_-VwQSmkfi52qWC3uHQI06mSiIPfsZroDruTDYHXiMA,3119
|
|
7
7
|
hcs_core/ctxp/config.py,sha256=vRdzPxi3Yrt04cnR6b5mJwEOtYBh21qvmlSSsgyGoI4,931
|
|
8
8
|
hcs_core/ctxp/context.py,sha256=y0ouOzXyYTg9MOuWjzjls9WfOKYaO31_MGJJ2S-Y9p4,3375
|
|
9
|
-
hcs_core/ctxp/data_util.py,sha256=
|
|
9
|
+
hcs_core/ctxp/data_util.py,sha256=v041qG3UH8ff4iLVY4oaeFDT1jBdFhUNOnGLraPMT-g,14812
|
|
10
10
|
hcs_core/ctxp/dispatcher.py,sha256=GAK-jGXDpyX0C88oRDtDi4yeM0qlvID96k98z_vqJkg,2261
|
|
11
11
|
hcs_core/ctxp/duration.py,sha256=xmAw-nKnul3VeSXzvbGZ-W2ByBwyK23KxLLm3_aFW_M,2117
|
|
12
12
|
hcs_core/ctxp/extension.py,sha256=UqlDCXJMRKXcoceVak8hVGI_7HggjUWYSgKOFbGVetU,1636
|
|
@@ -16,12 +16,12 @@ hcs_core/ctxp/jsondot.py,sha256=U2_ToR8j3-hex75X3OSqTgADiw5cqjRDVO38-IbvapM,1136
|
|
|
16
16
|
hcs_core/ctxp/logger.py,sha256=6Sh1WXUrjrQNU7K6zUlBzE34fIS6o6oMU3eqSknUOEo,6321
|
|
17
17
|
hcs_core/ctxp/profile.py,sha256=DQUQXThHNZa49tDcyGfh-w658CJBE1YIKmNHWXSDaiw,7673
|
|
18
18
|
hcs_core/ctxp/profile_store.py,sha256=v4RvKSaKSJhAt5rEGbC6v-NfaI3N67YffPm-qlrQWdg,1566
|
|
19
|
-
hcs_core/ctxp/recent.py,sha256=
|
|
19
|
+
hcs_core/ctxp/recent.py,sha256=uKSEdU4L2szbyl-5nYLa3bigZSvSPW8G24Tuk_wYMck,1797
|
|
20
20
|
hcs_core/ctxp/state.py,sha256=gjcMRVONKBq7WiFQo-xca1726ngZe90mnPrF3vbXDrU,1634
|
|
21
21
|
hcs_core/ctxp/task_schd.py,sha256=mvZMeKDSSo2p7VidSoZY1XZj433TQn_YF9SGJEzl9lg,4586
|
|
22
22
|
hcs_core/ctxp/template_util.py,sha256=XslvIuRBlTVsUW0Y9M_D8gUPc1jWq6X2p4At2VAe1KU,731
|
|
23
23
|
hcs_core/ctxp/timeutil.py,sha256=RyRrIRdFHbIghdB8wbC8VdABvc7hki2v51b1x2JvHgo,445
|
|
24
|
-
hcs_core/ctxp/util.py,sha256=
|
|
24
|
+
hcs_core/ctxp/util.py,sha256=FnJMbKMCnGDGc579VSrGsnWy-0H1GEnLioLcFvH6UcM,10869
|
|
25
25
|
hcs_core/ctxp/var_template.py,sha256=cTjj1UJ58ac6s5z4Oh5hSDQwKixq-rdbCF1D8akjAo0,3219
|
|
26
26
|
hcs_core/ctxp/built_in_cmds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
27
|
hcs_core/ctxp/built_in_cmds/_ut.py,sha256=e50XBmPim2qRe0RYk_XAuRz1HWYyLJuMu-6dVxWR_fQ,3356
|
|
@@ -45,10 +45,10 @@ hcs_core/sglib/auth.py,sha256=otsiBEvKae3B0-bPt5Ggir7ceTRLWG1x7ZaSblHisdA,6443
|
|
|
45
45
|
hcs_core/sglib/cli_options.py,sha256=NvdiHpX_o6IYPEM8cQYLb_R7T4aiXVvYLqn6Vk4Q2-Y,1761
|
|
46
46
|
hcs_core/sglib/client_util.py,sha256=ZCXmNfmUL4_iry4yU2bPWL0dLLNIGu3zp541cFt6Or0,10876
|
|
47
47
|
hcs_core/sglib/csp.py,sha256=anZqbQLIZw831PgW9Z4pweqfAeBH7rXPIAkwkyPkfGY,8054
|
|
48
|
-
hcs_core/sglib/ez_client.py,sha256=
|
|
48
|
+
hcs_core/sglib/ez_client.py,sha256=iUhhKAeo-9Mm3JQdYJROXxvAkZypCLSNvraE5DaP3n8,7640
|
|
49
49
|
hcs_core/sglib/hcs_client.py,sha256=pxRZQ79ABhOyihAI8oOeTxw2dXkce5-NyRkJAoo0OL0,888
|
|
50
50
|
hcs_core/sglib/init.py,sha256=w_0ZU70Q1TGbSZsqSi7ewKQqpExFlepOT7mIqH0wnho,310
|
|
51
|
-
hcs_core/sglib/login_support.py,sha256=
|
|
51
|
+
hcs_core/sglib/login_support.py,sha256=tSkfmThubbWDUFLfx0hzdHp_QW0TR3gYISzvw6FKpjs,7561
|
|
52
52
|
hcs_core/sglib/payload_util.py,sha256=Hnj7rjzrQ1j5gpbrwZX34biN8MIZjy6dOJZ63ulmzdw,685
|
|
53
53
|
hcs_core/sglib/requtil.py,sha256=O37DrD4VVBmmRkkHJLbDtPfFq8l6fLZwYZggt2FTEFc,920
|
|
54
54
|
hcs_core/sglib/utils.py,sha256=FLgB8M5EiS3WhCzX5xUA9aFzB5jKQI8pqxtrmE4SsjQ,3164
|
|
@@ -62,7 +62,7 @@ hcs_core/util/pki_util.py,sha256=Lt3-IzIoGcaQKNE7KUszxR7JSZkpXduVZJ262TszsIs,668
|
|
|
62
62
|
hcs_core/util/query_util.py,sha256=5bh3bUVIQuY9qerndfuyfyzkTExYJ8zD0_e3PSN7y-4,3142
|
|
63
63
|
hcs_core/util/scheduler.py,sha256=bPpCmGUL1UctJMfLPAg-h4Hl2YZr96FiI78-G_Usn08,2958
|
|
64
64
|
hcs_core/util/ssl_util.py,sha256=MvU102fGwWWh9hhSmLnn1qQIWuD6TjZnN0iH0MXUtW0,1239
|
|
65
|
-
hcs_core/util/versions.py,sha256=
|
|
66
|
-
hcs_core-0.1.
|
|
67
|
-
hcs_core-0.1.
|
|
68
|
-
hcs_core-0.1.
|
|
65
|
+
hcs_core/util/versions.py,sha256=urMtShfoBx_Eqq0D-450LP0i-rW447k9yX8q8j5H_qA,1721
|
|
66
|
+
hcs_core-0.1.288.dist-info/METADATA,sha256=OfTNqAnTG99Mi9CeE9Sikd8DtFGU1BfNBjVb43CRM1M,1875
|
|
67
|
+
hcs_core-0.1.288.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
68
|
+
hcs_core-0.1.288.dist-info/RECORD,,
|
|
File without changes
|