pyegeria 1.5.1.1.22__py3-none-any.whl → 1.5.1.1.24__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/commands/tech/list_tech_templates.py +193 -37
- pyegeria/glossary_manager_omvs.py +0 -1
- {pyegeria-1.5.1.1.22.dist-info → pyegeria-1.5.1.1.24.dist-info}/METADATA +1 -1
- {pyegeria-1.5.1.1.22.dist-info → pyegeria-1.5.1.1.24.dist-info}/RECORD +7 -7
- {pyegeria-1.5.1.1.22.dist-info → pyegeria-1.5.1.1.24.dist-info}/LICENSE +0 -0
- {pyegeria-1.5.1.1.22.dist-info → pyegeria-1.5.1.1.24.dist-info}/WHEEL +0 -0
- {pyegeria-1.5.1.1.22.dist-info → pyegeria-1.5.1.1.24.dist-info}/entry_points.txt +0 -0
@@ -1,27 +1,26 @@
|
|
1
1
|
"""This creates a templates guid file from the core metadata archive"""
|
2
|
-
import json
|
3
2
|
|
4
|
-
from rich.markdown import Markdown
|
5
|
-
from rich.prompt import Prompt
|
6
|
-
import os
|
7
|
-
from pyegeria import AutomatedCuration
|
8
|
-
from datetime import datetime
|
9
3
|
import argparse
|
10
|
-
import
|
4
|
+
import os
|
11
5
|
import sys
|
6
|
+
import time
|
7
|
+
from typing import Union
|
8
|
+
|
9
|
+
import nest_asyncio
|
12
10
|
from rich import box
|
13
11
|
from rich.console import Console
|
12
|
+
from rich.prompt import Prompt
|
14
13
|
from rich.table import Table
|
14
|
+
from textual.widgets import DataTable
|
15
15
|
|
16
|
+
from pyegeria import AutomatedCuration
|
16
17
|
from pyegeria import (
|
17
18
|
InvalidParameterException,
|
18
19
|
PropertyServerException,
|
19
20
|
UserNotAuthorizedException,
|
20
21
|
print_exception_response,
|
21
|
-
RegisteredInfo,
|
22
22
|
)
|
23
23
|
|
24
|
-
|
25
24
|
console = Console()
|
26
25
|
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
27
26
|
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
@@ -69,6 +68,21 @@ def list_templates(
|
|
69
68
|
return tech_info_list
|
70
69
|
|
71
70
|
|
71
|
+
def add_row(
|
72
|
+
table: Union[Table, DataTable],
|
73
|
+
name: str,
|
74
|
+
template_name: str,
|
75
|
+
template_guid: str,
|
76
|
+
placeholder_table: Table,
|
77
|
+
) -> Table | DataTable:
|
78
|
+
if isinstance(table, Table):
|
79
|
+
table.add_row(name, template_name, template_guid, placeholder_table)
|
80
|
+
elif isinstance(table, DataTable):
|
81
|
+
table.add_row(name, template_name, template_guid, placeholder_table)
|
82
|
+
|
83
|
+
return table
|
84
|
+
|
85
|
+
|
72
86
|
def display_templates_spec(
|
73
87
|
search_string: str,
|
74
88
|
server: str,
|
@@ -77,31 +91,37 @@ def display_templates_spec(
|
|
77
91
|
password: str,
|
78
92
|
jupyter: bool = EGERIA_JUPYTER,
|
79
93
|
width: int = EGERIA_WIDTH,
|
80
|
-
|
94
|
+
data_table: bool = False,
|
95
|
+
) -> Table | DataTable:
|
81
96
|
a_client = AutomatedCuration(server, url, username)
|
97
|
+
nest_asyncio.apply()
|
82
98
|
token = a_client.create_egeria_bearer_token(username, password)
|
83
99
|
tech_list = a_client.find_technology_types(search_string, page_size=0)
|
84
100
|
|
85
|
-
def generate_table() -> Table:
|
101
|
+
def generate_table(data_table: bool) -> Table | DataTable:
|
86
102
|
"""Make a new table."""
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
103
|
+
if data_table:
|
104
|
+
table = DataTable()
|
105
|
+
table.add_columns("Name", "Template Name", "Template GUID", "Placeholders")
|
106
|
+
else:
|
107
|
+
table = Table(
|
108
|
+
title=f"Technology Templates for: {url} @ {time.asctime()}",
|
109
|
+
style="bold bright_white on black",
|
110
|
+
row_styles=["bold bright_white on black"],
|
111
|
+
header_style="white on dark_blue",
|
112
|
+
title_style="bold bright_white on black",
|
113
|
+
caption_style="white on black",
|
114
|
+
show_lines=True,
|
115
|
+
box=box.ROUNDED,
|
116
|
+
caption=f"Templates from Server '{server}' @ Platform - {url}",
|
117
|
+
expand=True,
|
118
|
+
# width=500
|
119
|
+
)
|
100
120
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
121
|
+
table.add_column("Name", width=20)
|
122
|
+
table.add_column("Template Name", width=20)
|
123
|
+
table.add_column("Template GUID", width=38, no_wrap=True)
|
124
|
+
table.add_column("Placeholders")
|
105
125
|
|
106
126
|
if type(tech_list) is list:
|
107
127
|
for item in tech_list:
|
@@ -149,8 +169,9 @@ def display_templates_spec(
|
|
149
169
|
placeholder_description,
|
150
170
|
)
|
151
171
|
|
152
|
-
table.add_row(
|
153
|
-
|
172
|
+
# table.add_row(name, template_name, template_guid, placeholder_table)
|
173
|
+
table = add_row(
|
174
|
+
table, name, template_name, template_guid, placeholder_table
|
154
175
|
)
|
155
176
|
|
156
177
|
return table
|
@@ -159,10 +180,13 @@ def display_templates_spec(
|
|
159
180
|
sys.exit(1)
|
160
181
|
|
161
182
|
try:
|
162
|
-
|
183
|
+
if data_table:
|
184
|
+
return generate_table(data_table)
|
185
|
+
else:
|
186
|
+
console = Console(width=width, force_terminal=not jupyter)
|
163
187
|
|
164
|
-
|
165
|
-
|
188
|
+
with console.pager(styles=True):
|
189
|
+
console.print(generate_table(data_table))
|
166
190
|
|
167
191
|
except (
|
168
192
|
InvalidParameterException,
|
@@ -194,11 +218,143 @@ def main():
|
|
194
218
|
search_string = Prompt.ask(
|
195
219
|
"Enter the technology you are searching for:", default="*"
|
196
220
|
)
|
197
|
-
|
198
|
-
|
221
|
+
display_templates_spec(
|
222
|
+
search_string, server, url, userid, password, data_table=False
|
223
|
+
)
|
199
224
|
except KeyboardInterrupt:
|
200
225
|
pass
|
201
226
|
|
202
227
|
|
203
|
-
|
204
|
-
|
228
|
+
# def display_templates_spec(
|
229
|
+
# search_string: str,
|
230
|
+
# server: str,
|
231
|
+
# url: str,
|
232
|
+
# username: str,
|
233
|
+
# password: str,
|
234
|
+
# jupyter: bool = EGERIA_JUPYTER,
|
235
|
+
# width: int = EGERIA_WIDTH,
|
236
|
+
# ):
|
237
|
+
# a_client = AutomatedCuration(server, url, username)
|
238
|
+
# token = a_client.create_egeria_bearer_token(username, password)
|
239
|
+
# tech_list = a_client.find_technology_types(search_string, page_size=0)
|
240
|
+
#
|
241
|
+
# def generate_table() -> Table:
|
242
|
+
# """Make a new table."""
|
243
|
+
# table = Table(
|
244
|
+
# title=f"Technology Templates for: {url} @ {time.asctime()}",
|
245
|
+
# style="bold bright_white on black",
|
246
|
+
# row_styles=["bold bright_white on black"],
|
247
|
+
# header_style="white on dark_blue",
|
248
|
+
# title_style="bold bright_white on black",
|
249
|
+
# caption_style="white on black",
|
250
|
+
# show_lines=True,
|
251
|
+
# box=box.ROUNDED,
|
252
|
+
# caption=f"Templates from Server '{server}' @ Platform - {url}",
|
253
|
+
# expand=True,
|
254
|
+
# # width=500
|
255
|
+
# )
|
256
|
+
#
|
257
|
+
# table.add_column("Name", width=20)
|
258
|
+
# table.add_column("Template Name", width=20)
|
259
|
+
# table.add_column("Template GUID", width=38, no_wrap=True)
|
260
|
+
# table.add_column("Placeholders")
|
261
|
+
#
|
262
|
+
# if type(tech_list) is list:
|
263
|
+
# for item in tech_list:
|
264
|
+
# if "deployedImplementationType" not in item["qualifiedName"]:
|
265
|
+
# continue
|
266
|
+
# placeholder_table = Table(expand=False, show_lines=True)
|
267
|
+
# placeholder_table.add_column("Name", width=20, no_wrap=True)
|
268
|
+
# placeholder_table.add_column("Type", width=10)
|
269
|
+
# placeholder_table.add_column("Required", width=10)
|
270
|
+
# placeholder_table.add_column("Example", width=20)
|
271
|
+
# placeholder_table.add_column("Description", width=40)
|
272
|
+
#
|
273
|
+
# name = item.get("name", "none")
|
274
|
+
#
|
275
|
+
# details = a_client.get_technology_type_detail(name)
|
276
|
+
# if type(details) is str:
|
277
|
+
# console.log(f"Missing details for - {name}: {details}")
|
278
|
+
# continue
|
279
|
+
#
|
280
|
+
# templates = details.get("catalogTemplates", "Not Found")
|
281
|
+
# if type(templates) is not str:
|
282
|
+
# for template in templates:
|
283
|
+
# template_name = template.get("name", None)
|
284
|
+
#
|
285
|
+
# template_name = (
|
286
|
+
# f"{name}_Template"
|
287
|
+
# if template_name is None
|
288
|
+
# else template_name
|
289
|
+
# )
|
290
|
+
#
|
291
|
+
# specification = template["specification"]["placeholderProperty"]
|
292
|
+
# template_guid = template["relatedElement"]["guid"]
|
293
|
+
#
|
294
|
+
# for placeholder in specification:
|
295
|
+
# placeholder_data_type = placeholder["dataType"]
|
296
|
+
# placeholder_description = placeholder["description"]
|
297
|
+
# placeholder_name = placeholder["placeholderPropertyName"]
|
298
|
+
# placeholder_required = placeholder["required"]
|
299
|
+
# placeholder_example = placeholder.get("example", None)
|
300
|
+
# placeholder_table.add_row(
|
301
|
+
# placeholder_name,
|
302
|
+
# placeholder_data_type,
|
303
|
+
# placeholder_required,
|
304
|
+
# placeholder_example,
|
305
|
+
# placeholder_description,
|
306
|
+
# )
|
307
|
+
#
|
308
|
+
# table.add_row(
|
309
|
+
# name, template_name, template_guid, placeholder_table
|
310
|
+
# )
|
311
|
+
#
|
312
|
+
# return table
|
313
|
+
# else:
|
314
|
+
# print("Unknown technology type")
|
315
|
+
# sys.exit(1)
|
316
|
+
#
|
317
|
+
# try:
|
318
|
+
# console = Console(width=width, force_terminal=not jupyter)
|
319
|
+
#
|
320
|
+
# with console.pager(styles=True):
|
321
|
+
# console.print(generate_table())
|
322
|
+
#
|
323
|
+
# except (
|
324
|
+
# InvalidParameterException,
|
325
|
+
# PropertyServerException,
|
326
|
+
# UserNotAuthorizedException,
|
327
|
+
# ) as e:
|
328
|
+
# print_exception_response(e)
|
329
|
+
# assert e.related_http_code != "200", "Invalid parameters"
|
330
|
+
# finally:
|
331
|
+
# a_client.close_session()
|
332
|
+
#
|
333
|
+
#
|
334
|
+
# def main():
|
335
|
+
# parser = argparse.ArgumentParser()
|
336
|
+
# parser.add_argument("--server", help="Name of the server to display status for")
|
337
|
+
# parser.add_argument("--url", help="URL Platform to connect to")
|
338
|
+
# parser.add_argument("--userid", help="User Id")
|
339
|
+
# parser.add_argument("--password", help="Password")
|
340
|
+
#
|
341
|
+
# args = parser.parse_args()
|
342
|
+
#
|
343
|
+
# server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
344
|
+
# url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
345
|
+
# userid = args.userid if args.userid is not None else EGERIA_USER
|
346
|
+
# password = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
347
|
+
# guid = None
|
348
|
+
#
|
349
|
+
# try:
|
350
|
+
# search_string = Prompt.ask(
|
351
|
+
# "Enter the technology you are searching for:", default="*"
|
352
|
+
# )
|
353
|
+
# # display_templates_spec(search_string, server, url, userid, password)
|
354
|
+
# list_templates(search_string, server, url, userid, password)
|
355
|
+
# except KeyboardInterrupt:
|
356
|
+
# pass
|
357
|
+
#
|
358
|
+
#
|
359
|
+
# if __name__ == "__main__":
|
360
|
+
# main()
|
@@ -81,7 +81,7 @@ pyegeria/commands/tech/list_registered_services.py,sha256=QzE_ebdopNkHWMxa-xc902
|
|
81
81
|
pyegeria/commands/tech/list_related_elements.py,sha256=mcOy3RIGpIdshcT1o4Tr7Ck-c1dmAC8yBUOF5GAFYrM,7755
|
82
82
|
pyegeria/commands/tech/list_related_specification.py,sha256=mWrKenXOskL4cl0DHjH2Z8M9-FJzjkzK62W-tsx3WDU,5918
|
83
83
|
pyegeria/commands/tech/list_relationship_types.py,sha256=BlVzrPznZXqMVLN2-2vYEVRGeYsiJrqXxIJEikobyoo,5875
|
84
|
-
pyegeria/commands/tech/list_tech_templates.py,sha256=
|
84
|
+
pyegeria/commands/tech/list_tech_templates.py,sha256=FIeYWnJY2bVUrfDQBJX2bpkp5cU7uPak52eJtB4vVu4,14146
|
85
85
|
pyegeria/commands/tech/list_valid_metadata_values.py,sha256=N3D0_BmREPszgde3uvvYdfzq7DJ46uMOv2t1vtncGsw,6333
|
86
86
|
pyegeria/commands/tech/table_tech_templates.py,sha256=xa_mA10P_6Su3zRsvyoZhWoSUQ5LuyLTG1kNCumzxZA,7268
|
87
87
|
pyegeria/commands/tech/x_list_related_elements.py,sha256=qBsf1619cecaMCTzG0MG22fAT32WNH2Z3CXrjo9z-5Y,5853
|
@@ -95,7 +95,7 @@ pyegeria/egeria_tech_client.py,sha256=7NfqpJFft5GR4NPRDVDw22L9caHbXB8fhx0TAf6qEo
|
|
95
95
|
pyegeria/feedback_manager_omvs.py,sha256=B66e3ZCaC_dirb0mcb2Nz3PYh2ZKsoMAYNOb3euNiro,152931
|
96
96
|
pyegeria/full_omag_server_config.py,sha256=LBnqUiz1ofBdlKBzECFs_pQbdJwcWigAukWHGJRR2nU,47340
|
97
97
|
pyegeria/glossary_browser_omvs.py,sha256=NcitYaZJqwVODBO5zBtWpXPNUJJ3DKzEbRaOFSAyUlg,93554
|
98
|
-
pyegeria/glossary_manager_omvs.py,sha256=
|
98
|
+
pyegeria/glossary_manager_omvs.py,sha256=BWnSNiNuyjA6zQA2loLKxiMaUGnRazIg9RfQKg7kD5U,126277
|
99
99
|
pyegeria/mermaid_utilities.py,sha256=GXiS-subb5nJcDqlThZWX2T8WspU1neFfhf4TxRoMh4,8344
|
100
100
|
pyegeria/my_profile_omvs.py,sha256=DyECbUFEcgokrIbzdMMNljC3bqfqKGXAF2wZEpzvRYs,34666
|
101
101
|
pyegeria/platform_services.py,sha256=CJIOYIFEbcIGwdWlApAQcXxZTsdrhFtpJcm4O3p7dG0,41646
|
@@ -107,8 +107,8 @@ pyegeria/template_manager_omvs.py,sha256=heqbKeum5hPCHap4r1RUZU8YB3QaQlxVNbq4GZi
|
|
107
107
|
pyegeria/utils.py,sha256=1h6bwveadd6GpbnGLTmqPBmBk68QvxdjGTI9RfbrgKY,5415
|
108
108
|
pyegeria/valid_metadata_omvs.py,sha256=tfCGXed5LLt59YA8uZNNtd9UJ-lRZfPU_uZxK31Yux0,65069
|
109
109
|
pyegeria/x_action_author_omvs.py,sha256=xu1IQ0YbhIKi17C5a7Aq9u1Az2czwahNPpX9czmyVxE,6454
|
110
|
-
pyegeria-1.5.1.1.
|
111
|
-
pyegeria-1.5.1.1.
|
112
|
-
pyegeria-1.5.1.1.
|
113
|
-
pyegeria-1.5.1.1.
|
114
|
-
pyegeria-1.5.1.1.
|
110
|
+
pyegeria-1.5.1.1.24.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
111
|
+
pyegeria-1.5.1.1.24.dist-info/METADATA,sha256=mTEyt5Vd1AOfU9SW6s9s473evYU-t1dH2SG88mgPtMw,2998
|
112
|
+
pyegeria-1.5.1.1.24.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
113
|
+
pyegeria-1.5.1.1.24.dist-info/entry_points.txt,sha256=49rVcJuuKXUSC-9ZNzr-ybsaUL-wm6xrUodCZeKJdGc,4898
|
114
|
+
pyegeria-1.5.1.1.24.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|