pyegeria 5.4.0.20__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.
@@ -114,12 +114,15 @@ def print_bullet_list(items)->Text:
114
114
  def flatten_dict_to_string(d: dict) -> str:
115
115
  """Flatten a dictionary into a string and replace quotes with backticks."""
116
116
  try:
117
- flat_string = "\n\t".join(
118
- # Change replace(\"'\", '`') to replace("'", '`')
119
- f"\t* {key}=`{str(value).replace('\"', '`').replace("'", '`')}`"
120
- for key, value in d.items()
121
- )
122
- return flat_string
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 ""
123
126
  except Exception as e:
124
127
  # Corrected syntax for exception chaining
125
128
  raise Exception("Error flattening dictionary") from e
@@ -380,17 +383,17 @@ def print_basic_exception(e: PyegeriaException):
380
383
  if isinstance(e, PyegeriaException):
381
384
  table.add_row("HTTP Code", str(e.response_code))
382
385
  table.add_row("Egeria Code", str(related_code))
383
- 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 ""
384
387
  table.add_row("Request URL", str(e.response_url))
385
388
  table.add_row("Egeria Message",
386
- 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)
387
390
  table.add_row("Egeria User Action",
388
- 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)
389
392
 
390
- 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
391
394
  table.add_row("Pyegeria Exception", exception_msg_id)
392
- table.add_row("Pyegeria Message",
393
- f"\n\t{e.error_details['message_template'].format(exception_msg_id)}\n")
395
+ table.add_row("Pyegeria Message", e.message)
396
+ console.print(table)
394
397
 
395
398
 
396
399
  console.print(table)
@@ -408,7 +411,7 @@ def print_validation_error(e: ValidationError):
408
411
 
409
412
  for error in e.errors():
410
413
  error_type = error["type"]
411
- attribute = " ".join(error["loc"])
414
+ attribute = " ".join(str(part) for part in error["loc"])
412
415
  message = error["msg"]
413
416
  table.add_row(error_type, attribute, message)
414
417
 
@@ -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={"classification_name": "DigitalProducts"},
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={"classification_name": "DataDictionary"},
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={"classification_name": "DataSpec"},
291
+ spec_params={"initial_classifications": "DataSpec"},
292
292
  )]
293
293
  ),
294
294