pyegeria 5.3.8.10__py3-none-any.whl → 5.3.9.2__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.
@@ -16,7 +16,7 @@ from rich.console import Console
16
16
  from rich.markdown import Markdown
17
17
 
18
18
  from pyegeria import body_slimmer
19
- from pyegeria._globals import (NO_GLOSSARIES_FOUND, NO_ELEMENTS_FOUND, NO_PROJECTS_FOUND, NO_CATEGORIES_FOUND)
19
+ from pyegeria._globals import (NO_GLOSSARIES_FOUND, NO_ELEMENTS_FOUND, NO_PROJECTS_FOUND, NO_CATEGORIES_FOUND, DEBUG_LEVEL)
20
20
  from pyegeria.dr_egeria_state import get_element_dictionary, update_element_dictionary, find_key_with_value
21
21
  from pyegeria.egeria_tech_client import EgeriaTech
22
22
  # from pyegeria.md_processing_helpers import process_q_name_list
@@ -25,14 +25,14 @@ from pyegeria.project_manager_omvs import ProjectManager
25
25
  EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "170"))
26
26
  console = Console(width=EGERIA_WIDTH)
27
27
 
28
- command_list = ["Provenance", "Create Glossary", "Update Glossary", "Create Term", "Update Term", "List Terms",
28
+ command_list = ["Provenance", "Create Glossary", "Update Glossary", "Create Term", "Update Term", "List Terms", "List Term Details",
29
29
  "List Glossary Terms", "List Term History", "List Term Revision History", "List Term Update History",
30
30
  "List Glossary Structure", "List Glossaries", "List Categories", "List Glossary Categories",
31
31
  "Create Personal Project", "Update Personal Project", "Create Category", "Update Category",
32
32
  "Create Solution Blueprint", "Update Solution Blueprint", "Create Solution Component",
33
33
  "Update Solution Component", "Create Term-Term Relationship", "Update Term-Term Relationship",]
34
34
  # verbosity - verbose, quiet, debug
35
- debug_level = "debug"
35
+
36
36
  message_types = {
37
37
  "INFO": "INFO-", "WARNING": "WARNING->", "ERROR": "ERROR->", "DEBUG-INFO": "DEBUG-INFO->",
38
38
  "DEBUG-WARNING": "DEBUG-WARNING->", "DEBUG-ERROR": "DEBUG-ERROR->", "ALWAYS": "\n\n==> "
@@ -96,6 +96,7 @@ def is_valid_iso_date(date_text) -> bool:
96
96
  except ValueError:
97
97
  return False
98
98
 
99
+ debug_level = DEBUG_LEVEL
99
100
 
100
101
  def set_debug_level(directive: str) -> None:
101
102
  """Sets the debug level for the script."""
@@ -360,8 +361,7 @@ def update_a_command(txt: str, command: str, obj_type: str, q_name: str, u_guid:
360
361
  verb = command.split(' ')[0].strip()
361
362
  action = "Update" if (verb == "Create" and u_guid is not None) else "Create"
362
363
  txt = txt.replace(f"{command}", f'{action} {obj_type}\n') # update the command
363
- txt = txt.replace('<GUID>', f'GUID\n{u_guid}') # update with GUID
364
- txt = txt.replace('<Qualified Name>', f"Qualified Name\n{q_name}")
364
+
365
365
  if "Qualified Name" not in txt:
366
366
  txt += f"\n## Qualified Name\n{q_name}\n"
367
367
  if "GUID" not in txt:
@@ -389,7 +389,7 @@ def process_provenance_command(file_path: str, txt: [str]) -> str:
389
389
  existing_prov = extracted_text # Return the cleaned text
390
390
  else:
391
391
  existing_prov = None
392
- # print(f"txt is: {txt}, existing_prov: {existing_prov}")
392
+
393
393
  existing_prov = existing_prov if existing_prov else " "
394
394
  return f"\n# Provenance:\n{existing_prov}\n{output}\n"
395
395
 
@@ -978,11 +978,13 @@ def process_glossary_upsert_command(egeria_client: EgeriaTech, txt: str, directi
978
978
  if valid:
979
979
  print(Markdown(glossary_display))
980
980
  else:
981
- msg = f"Validation failed for Glossary `{glossary_name}`\n"
982
- print_msg(ERROR, msg, debug_level)
983
- print(Markdown(glossary_display))
984
- return None
985
-
981
+ if glossary_exists and object_action == "Create":
982
+ msg = f"Create failed because glossary `{glossary_name}` exists - changing `Create` to `Update` in processed output \n"
983
+ print_msg(ERROR, msg, debug_level)
984
+ print(Markdown(glossary_display))
985
+ return update_a_command(txt, command, object_type, known_q_name, known_guid)
986
+ else:
987
+ return None
986
988
  if object_action == "Update":
987
989
  if not glossary_exists:
988
990
  print(f"\n{ERROR}Glossary `{glossary_name}` does not exist! Updating result document with Create "
@@ -1123,10 +1125,13 @@ def process_category_upsert_command(egeria_client: EgeriaTech, txt: str, directi
1123
1125
  if valid:
1124
1126
  print(Markdown(category_display))
1125
1127
  else:
1126
- msg = f"* --> Validation failed for {object_type} `{category_name}`\n"
1127
- print_msg(ERROR, msg, debug_level)
1128
- print(Markdown(category_display))
1129
- return None
1128
+ if category_exists and object_action == "Create":
1129
+ msg = f"Create failed because category `{category_name}` exists - changing `Create` to `Update` in processed output \n"
1130
+ print_msg(ERROR, msg, debug_level)
1131
+ print(Markdown(category_display))
1132
+ return update_a_command(txt, command, object_type, known_q_name, known_guid)
1133
+ else:
1134
+ return None
1130
1135
 
1131
1136
  if object_action == "Update":
1132
1137
  if not category_exists:
@@ -1144,7 +1149,6 @@ def process_category_upsert_command(egeria_client: EgeriaTech, txt: str, directi
1144
1149
  update_element_dictionary(known_q_name, {
1145
1150
  'guid': known_guid, 'display_name': category_name
1146
1151
  })
1147
- print_msg(ALWAYS, f"Updated Category `{category_name}` with GUID {known_guid}", debug_level)
1148
1152
 
1149
1153
  category_sync = update_category_parent(egeria_client, known_guid, parent_category_name)
1150
1154
  print_msg(ALWAYS, f"Updated Category hierarchy for `{category_name}` with outcome {category_sync}",
@@ -1173,7 +1177,7 @@ def process_category_upsert_command(egeria_client: EgeriaTech, txt: str, directi
1173
1177
  'guid': category_guid, 'display_name': category_name
1174
1178
  })
1175
1179
  print_msg(ALWAYS, f"Created Category `{category_name}` with GUID {category_guid}", debug_level)
1176
- if parent_valid & parent_exists:
1180
+ if parent_valid and parent_guid:
1177
1181
  egeria_client.set_parent_category(parent_guid, category_guid)
1178
1182
  print_msg(ALWAYS, f"Set parent category for `{category_name}` to `{parent_category_name}`",
1179
1183
  debug_level)
@@ -1297,9 +1301,9 @@ def process_term_upsert_command(egeria_client: EgeriaTech, txt: str, directive:
1297
1301
  version = process_simple_attribute(txt, ['Version', "Version Identifier", "Published Version"], INFO)
1298
1302
  q_name = process_simple_attribute(txt, ['Qualified Name'], INFO)
1299
1303
 
1300
- aliases = process_simple_attribute(txt, ['Aliases'], INFO)
1304
+ aliases = process_simple_attribute(txt, ['Aliases','Alias'], INFO)
1301
1305
  if aliases:
1302
- alias_list = list(filter(None, re.split(r'[,\s]+', aliases.strip())))
1306
+ alias_list = list(filter(None, re.split(r'[,\n]+', aliases.strip())))
1303
1307
  else:
1304
1308
  alias_list = None
1305
1309
 
@@ -1382,7 +1386,14 @@ def process_term_upsert_command(egeria_client: EgeriaTech, txt: str, directive:
1382
1386
  elif directive == "process":
1383
1387
  try:
1384
1388
  if not valid: # First validate the term before we process it
1385
- return None
1389
+ if term_exists and object_action == "Create":
1390
+ msg = f"Create failed because term `{term_name}` exists - changing `Create` to `Update` in processed output \n"
1391
+ print_msg(ERROR, msg, debug_level)
1392
+ print(Markdown(term_display))
1393
+ return update_a_command(txt, command, object_type, known_q_name, known_guid)
1394
+ else:
1395
+ return None
1396
+
1386
1397
  print(Markdown(term_display))
1387
1398
  if object_action == "Update" and directive == "process":
1388
1399
  if not term_exists:
@@ -1471,16 +1482,16 @@ def process_create_term_term_relationship_command(egeria_client: EgeriaTech, txt
1471
1482
  term2_guid = None
1472
1483
 
1473
1484
 
1474
- term_relationship = process_simple_attribute(txt, ["Term Relationship"], "ERROR")
1485
+ term_relationship = process_simple_attribute(txt, ["Term Relationship", "Relationship Type"], "ERROR")
1475
1486
  if term_relationship not in TERM_RELATIONSHPS:
1476
1487
  valid = False
1477
1488
 
1478
1489
  print(Markdown(f"{pre_command} `{command}` for term relationship: `{term_relationship}` with directive: `{directive}` "))
1479
1490
 
1480
- term1_q_name, term1_guid, term1_valid, term1_exists = process_element_identifiers(egeria_client, object_type, ["Term 1 Name"], txt,
1491
+ term1_q_name, term1_guid, term1_valid, term1_exists = process_element_identifiers(egeria_client, object_type, ["Term 1 Name", "Term 1"], txt,
1481
1492
  "Exists Required", None )
1482
1493
 
1483
- term2_q_name, term2_guid, term2_valid, term2_exists = process_element_identifiers(egeria_client, object_type, ["Term 2 Name"], txt,
1494
+ term2_q_name, term2_guid, term2_valid, term2_exists = process_element_identifiers(egeria_client, object_type, ["Term 2 Name", "Term 2"], txt,
1484
1495
  "Exists Required", None )
1485
1496
 
1486
1497
  request_display = (f"\n\t* Term 1 Qualified Name: {term1_q_name}\n\t* Term 2 Qualified Name {term2_q_name}\n\t"
@@ -1515,7 +1526,6 @@ def process_create_term_term_relationship_command(egeria_client: EgeriaTech, txt
1515
1526
  return None
1516
1527
 
1517
1528
 
1518
-
1519
1529
  def process_per_proj_upsert_command(egeria_client: ProjectManager, txt: str, directive: str = "display") -> str | None:
1520
1530
  """
1521
1531
  Processes a personal project create or update command by extracting key attributes such as
@@ -1678,7 +1688,7 @@ def process_term_list_command(egeria_client: EgeriaTech, txt: str, directive: st
1678
1688
  search_string = '*'
1679
1689
  print(Markdown(f"{pre_command} `{command}` with search string:`{search_string}` with directive: `{directive}`"))
1680
1690
 
1681
- glossary = process_simple_attribute(txt, ['Glossary', 'In Glossary'])
1691
+ glossary = process_simple_attribute(txt, ['Glossary', 'In Glossary', "Glossary Name"])
1682
1692
  if glossary is not None:
1683
1693
  _, glossary_guid, _, glossary_exists = get_element_by_name(egeria_client, "Glossary", glossary)
1684
1694
  msg = f"Found glossary `{glossary}` with GUID {glossary_guid}"
@@ -1892,6 +1902,58 @@ def process_glossary_list_command(egeria_client: EgeriaTech, txt: str, directive
1892
1902
  return None
1893
1903
 
1894
1904
 
1905
+ def process_term_details_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
1906
+ """ List terms as a markdown table. Filter based on optional search string. """
1907
+ set_debug_level(directive)
1908
+ valid = True
1909
+ command = extract_command(txt)
1910
+ object_type = command.split(' ')[1].strip()
1911
+ object_action = command.split(' ')[0].strip()
1912
+
1913
+
1914
+ term_identifier = process_simple_attribute(txt, TERM_NAME_LABELS, "ERROR")
1915
+
1916
+ print(Markdown(f"{pre_command} `{command}` for term:`{term_identifier}` with directive: `{directive}`"))
1917
+
1918
+ output_format = process_simple_attribute(txt, OUTPUT_LABELS, "INFO")
1919
+ if output_format is None:
1920
+ output_format = "REPORT"
1921
+ else:
1922
+ output_format = output_format.upper()
1923
+
1924
+ if output_format not in ["DICT", "REPORT"]:
1925
+ valid = False
1926
+ print_msg(ERROR, f"Invalid output format: `{output_format}`", debug_level)
1927
+
1928
+ request_display = f"\n\t* Term Identifier: {term_identifier}\n\t* Output Format {output_format}"
1929
+
1930
+ if directive == "display":
1931
+ print(request_display)
1932
+ return None
1933
+ elif directive == "validate":
1934
+ print(request_display)
1935
+ return valid
1936
+ elif directive == "process":
1937
+ try:
1938
+ print(request_display)
1939
+ if not valid: # First validate the term before we process it
1940
+ return None
1941
+ output = egeria_client.get_term_details(term_identifier, output_format=output_format)
1942
+ if output_format == "DICT":
1943
+ output = f"```{json.dumps(output, indent=4)}```"
1944
+ print_msg("ALWAYS", f"Wrote Term Details for term: `{term_identifier}`", debug_level)
1945
+
1946
+ return output
1947
+
1948
+ except Exception as e:
1949
+ print(f"{ERROR}Error performing {command}: {e}")
1950
+ console.print_exception(show_locals=True)
1951
+ return None
1952
+ else:
1953
+ return None
1954
+
1955
+
1956
+
1895
1957
  def process_term_history_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
1896
1958
  """ List terms as a markdown table. Filter based on optional search string. """
1897
1959
  set_debug_level(directive)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyegeria
3
- Version: 5.3.8.10
3
+ Version: 5.3.9.2
4
4
  Summary: A python client for Egeria
5
5
  License: Apache 2.0
6
6
  Keywords: egeria,metadata,governance
@@ -1,9 +1,9 @@
1
1
  pyegeria/README.md,sha256=PwX5OC7-YSZUCIsoyHh1O-WBM2hE84sm3Bd4O353NOk,1464
2
- pyegeria/__init__.py,sha256=kqNIJb2ZvIoBXDZwfoCj92C2J6gSVyfgvt0WQnKN_EE,30764
2
+ pyegeria/__init__.py,sha256=nFCanIHEBLo4bQSMBdqncR-otfySxnit8Atf5lSjeYA,30805
3
3
  pyegeria/_client.py,sha256=lCWq8XJOFg3MnEO4ulMVuCJrW3uU4eWUCcbLEd90_LU,34673
4
4
  pyegeria/_deprecated_gov_engine.py,sha256=dWNcwVsE5__dF2u4QiIyQrssozzzOjBbLld8MdpmVCQ,17264
5
5
  pyegeria/_exceptions.py,sha256=1SrnV194V4_YJNnNAU0myTHQ3dhLn4GF2B2gZcj1u90,18153
6
- pyegeria/_globals.py,sha256=a_irI6oGuBLks2LzQHkSdK6xWbPdJCPRjqxK7PKxwgw,991
6
+ pyegeria/_globals.py,sha256=wTUFvZgk_evuGk9ds2lCegQT3FQfBJxgPaI-zWFsiMw,1012
7
7
  pyegeria/_validators.py,sha256=vP9nuZwucnCo_LrPU7hkitpWzaych5bTZEKE58TaTnQ,12726
8
8
  pyegeria/asset_catalog_omvs.py,sha256=P6FceMP0FgakGSOt3ePxpEbsF7nnypzo1aQahjdL_94,29021
9
9
  pyegeria/automated_curation_omvs.py,sha256=tzwCyXL0Hx8UjryBBWcPoEuBRajXZpLuwPQ1vuOg2yc,130349
@@ -16,7 +16,7 @@ pyegeria/commands/cat/README.md,sha256=-aaAnIT2fcfU63vajgB-RzQk4l4yFdhkyVfSaTPiq
16
16
  pyegeria/commands/cat/__init__.py,sha256=5OCy4m_yZsnSxdy_gvkCyP_OkjvuWKimqUGHYCJc_qA,450
17
17
  pyegeria/commands/cat/dr_egeria_inbox/glossary_creation_experiment.ipynb,sha256=dbzNu90fCKNohOWVSRBOB1GLyd95x8Qw51I5AkaPtso,11552
18
18
  pyegeria/commands/cat/dr_egeria_jupyter.py,sha256=h9LmDmejmaPDlDuGNlVor-bqNnKPvSBhcC7JFWBdOEM,5710
19
- pyegeria/commands/cat/dr_egeria_md.py,sha256=OCY1tu6NMi0-rTCTOuiRw6wHGZYNY9iS-XmCYRMoC0s,11610
19
+ pyegeria/commands/cat/dr_egeria_md.py,sha256=aR6qlZ3-DjtxuAmDcn4aKWgnyhYB-eRV7IkOhSA7j2E,11836
20
20
  pyegeria/commands/cat/exp_list_glossaries.py,sha256=dC6Bnfm3YSMTKPP146qeslIFRiZnGu5b7iDYE07p4iU,5817
21
21
  pyegeria/commands/cat/get_asset_graph.py,sha256=xnXJfpDTVH1TJ2TwE3dtjaXU36Di6-N6JAyhothzz2o,12461
22
22
  pyegeria/commands/cat/get_collection.py,sha256=kXPcP8u-SMWfrVyyBhNoxG8mcgB7EV_5i9N9w_IBU7o,5379
@@ -36,7 +36,7 @@ pyegeria/commands/cat/list_glossaries.py,sha256=D2ovkffSmnO-NQ7y-Jw0aDBtK2j06CQz
36
36
  pyegeria/commands/cat/list_projects.py,sha256=NzWTuepTGUEyxK-eWvuUxtBgCtNWubVwmz2eqm2UN1c,7997
37
37
  pyegeria/commands/cat/list_tech_type_elements.py,sha256=-9omj5en9dSP1xMSljYVHyfXsuhuE1bO2IFj_bZPhAs,6873
38
38
  pyegeria/commands/cat/list_tech_types.py,sha256=uqZcXHCzAznhEG6WWeM5j-spwUh8ycygFqpVDeXOG-0,4653
39
- pyegeria/commands/cat/list_terms.py,sha256=HPZ_S_5EwJezdgf8UY1dZiDbN5P9aD88pI_rBHftm1M,12185
39
+ pyegeria/commands/cat/list_terms.py,sha256=vgf4vqLqPGNTdCR3ptX0Xdqx_FR_Izu6SHrV1q1R6nE,12145
40
40
  pyegeria/commands/cat/list_todos.py,sha256=NitCw0uyVVjmN1hxb1W-I4FbOsa8wQxW2ICyOElHyc8,6556
41
41
  pyegeria/commands/cat/list_user_ids.py,sha256=X5Q-YNEp38saPYDuy9VwdQC5Qpa4HyC3WvAdbyp_P6M,5108
42
42
  pyegeria/commands/cli/__init__.py,sha256=hpTVSMP2gnPRhcAZPdeUEsQ-eaDySlXlk239dNWYmng,292
@@ -226,11 +226,11 @@ pyegeria/egeria_my_client.py,sha256=eOKLk2zdI6FHZnhAimfR_0yNdBjpUgD41dJZcJODcqE,
226
226
  pyegeria/egeria_tech_client.py,sha256=uycgYfCpb4jzFfaQ7I5JxbZ5PKsWdaWxLOJjbw6C2Zk,3817
227
227
  pyegeria/feedback_manager_omvs.py,sha256=0xBs0p54vmdfVYYgQ8pOanLC4fxfgTk1Z61Y6D1U7_I,152978
228
228
  pyegeria/full_omag_server_config.py,sha256=CQqLCy_3DZFvJZEOcGf50HWdFaWpiAIs6z-kKyjvpDA,47464
229
- pyegeria/glossary_browser_omvs.py,sha256=oxOch569LtyQA35sROtXjS_XAVD4Ek-2ApiqFoKRZRQ,161667
229
+ pyegeria/glossary_browser_omvs.py,sha256=YoiTgqm5wdF1ly6d3fwSUagkxvwzANKv6PFcDvI6zKY,172548
230
230
  pyegeria/glossary_manager_omvs.py,sha256=aGYZFuzWrPmPLLNwkNpV7-FsalqwDR7gyBzgdubnM04,87989
231
231
  pyegeria/m_test.py,sha256=M5-M2ZczsAJLXWfSeqTTADHdx6Ku-y4PbQ4M21JthAE,7778
232
232
  pyegeria/md_processing_helpers.py,sha256=sV-ciVg_xOGVGTH_CMpH2B5k3V5jzdFp_XvnQQ5xafw,2131
233
- pyegeria/md_processing_utils.py,sha256=wLt-lOxyVuMJr_JN90qJsbt9xD7eCexu_icGuPZqL5E,94233
233
+ pyegeria/md_processing_utils.py,sha256=77k_5aDcrcZB_bxIuYA2nssvRYfB-0CxMgj4lfADH78,96844
234
234
  pyegeria/md_processing_utils_orig.py,sha256=64eVP86__zI4EdzwveskDyLiw6EyWJXZW4pqk9aLpuM,52486
235
235
  pyegeria/mermaid_utilities.py,sha256=sQqdFUWdNpHu9d3Tk9UVe80M-5bOzses0XcFYX5FF-E,54254
236
236
  pyegeria/metadata_explorer_omvs.py,sha256=xHnZTQKbd6XwOhYia-RiIisrvZcqHi0SL1l6OCf04Gk,86911
@@ -245,8 +245,8 @@ pyegeria/template_manager_omvs.py,sha256=chBljs1vy5wr9DRAtbvIt4Cob_7HxGfxLkCNlDT
245
245
  pyegeria/utils.py,sha256=GCt1C0bp0Xng1ahzbZhzV9qQwH7Dj93IaCt2dvWb-sg,5417
246
246
  pyegeria/valid_metadata_omvs.py,sha256=Xq9DqBQvBFFJzaFIRKcVZ2k4gJvSh9yeXs_j-O3vn1w,65050
247
247
  pyegeria/x_action_author_omvs.py,sha256=RcqSzahUKCtvb_3u_wyintAlc9WFkC_2v0E12TZs8lQ,6433
248
- pyegeria-5.3.8.10.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
249
- pyegeria-5.3.8.10.dist-info/METADATA,sha256=_RPRxspNSRd8BtM8mymkGp6VvPRDVAWRMTnvSMjIUks,2758
250
- pyegeria-5.3.8.10.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
251
- pyegeria-5.3.8.10.dist-info/entry_points.txt,sha256=eAvQ_vkejlF3JzMzEc5VD93ymLA_hSFV0HM8fntG-d8,6791
252
- pyegeria-5.3.8.10.dist-info/RECORD,,
248
+ pyegeria-5.3.9.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
249
+ pyegeria-5.3.9.2.dist-info/METADATA,sha256=AGkUdX36k28Sor23eShJz3r_-tJ3ZmySZvQLpqfS4ns,2757
250
+ pyegeria-5.3.9.2.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
251
+ pyegeria-5.3.9.2.dist-info/entry_points.txt,sha256=eAvQ_vkejlF3JzMzEc5VD93ymLA_hSFV0HM8fntG-d8,6791
252
+ pyegeria-5.3.9.2.dist-info/RECORD,,