pyegeria 5.4.0.19__py3-none-any.whl → 5.4.0.22__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.
- pyegeria/_client_new.py +401 -87
- pyegeria/_exceptions_new.py +35 -13
- pyegeria/_output_formats.py +3 -3
- pyegeria/collection_manager.py +570 -1386
- pyegeria/collection_manager_omvs.py +1 -1
- pyegeria/models.py +5 -4
- {pyegeria-5.4.0.19.dist-info → pyegeria-5.4.0.22.dist-info}/METADATA +1 -1
- {pyegeria-5.4.0.19.dist-info → pyegeria-5.4.0.22.dist-info}/RECORD +11 -11
- {pyegeria-5.4.0.19.dist-info → pyegeria-5.4.0.22.dist-info}/LICENSE +0 -0
- {pyegeria-5.4.0.19.dist-info → pyegeria-5.4.0.22.dist-info}/WHEEL +0 -0
- {pyegeria-5.4.0.19.dist-info → pyegeria-5.4.0.22.dist-info}/entry_points.txt +0 -0
pyegeria/_exceptions_new.py
CHANGED
@@ -11,6 +11,7 @@ from enum import Enum
|
|
11
11
|
|
12
12
|
from httpx import Response
|
13
13
|
from loguru import logger
|
14
|
+
from pydantic_core import ValidationError
|
14
15
|
from rich.markdown import Markdown
|
15
16
|
from rich.table import Table
|
16
17
|
from rich.text import Text
|
@@ -113,12 +114,15 @@ def print_bullet_list(items)->Text:
|
|
113
114
|
def flatten_dict_to_string(d: dict) -> str:
|
114
115
|
"""Flatten a dictionary into a string and replace quotes with backticks."""
|
115
116
|
try:
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
117
|
+
if d:
|
118
|
+
flat_string = "\n\t".join(
|
119
|
+
# Change replace(\"'\", '`') to replace("'", '`')
|
120
|
+
f"\t* {key}=`{str(value).replace('\"', '`').replace("'", '`')}`"
|
121
|
+
for key, value in d.items()
|
122
|
+
)
|
123
|
+
return flat_string
|
124
|
+
else:
|
125
|
+
return ""
|
122
126
|
except Exception as e:
|
123
127
|
# Corrected syntax for exception chaining
|
124
128
|
raise Exception("Error flattening dictionary") from e
|
@@ -379,19 +383,37 @@ def print_basic_exception(e: PyegeriaException):
|
|
379
383
|
if isinstance(e, PyegeriaException):
|
380
384
|
table.add_row("HTTP Code", str(e.response_code))
|
381
385
|
table.add_row("Egeria Code", str(related_code))
|
382
|
-
table.add_row("Caller Method", e.context.get("caller method", "---"))
|
386
|
+
table.add_row("Caller Method", e.context.get("caller method", "---")) if e.context else ""
|
383
387
|
table.add_row("Request URL", str(e.response_url))
|
384
388
|
table.add_row("Egeria Message",
|
385
|
-
format_dict_to_string(related_response.get('exceptionErrorMessage',"")))
|
389
|
+
format_dict_to_string(related_response.get('exceptionErrorMessage',"")) if isinstance(related_response,dict) else related_response)
|
386
390
|
table.add_row("Egeria User Action",
|
387
|
-
format_dict_to_string(related_response.get('exceptionUserAction',"")))
|
391
|
+
format_dict_to_string(related_response.get('exceptionUserAction',"")) if isinstance(related_response,dict) else related_response)
|
388
392
|
|
389
|
-
exception_msg_id = related_response.get("exceptionErrorMessageId", None)
|
393
|
+
exception_msg_id = related_response.get("exceptionErrorMessageId", None) if isinstance(related_response,dict) else related_response
|
390
394
|
table.add_row("Pyegeria Exception", exception_msg_id)
|
391
|
-
table.add_row("Pyegeria Message",
|
392
|
-
|
395
|
+
table.add_row("Pyegeria Message", e.message)
|
396
|
+
console.print(table)
|
393
397
|
|
394
398
|
|
395
399
|
console.print(table)
|
396
400
|
else:
|
397
|
-
print(f"\n\n\t Not an Pyegeria exception {e}")
|
401
|
+
print(f"\n\n\t Not an Pyegeria exception {e}")
|
402
|
+
|
403
|
+
def print_validation_error(e: ValidationError):
|
404
|
+
"""Prints the pydantic validation exception response"""
|
405
|
+
|
406
|
+
table = Table(title=f"Validation Error for {e.title}", show_lines=True, header_style="bold", box=box.HEAVY_HEAD)
|
407
|
+
table.caption = "Pydantic Validation Error"
|
408
|
+
table.add_column("Type", justify="center")
|
409
|
+
table.add_column("Attribute", justify="center")
|
410
|
+
table.add_column("Message", justify="center")
|
411
|
+
|
412
|
+
for error in e.errors():
|
413
|
+
error_type = error["type"]
|
414
|
+
attribute = " ".join(str(part) for part in error["loc"])
|
415
|
+
message = error["msg"]
|
416
|
+
table.add_row(error_type, attribute, message)
|
417
|
+
|
418
|
+
|
419
|
+
console.print(table)
|
pyegeria/_output_formats.py
CHANGED
@@ -248,7 +248,7 @@ output_format_sets = FormatSetDict({
|
|
248
248
|
action=[ActionParameter(
|
249
249
|
function="CollectionManager.find_collections",
|
250
250
|
user_params=["search_string"],
|
251
|
-
spec_params={"
|
251
|
+
spec_params={"initial_classifications": "DigitalProducts"},
|
252
252
|
)]
|
253
253
|
),
|
254
254
|
|
@@ -269,7 +269,7 @@ output_format_sets = FormatSetDict({
|
|
269
269
|
action=[ActionParameter(
|
270
270
|
function="CollectionManager.find_collections",
|
271
271
|
user_params=["search_string"],
|
272
|
-
spec_params={"
|
272
|
+
spec_params={"initial_classifications": "DataDictionary"},
|
273
273
|
)]
|
274
274
|
),
|
275
275
|
|
@@ -288,7 +288,7 @@ output_format_sets = FormatSetDict({
|
|
288
288
|
action=[ActionParameter(
|
289
289
|
function="CollectionManager.find_collections",
|
290
290
|
user_params=["search_string"],
|
291
|
-
spec_params={"
|
291
|
+
spec_params={"initial_classifications": "DataSpec"},
|
292
292
|
)]
|
293
293
|
),
|
294
294
|
|