pyegeria 5.4.0.18__py3-none-any.whl → 5.4.0.20__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.
- commands/cat/list_collections.py +6 -6
- commands/ops/load_archive.py +4 -2
- md_processing/md_commands/data_designer_commands.py +5 -5
- md_processing/md_commands/governance_officer_commands.py +1 -1
- md_processing/md_commands/product_manager_commands.py +3 -3
- pyegeria/__init__.py +6 -1
- pyegeria/_client_new.py +47 -10
- pyegeria/_exceptions_new.py +35 -10
- pyegeria/classification_manager_omvs.py +1 -1
- pyegeria/collection_manager.py +6264 -0
- pyegeria/collection_manager_omvs.py +6 -6
- pyegeria/collection_models.py +168 -0
- pyegeria/load_config.py +4 -4
- pyegeria/models.py +468 -0
- pyegeria/runtime_manager_omvs.py +12 -9
- {pyegeria-5.4.0.18.dist-info → pyegeria-5.4.0.20.dist-info}/METADATA +1 -1
- {pyegeria-5.4.0.18.dist-info → pyegeria-5.4.0.20.dist-info}/RECORD +20 -116
- commands/cat/.DS_Store +0 -0
- commands/cat/.env +0 -8
- commands/cat/debug_log.log +0 -0
- commands/cat/logs/pyegeria.log +0 -27
- commands/cli/debug_log.log +0 -0
- commands/ops/logs/pyegeria.log +0 -0
- md_processing/.DS_Store +0 -0
- md_processing/dr_egeria_inbox/Derive-Dr-Gov-Defs.md +0 -8
- md_processing/dr_egeria_inbox/Dr.Egeria Templates.md +0 -873
- md_processing/dr_egeria_inbox/arch_test.md +0 -57
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro.md +0 -254
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro_more_terms.md +0 -696
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part1.md +0 -254
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part2.md +0 -298
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part3.md +0 -608
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part4.md +0 -94
- md_processing/dr_egeria_inbox/archive/freddie_intro.md +0 -284
- md_processing/dr_egeria_inbox/archive/freddie_intro_orig.md +0 -275
- md_processing/dr_egeria_inbox/archive/test-term.md +0 -110
- md_processing/dr_egeria_inbox/cat_test.md +0 -100
- md_processing/dr_egeria_inbox/collections.md +0 -39
- md_processing/dr_egeria_inbox/data_designer_debug.log +0 -6
- md_processing/dr_egeria_inbox/data_designer_out.md +0 -60
- md_processing/dr_egeria_inbox/data_designer_search_test.md +0 -11
- md_processing/dr_egeria_inbox/data_field.md +0 -54
- md_processing/dr_egeria_inbox/data_spec.md +0 -77
- md_processing/dr_egeria_inbox/data_spec_test.md +0 -2406
- md_processing/dr_egeria_inbox/data_test.md +0 -179
- md_processing/dr_egeria_inbox/data_test2.md +0 -429
- md_processing/dr_egeria_inbox/data_test3.md +0 -462
- md_processing/dr_egeria_inbox/dr_egeria_data_designer_1.md +0 -124
- md_processing/dr_egeria_inbox/dr_egeria_intro_categories.md +0 -168
- md_processing/dr_egeria_inbox/dr_egeria_intro_part1.md +0 -280
- md_processing/dr_egeria_inbox/dr_egeria_intro_part2.md +0 -313
- md_processing/dr_egeria_inbox/dr_egeria_intro_part3.md +0 -1073
- md_processing/dr_egeria_inbox/dr_egeria_isc1.md +0 -44
- md_processing/dr_egeria_inbox/generated_help_report.md +0 -9
- md_processing/dr_egeria_inbox/glossary_list.md +0 -5
- md_processing/dr_egeria_inbox/glossary_search_test.md +0 -40
- md_processing/dr_egeria_inbox/glossary_test1.md +0 -324
- md_processing/dr_egeria_inbox/gov_def.md +0 -424
- md_processing/dr_egeria_inbox/gov_def2.md +0 -447
- md_processing/dr_egeria_inbox/product.md +0 -50
- md_processing/dr_egeria_inbox/rel.md +0 -8
- md_processing/dr_egeria_inbox/sb.md +0 -119
- md_processing/dr_egeria_inbox/solution-components.md +0 -136
- md_processing/dr_egeria_inbox/solution_blueprints.md +0 -118
- md_processing/dr_egeria_inbox/synonym_test.md +0 -42
- md_processing/dr_egeria_inbox/t2.md +0 -268
- md_processing/dr_egeria_outbox/.obsidian/app.json +0 -1
- md_processing/dr_egeria_outbox/.obsidian/appearance.json +0 -1
- md_processing/dr_egeria_outbox/.obsidian/community-plugins.json +0 -6
- md_processing/dr_egeria_outbox/.obsidian/core-plugins.json +0 -31
- md_processing/dr_egeria_outbox/.obsidian/plugins/calendar/data.json +0 -10
- md_processing/dr_egeria_outbox/.obsidian/plugins/calendar/main.js +0 -4459
- md_processing/dr_egeria_outbox/.obsidian/plugins/calendar/manifest.json +0 -10
- md_processing/dr_egeria_outbox/.obsidian/plugins/obsidian-kanban/data.json +0 -3
- md_processing/dr_egeria_outbox/.obsidian/plugins/obsidian-kanban/main.js +0 -153
- md_processing/dr_egeria_outbox/.obsidian/plugins/obsidian-kanban/manifest.json +0 -11
- md_processing/dr_egeria_outbox/.obsidian/plugins/obsidian-kanban/styles.css +0 -1
- md_processing/dr_egeria_outbox/.obsidian/plugins/obsidian-tasks-plugin/main.js +0 -500
- md_processing/dr_egeria_outbox/.obsidian/plugins/obsidian-tasks-plugin/manifest.json +0 -12
- md_processing/dr_egeria_outbox/.obsidian/plugins/obsidian-tasks-plugin/styles.css +0 -1
- md_processing/dr_egeria_outbox/.obsidian/plugins/templater-obsidian/main.js +0 -37
- md_processing/dr_egeria_outbox/.obsidian/plugins/templater-obsidian/manifest.json +0 -11
- md_processing/dr_egeria_outbox/.obsidian/plugins/templater-obsidian/styles.css +0 -220
- md_processing/dr_egeria_outbox/.obsidian/types.json +0 -28
- md_processing/dr_egeria_outbox/.obsidian/workspace.json +0 -220
- md_processing/dr_egeria_outbox/Untitled.canvas +0 -1
- md_processing/dr_egeria_outbox/friday/processed-2025-07-18 15:00-product.md +0 -62
- md_processing/dr_egeria_outbox/friday/processed-2025-07-18 15:13-product.md +0 -62
- md_processing/dr_egeria_outbox/friday/processed-2025-07-20 13:23-product.md +0 -47
- md_processing/dr_egeria_outbox/friday/processed-2025-08-01 11:55-data_test3.md +0 -503
- md_processing/dr_egeria_outbox/monday/processed-2025-07-14 12:38-data_designer_out.md +0 -663
- md_processing/dr_egeria_outbox/monday/processed-2025-07-21 10:52-generated_help_report.md +0 -2744
- md_processing/dr_egeria_outbox/monday/processed-2025-07-21 18:38-collections.md +0 -62
- md_processing/dr_egeria_outbox/monday/processed-2025-08-01 11:34-gov_def.md +0 -444
- md_processing/dr_egeria_outbox/processed-2025-08-03 16:05-glossary_list.md +0 -37
- md_processing/dr_egeria_outbox/sunday/processed-2025-07-20 14:55-product.md +0 -77
- md_processing/dr_egeria_outbox/sunday/processed-2025-07-20 15:05-product.md +0 -75
- md_processing/dr_egeria_outbox/sunday/processed-2025-07-20 15:11-product.md +0 -74
- md_processing/dr_egeria_outbox/sunday/processed-2025-07-20 20:40-collections.md +0 -49
- md_processing/dr_egeria_outbox/thursday/processed-2025-07-17 15:00-Derive-Dr-Gov-Defs.md +0 -719
- md_processing/dr_egeria_outbox/thursday/processed-2025-07-17 20:13-Derive-Dr-Gov-Defs.md +0 -41
- md_processing/dr_egeria_outbox/thursday/processed-2025-07-17 20:14-Derive-Dr-Gov-Defs.md +0 -33
- md_processing/dr_egeria_outbox/thursday/processed-2025-07-17 20:50-Derive-Dr-Gov-Defs.md +0 -192
- md_processing/dr_egeria_outbox/thursday/processed-2025-07-17 22:08-gov_def2.md +0 -486
- md_processing/dr_egeria_outbox/thursday/processed-2025-07-17 22:10-gov_def2.md +0 -486
- md_processing/dr_egeria_outbox/thursday/processed-2025-07-18 08:53-gov_def2.md +0 -486
- md_processing/dr_egeria_outbox/thursday/processed-2025-07-18 08:54-gov_def2.md +0 -486
- md_processing/dr_egeria_outbox/thursday/processed-2025-07-18 09:03-gov_def2.md +0 -486
- md_processing/dr_egeria_outbox/thursday/processed-2025-07-18 09:06-gov_def2.md +0 -486
- md_processing/dr_egeria_outbox/thursday/processed-2025-07-18 09:10-gov_def2.md +0 -486
- md_processing/dr_egeria_outbox/tuesday/processed-2025-07-16 19:15-gov_def2.md +0 -527
- md_processing/dr_egeria_outbox/tuesday/processed-2025-07-17 12:08-gov_def2.md +0 -527
- md_processing/dr_egeria_outbox/tuesday/processed-2025-07-17 14:27-gov_def2.md +0 -485
- md_processing/md_processing_utils/debug_log.log +0 -0
- md_processing/md_processing_utils/solution_architect_log.log +0 -0
- pyegeria/.DS_Store +0 -0
- {pyegeria-5.4.0.18.dist-info → pyegeria-5.4.0.20.dist-info}/LICENSE +0 -0
- {pyegeria-5.4.0.18.dist-info → pyegeria-5.4.0.20.dist-info}/WHEEL +0 -0
- {pyegeria-5.4.0.18.dist-info → pyegeria-5.4.0.20.dist-info}/entry_points.txt +0 -0
commands/cat/list_collections.py
CHANGED
@@ -19,9 +19,9 @@ from rich.text import Text
|
|
19
19
|
from loguru import logger
|
20
20
|
from pyegeria import (
|
21
21
|
CollectionManager,
|
22
|
-
|
23
|
-
)
|
24
|
-
from pyegeria._exceptions_new import PyegeriaException, print_exception_response
|
22
|
+
NO_ELEMENTS_FOUND, config_logging, load_app_config, get_app_config, init_logging, config_logging, PyegeriaException,
|
23
|
+
print_basic_exception,PyegeriaException, )
|
24
|
+
# from pyegeria._exceptions_new import PyegeriaException, print_exception_response
|
25
25
|
|
26
26
|
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
27
27
|
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
@@ -39,7 +39,7 @@ out_struct = {
|
|
39
39
|
{'name': 'description', 'key': 'description', 'format': True},
|
40
40
|
{'name': "classifications", 'key': 'classifications'},
|
41
41
|
{'name': 'members', 'key': 'members', 'format': True},
|
42
|
-
{'name': '
|
42
|
+
{'name': 'category', 'key': 'category', 'format': True},
|
43
43
|
{'name': 'GUID', 'key': 'GUID'},
|
44
44
|
],
|
45
45
|
},
|
@@ -183,7 +183,7 @@ def display_collections(
|
|
183
183
|
except (
|
184
184
|
PyegeriaException
|
185
185
|
) as e:
|
186
|
-
|
186
|
+
print_basic_exception(e)
|
187
187
|
finally:
|
188
188
|
m_client.close_session()
|
189
189
|
|
@@ -216,7 +216,7 @@ def main():
|
|
216
216
|
pass
|
217
217
|
|
218
218
|
except PyegeriaException as e:
|
219
|
-
|
219
|
+
print_basic_exception(e)
|
220
220
|
|
221
221
|
|
222
222
|
if __name__ == "__main__":
|
commands/ops/load_archive.py
CHANGED
@@ -12,7 +12,9 @@ import os
|
|
12
12
|
|
13
13
|
import click
|
14
14
|
from loguru import logger
|
15
|
-
from pyegeria import AutomatedCuration, EgeriaTech
|
15
|
+
from pyegeria import AutomatedCuration, EgeriaTech
|
16
|
+
from pyegeria.load_config import get_app_config
|
17
|
+
from pyegeria.logging_configuration import config_logging
|
16
18
|
from pyegeria._exceptions_new import (
|
17
19
|
PyegeriaException, print_exception_response, print_basic_exception
|
18
20
|
)
|
@@ -74,7 +76,7 @@ def load_archive(file_name, server_name, view_server, url, userid, password, tim
|
|
74
76
|
f"Perhaps there was a timeout? If so, the command will complete despite the exception\n"
|
75
77
|
f"===> You can check by rerunning the command in a few minutes"
|
76
78
|
)
|
77
|
-
|
79
|
+
print_basic_exception(e)
|
78
80
|
|
79
81
|
|
80
82
|
if __name__ == "__main__":
|
@@ -409,7 +409,7 @@ def sync_data_class_rel_elements(egeria_client: EgeriaTech, containing_data_clas
|
|
409
409
|
def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
410
410
|
"""
|
411
411
|
Processes a data specification create or update object_action by extracting key attributes such as
|
412
|
-
spec name, parent_guid, parent_relationship_type, parent_at_end_1,
|
412
|
+
spec name, parent_guid, parent_relationship_type, parent_at_end_1, category
|
413
413
|
|
414
414
|
:param txt: A string representing the input cell to be processed for
|
415
415
|
extracting glossary-related attributes.
|
@@ -535,7 +535,7 @@ def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
535
535
|
def process_data_dict_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
536
536
|
"""
|
537
537
|
Processes a data dictionary create or update object_action by extracting key attributes such as
|
538
|
-
spec name, parent_guid, parent_relationship_type, parent_at_end_1,
|
538
|
+
spec name, parent_guid, parent_relationship_type, parent_at_end_1, category
|
539
539
|
|
540
540
|
:param txt: A string representing the input cell to be processed for
|
541
541
|
extracting glossary-related attributes.
|
@@ -649,7 +649,7 @@ def process_data_structure_upsert_command(egeria_client: EgeriaTech, txt: str, d
|
|
649
649
|
str]:
|
650
650
|
"""
|
651
651
|
Processes a data structure create or update object_action by extracting key attributes such as
|
652
|
-
spec name, parent_guid, parent_relationship_type, parent_at_end_1,
|
652
|
+
spec name, parent_guid, parent_relationship_type, parent_at_end_1, category
|
653
653
|
|
654
654
|
:param txt: A string representing the input cell to be processed for
|
655
655
|
extracting glossary-related attributes.
|
@@ -847,7 +847,7 @@ def process_data_structure_upsert_command(egeria_client: EgeriaTech, txt: str, d
|
|
847
847
|
def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
848
848
|
"""
|
849
849
|
Processes a data field create or update object_action by extracting key attributes such as
|
850
|
-
spec name, parent_guid, parent_relationship_type, parent_at_end_1,
|
850
|
+
spec name, parent_guid, parent_relationship_type, parent_at_end_1, category
|
851
851
|
|
852
852
|
:param txt: A string representing the input cell to be processed for
|
853
853
|
extracting glossary-related attributes.
|
@@ -1125,7 +1125,7 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1125
1125
|
def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
1126
1126
|
"""
|
1127
1127
|
Processes a data class create or update object_action by extracting key attributes such as
|
1128
|
-
spec name, parent_guid, parent_relationship_type, parent_at_end_1,
|
1128
|
+
spec name, parent_guid, parent_relationship_type, parent_at_end_1, category
|
1129
1129
|
|
1130
1130
|
:param txt: A string representing the input cell to be processed for
|
1131
1131
|
extracting glossary-related attributes.
|
@@ -81,7 +81,7 @@ def sync_gov_rel_elements(egeria_client: EgeriaTech, object_action:str, object_t
|
|
81
81
|
def process_gov_definition_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
82
82
|
"""
|
83
83
|
Processes a data specification create or update object_action by extracting key attributes such as
|
84
|
-
spec name, parent_guid, parent_relationship_type, parent_at_end_1,
|
84
|
+
spec name, parent_guid, parent_relationship_type, parent_at_end_1, category
|
85
85
|
|
86
86
|
:param txt: A string representing the input cell to be processed for
|
87
87
|
extracting glossary-related attributes.
|
@@ -413,7 +413,7 @@ def sync_data_class_rel_elements(egeria_client: EgeriaTech, containing_data_clas
|
|
413
413
|
def process_collection_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
414
414
|
"""
|
415
415
|
Processes a digital product create or update object_action by extracting key attributes such as
|
416
|
-
spec name, parent_guid, parent_relationship_type, parent_at_end_1,
|
416
|
+
spec name, parent_guid, parent_relationship_type, parent_at_end_1, category
|
417
417
|
|
418
418
|
:param txt: A string representing the input cell to be processed for
|
419
419
|
extracting glossary-related attributes.
|
@@ -550,7 +550,7 @@ def process_collection_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
550
550
|
def process_digital_product_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
551
551
|
"""
|
552
552
|
Processes a digital product create or update object_action by extracting key attributes such as
|
553
|
-
spec name, parent_guid, parent_relationship_type, parent_at_end_1,
|
553
|
+
spec name, parent_guid, parent_relationship_type, parent_at_end_1, category
|
554
554
|
|
555
555
|
:param txt: A string representing the input cell to be processed for
|
556
556
|
extracting glossary-related attributes.
|
@@ -751,7 +751,7 @@ def process_digital_product_upsert_command(egeria_client: EgeriaTech, txt: str,
|
|
751
751
|
def process_agreement_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
752
752
|
"""
|
753
753
|
Processes an agreement create or update object_action by extracting key attributes such as
|
754
|
-
spec name, parent_guid, parent_relationship_type, parent_at_end_1,
|
754
|
+
spec name, parent_guid, parent_relationship_type, parent_at_end_1, category
|
755
755
|
|
756
756
|
:param txt: A string representing the input cell to be processed for
|
757
757
|
extracting glossary-related attributes.
|
pyegeria/__init__.py
CHANGED
@@ -27,7 +27,12 @@ if disable_ssl_warnings:
|
|
27
27
|
|
28
28
|
from ._client import Client
|
29
29
|
from ._client_new import Client2
|
30
|
-
|
30
|
+
from ._exceptions_new import (PyegeriaInvalidParameterException,PyegeriaAPIException, PyegeriaException,
|
31
|
+
PyegeriaUnauthorizedException, PyegeriaClientException, PyegeriaUnknownException,
|
32
|
+
PyegeriaConnectionException, PyegeriaNotFoundException,
|
33
|
+
print_exception_table, print_basic_exception)
|
34
|
+
from .load_config import load_app_config, get_app_config
|
35
|
+
from .logging_configuration import config_logging, console_log_filter, init_logging
|
31
36
|
from ._exceptions import (InvalidParameterException, PropertyServerException, UserNotAuthorizedException,
|
32
37
|
print_exception_response, )
|
33
38
|
from ._validators import (is_json, validate_guid, validate_name, validate_public, validate_search_string,
|
pyegeria/_client_new.py
CHANGED
@@ -20,6 +20,7 @@ import httpx
|
|
20
20
|
from loguru import logger
|
21
21
|
|
22
22
|
from httpx import AsyncClient, Response, HTTPStatusError
|
23
|
+
from pydantic import TypeAdapter
|
23
24
|
|
24
25
|
from pyegeria.utils import body_slimmer
|
25
26
|
from pyegeria._exceptions_new import (
|
@@ -35,6 +36,9 @@ from pyegeria._validators import (
|
|
35
36
|
validate_url,
|
36
37
|
validate_user_id,
|
37
38
|
)
|
39
|
+
from pyegeria.models import SearchStringRequestBody, FilterRequestBody, GetRequestBody, NewElementRequestBody, \
|
40
|
+
TemplateRequestBody, UpdateStatusRequestBody, UpdateElementRequestBody, NewRelationshipRequestBody, \
|
41
|
+
DeleteRequestBody
|
38
42
|
|
39
43
|
...
|
40
44
|
|
@@ -137,8 +141,15 @@ class Client2:
|
|
137
141
|
self.server_name = server_name
|
138
142
|
self.session = AsyncClient(verify=enable_ssl_check)
|
139
143
|
|
140
|
-
|
141
|
-
|
144
|
+
self._search_string_request_adapter = TypeAdapter(SearchStringRequestBody)
|
145
|
+
self._filter_request_adapter = TypeAdapter(FilterRequestBody)
|
146
|
+
self._get_request_adapter = TypeAdapter(GetRequestBody)
|
147
|
+
self._new_element_request_adapter = TypeAdapter(NewElementRequestBody)
|
148
|
+
self._update_element_request_adapter = TypeAdapter(UpdateElementRequestBody)
|
149
|
+
self._update_status_request_adapter = TypeAdapter(UpdateStatusRequestBody)
|
150
|
+
self._new_relationship_request_adapter = TypeAdapter(NewRelationshipRequestBody)
|
151
|
+
self._delete_request_adapter = TypeAdapter(DeleteRequestBody)
|
152
|
+
self._template_request_adapter = TypeAdapter(TemplateRequestBody)
|
142
153
|
|
143
154
|
def __enter__(self):
|
144
155
|
return self
|
@@ -423,17 +434,27 @@ class Client2:
|
|
423
434
|
response = await self.session.post(
|
424
435
|
endpoint, headers=self.headers, timeout=time_out
|
425
436
|
)
|
437
|
+
elif type(payload) is dict:
|
438
|
+
response = await self.session.post(
|
439
|
+
endpoint, json=payload, headers=self.headers, timeout=time_out
|
440
|
+
)
|
426
441
|
elif type(payload) is str:
|
442
|
+
# if is_json:
|
443
|
+
# response = await self.session.post(
|
444
|
+
# endpoint, json=payload, headers=self.headers, timeout=time_out
|
445
|
+
# )
|
446
|
+
# else:
|
427
447
|
response = await self.session.post(
|
428
448
|
endpoint,
|
429
|
-
headers=self.
|
430
|
-
|
449
|
+
headers=self.headers,
|
450
|
+
content=payload,
|
431
451
|
timeout=time_out,
|
432
452
|
)
|
433
453
|
else:
|
434
|
-
response = await self.session.post(
|
435
|
-
|
436
|
-
)
|
454
|
+
# response = await self.session.post(
|
455
|
+
# endpoint, headers=self.headers, json=payload, timeout=time_out)
|
456
|
+
raise TypeError(f"Invalid payload type {type(payload)}")
|
457
|
+
|
437
458
|
|
438
459
|
elif request_type == "POST-DATA":
|
439
460
|
if True:
|
@@ -598,7 +619,7 @@ class Client2:
|
|
598
619
|
name = f"{tech_type}::{display_name}"
|
599
620
|
body = {
|
600
621
|
"class": "NameRequestBody",
|
601
|
-
"
|
622
|
+
"displayName": name,
|
602
623
|
"namePropertyName": property_name,
|
603
624
|
"forLineage": False,
|
604
625
|
"forDuplicateProcessing": False,
|
@@ -665,11 +686,11 @@ class Client2:
|
|
665
686
|
"""Helper function to create a qualified name for a given type and display name.
|
666
687
|
If present, the local qualifier will be prepended to the qualified name."""
|
667
688
|
EGERIA_LOCAL_QUALIFIER = os.environ.get("EGERIA_LOCAL_QUALIFIER", local_qualifier)
|
668
|
-
|
689
|
+
display_name = re.sub(r'\s','-',display_name.strip()) # This changes spaces between words to -; removing
|
669
690
|
if display_name is None:
|
670
691
|
additional_info = {"reason": "Display name is missing - please provide.",}
|
671
692
|
raise PyegeriaInvalidParameterException(additional_info=additional_info)
|
672
|
-
q_name = f"{type}::{display_name
|
693
|
+
q_name = f"{type}::{display_name}"
|
673
694
|
if EGERIA_LOCAL_QUALIFIER:
|
674
695
|
q_name = f"{EGERIA_LOCAL_QUALIFIER}::{q_name}"
|
675
696
|
if version_identifier:
|
@@ -716,6 +737,22 @@ class Client2:
|
|
716
737
|
|
717
738
|
return elements
|
718
739
|
|
740
|
+
def validate_new_element_request(self, body: dict | NewElementRequestBody, prop: str)-> NewElementRequestBody
|
741
|
+
if isinstance(body, NewElementRequestBody):
|
742
|
+
if body.properties.class_ == prop:
|
743
|
+
validated_body = body
|
744
|
+
else:
|
745
|
+
raise PyegeriaInvalidParameterException(additional_info=
|
746
|
+
{"reason": "unexpected property class name"})
|
747
|
+
|
748
|
+
elif isinstance(body, dict):
|
749
|
+
if body.get("properties", {}).get("class", "") == prop:
|
750
|
+
validated_body = self._new_element_request_adapter.validate_python(body)
|
751
|
+
else:
|
752
|
+
raise PyegeriaInvalidParameterException(additional_info=
|
753
|
+
{"reason": "unexpected property class name"})
|
719
754
|
|
755
|
+
else:
|
756
|
+
raise TypeError("Invalid parameter type")
|
720
757
|
if __name__ == "__main__":
|
721
758
|
print("Main-__client")
|
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
|
@@ -34,7 +35,7 @@ class PyegeriaErrorCode(Enum):
|
|
34
35
|
"http_code": 400,
|
35
36
|
"egeria_code": "From Egeria",
|
36
37
|
"message_id": "CLIENT_ERROR_400",
|
37
|
-
"message_template": "Client error occurred
|
38
|
+
"message_template": "Client error occurred with status code `{0}`.",
|
38
39
|
"system_action": "The client is unable to connect to the Egeria platform.",
|
39
40
|
"user_action": "Check the URL to ensure the valid platform url, server, user id are correct.",
|
40
41
|
}
|
@@ -148,14 +149,20 @@ def format_dict_to_string(d: dict) -> str:
|
|
148
149
|
class PyegeriaException(Exception):
|
149
150
|
"""Base exception for My REST Library errors."""
|
150
151
|
|
151
|
-
def __init__(self, response:Response, error_code: PyegeriaErrorCode,
|
152
|
+
def __init__(self, response:Response = None, error_code: PyegeriaErrorCode = None,
|
152
153
|
context: dict = None, additional_info:dict = None, e:Exception = None) -> None:
|
153
|
-
|
154
|
+
if response:
|
155
|
+
self.response = response
|
156
|
+
self.response_url = getattr(response, "url", "unknown URL") if response else additional_info.get("endpoint", "")
|
157
|
+
self.response_code = getattr(response, "status_code", "unknown status code") if response else ""
|
158
|
+
else:
|
159
|
+
self.response = None
|
160
|
+
self.response_url = ""
|
161
|
+
self.response_code = ""
|
154
162
|
self.error_code = error_code
|
155
163
|
self.error_details = error_code.value
|
156
164
|
self.pyegeria_code = self.error_details.get("message_id", "UNKNOWN_ERROR")
|
157
|
-
|
158
|
-
self.response_code = getattr(response, "status_code", "unknown status code") if response else ""
|
165
|
+
|
159
166
|
self.message = self.error_details["message_template"].format(self.response_url, self.response_code)
|
160
167
|
self.system_action = self.error_details.get("system_action", "")
|
161
168
|
self.user_action = self.error_details.get("user_action", "")
|
@@ -199,7 +206,7 @@ class PyegeriaConnectionException(PyegeriaException):
|
|
199
206
|
|
200
207
|
class PyegeriaInvalidParameterException(PyegeriaException):
|
201
208
|
"""Raised for invalid parameters - parameters that might be missing or incorrect."""
|
202
|
-
def __init__(self, response: Response,
|
209
|
+
def __init__(self, response: Response = None,
|
203
210
|
context: dict = None, additional_info: dict = None, e: Exception = None) -> None:
|
204
211
|
super().__init__(response, PyegeriaErrorCode.VALIDATION_ERROR,
|
205
212
|
context, additional_info, e)
|
@@ -311,7 +318,7 @@ def print_exception_response(e: PyegeriaException):
|
|
311
318
|
if isinstance(e, PyegeriaException):
|
312
319
|
console.print(Markdown(f"\n---\n# Exception: {e.__class__.__name__}"))
|
313
320
|
msg: Text = Text(e.__str__(), overflow="fold")
|
314
|
-
if
|
321
|
+
if e.response_code:
|
315
322
|
related_response = e.response.json()
|
316
323
|
exception_msg_id = related_response.get("exceptionErrorMessageId", None)
|
317
324
|
if exception_msg_id:
|
@@ -340,7 +347,7 @@ def print_exception_table(e: PyegeriaException):
|
|
340
347
|
table.add_row("Egeria Code", str(related_code))
|
341
348
|
table.add_row("Caller Method", e.context.get("caller method", "---"))
|
342
349
|
table.add_row("Request URL", str(e.response_url))
|
343
|
-
if e.
|
350
|
+
if e.response_code:
|
344
351
|
item_table = Table(show_lines = True, header_style="bold")
|
345
352
|
item_table.add_column("Item", justify="center")
|
346
353
|
item_table.add_column("Detail", justify="left")
|
@@ -364,7 +371,7 @@ def print_exception_table(e: PyegeriaException):
|
|
364
371
|
def print_basic_exception(e: PyegeriaException):
|
365
372
|
"""Prints the exception response"""
|
366
373
|
related_code = e.related_http_code if hasattr(e, "related_http_code") else ""
|
367
|
-
related_response = e.response.json()
|
374
|
+
related_response = e.response.json() if e.response else ""
|
368
375
|
table = Table(title=f"Exception: {e.__class__.__name__}", show_lines=True, header_style="bold", box=box.HEAVY_HEAD)
|
369
376
|
table.caption = e.pyegeria_code
|
370
377
|
table.add_column("Facet", justify="center")
|
@@ -388,4 +395,22 @@ def print_basic_exception(e: PyegeriaException):
|
|
388
395
|
|
389
396
|
console.print(table)
|
390
397
|
else:
|
391
|
-
print(f"\n\n\t Not an Pyegeria exception {e}")
|
398
|
+
print(f"\n\n\t Not an Pyegeria exception {e}")
|
399
|
+
|
400
|
+
def print_validation_error(e: ValidationError):
|
401
|
+
"""Prints the pydantic validation exception response"""
|
402
|
+
|
403
|
+
table = Table(title=f"Validation Error for {e.title}", show_lines=True, header_style="bold", box=box.HEAVY_HEAD)
|
404
|
+
table.caption = "Pydantic Validation Error"
|
405
|
+
table.add_column("Type", justify="center")
|
406
|
+
table.add_column("Attribute", justify="center")
|
407
|
+
table.add_column("Message", justify="center")
|
408
|
+
|
409
|
+
for error in e.errors():
|
410
|
+
error_type = error["type"]
|
411
|
+
attribute = " ".join(error["loc"])
|
412
|
+
message = error["msg"]
|
413
|
+
table.add_row(error_type, attribute, message)
|
414
|
+
|
415
|
+
|
416
|
+
console.print(table)
|
@@ -857,7 +857,7 @@ class ClassificationManager(Client):
|
|
857
857
|
|
858
858
|
body = {
|
859
859
|
"class": "NameRequestBody",
|
860
|
-
"
|
860
|
+
"displayName": name,
|
861
861
|
"namePropertyName": property_name,
|
862
862
|
"forLineage": for_lineage,
|
863
863
|
"forDuplicateProcessing": for_duplicate_processing,
|