pyegeria 5.4.0.4__py3-none-any.whl → 5.4.0.6__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,52 +16,44 @@ from rich.markdown import Markdown
16
16
  from rich.prompt import Prompt
17
17
  from rich.table import Table
18
18
  from rich.text import Text
19
-
19
+ from loguru import logger
20
20
  from pyegeria import (
21
- # EgeriaTech,
22
- # InvalidParameterException,
23
- # PropertyServerException,
24
- # UserNotAuthorizedException,
25
21
  CollectionManager,
26
- NO_ELEMENTS_FOUND,config_logging, get_app_config
22
+ NO_ELEMENTS_FOUND,config_logging, get_app_config, init_logging
27
23
  )
28
24
  from pyegeria._exceptions_new import PyegeriaException, print_exception_response
29
25
 
30
-
31
-
32
- # disable_ssl_warnings = True
33
-
34
- # EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
35
- # EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
36
- # EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
37
- # EGERIA_VIEW_SERVER = os.environ.get("EGERIA_VIEW_SERVER", "view-server")
38
- # EGERIA_VIEW_SERVER_URL = os.environ.get(
39
- # "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
40
- # )
41
- # EGERIA_INTEGRATION_DAEMON = os.environ.get("EGERIA_INTEGRATION_DAEMON", "integration-daemon")
42
- # EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
43
- # EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
44
26
  EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
45
27
  EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
46
- # EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
47
- # EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
48
- # EGERIA_GLOSSARY_PATH = os.environ.get("EGERIA_GLOSSARY_PATH", None)
49
- # EGERIA_ROOT_PATH = os.environ.get("EGERIA_ROOT_PATH", "../../")
50
- # EGERIA_INBOX_PATH = os.environ.get("EGERIA_INBOX_PATH", "md_processing/dr_egeria_inbox")
51
- # EGERIA_OUTBOX_PATH = os.environ.get("EGERIA_OUTBOX_PATH", "md_processing/dr_egeria_outbox")
52
- app_settings = get_app_config()
53
- app_config = app_settings["Environment"]
28
+ PYEGERIA_ROOT_PATH= os.environ.get("PYEGERIA_ROOT_PATH", "/Users/dwolfson/localGit/egeria-v5-3/egeria-python")
29
+ app_settings = get_app_config(PYEGERIA_ROOT_PATH+"/.env")
30
+ app_config = app_settings.Environment
54
31
  config_logging()
55
32
 
33
+ out_struct = {
34
+ "formats": {
35
+ "types": ["ALL"],
36
+ "columns": [
37
+ {'name': 'display_name', 'key': 'display_name'},
38
+ {'name': 'qualified_name', 'key': 'qualified_name', 'format': True},
39
+ {'name': 'description', 'key': 'description', 'format': True},
40
+ {'name': "classifications", 'key': 'classifications'},
41
+ {'name': 'members', 'key': 'members', 'format': True},
42
+ {'name': 'collection_type', 'key': 'collection_type', 'format': True},
43
+ {'name': 'GUID', 'key': 'GUID'},
44
+ ],
45
+ },
46
+
47
+ }
56
48
 
57
49
  def display_collections(
58
50
  search_string: str = "*",
59
- view_server: str = app_config['Egeria View Server'],
60
- view_url: str = app_config['Egeria View Server URL'],
61
- user: str = EGERIA_USER,
62
- user_pass: str = EGERIA_USER_PASSWORD,
63
- jupyter: bool = app_config['Egeria Jupyter'],
64
- width: int = app_config['Console Width'],
51
+ view_server: str = app_config.egeria_view_server,
52
+ view_url: str = app_config.egeria_view_server_url,
53
+ user: str = app_settings.User_Profile.user_name,
54
+ user_pass: str = app_settings.User_Profile.user_pwd,
55
+ jupyter: bool = app_config.egeria_jupyter,
56
+ width: int = app_config.console_width,
65
57
  output_format: str = "TABLE"
66
58
  ):
67
59
  """Display either a specified glossary or all collections if the search_string is '*'.
@@ -144,9 +136,10 @@ def display_collections(
144
136
 
145
137
  collections = m_client.find_collections(
146
138
  search_string.strip(), None, True, False, ignore_case=True,
147
- output_format = "DICT"
139
+ output_format = "DICT", output_format_set=out_struct
148
140
  )
149
141
  if type(collections) is list:
142
+
150
143
  sorted_collection_list = sorted(
151
144
  collections, key=lambda k: k["display_name"]
152
145
  )
@@ -203,13 +196,13 @@ def main():
203
196
  parser.add_argument("--password", help="User Password")
204
197
 
205
198
  args = parser.parse_args()
206
- app_settings = get_app_config()
207
- app_config = app_settings["Environment"]
199
+ # app_settings = get_app_config(PYEGERIA_ROOT_PATH + "/.env")
200
+ # app_config = app_settings.Environment
208
201
 
209
- server = args.server if args.server is not None else app_config['Egeria View Server']
210
- url = args.url if args.url is not None else app_config['Egeria View Server URL']
211
- userid = args.userid if args.userid is not None else EGERIA_USER
212
- user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
202
+ server = args.server if args.server is not None else app_config.egeria_view_server
203
+ url = args.url if args.url is not None else app_config.egeria_view_server_url
204
+ userid = args.userid if args.userid is not None else app_settings.User_Profile.user_name
205
+ user_pass = args.password if args.password is not None else app_settings.User_Profile.user_pwd
213
206
 
214
207
  try:
215
208
  search_string = Prompt.ask(
@@ -227,4 +220,7 @@ def main():
227
220
 
228
221
 
229
222
  if __name__ == "__main__":
223
+ # EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
224
+ # EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
225
+ # PYEGERIA_ROOT_PATH = os.environ.get("PYEGERIA_ROOT_PATH", "/Users/dwolfson/localGit/egeria-v5-3/egeria-python")
230
226
  main()
@@ -61,21 +61,21 @@ from pyegeria.egeria_tech_client import EgeriaTech
61
61
  EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
62
62
  EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
63
63
  app_settings = get_app_config()
64
- app_config = app_settings["Environment"]
64
+ app_config = app_settings.Environment
65
65
  config_logging()
66
66
 
67
67
  console = Console(
68
68
  style="bold bright_white on black",
69
- width=app_config["Console Width"],
70
- force_terminal=not app_config["Egeria Jupyter"],
69
+ width=app_config.console_width,
70
+ force_terminal=not app_config.egeria_jupyter,
71
71
  )
72
72
 
73
73
  def execute_format_set_action(
74
74
  format_set_name: str,
75
- view_server: str = app_config['Egeria View Server'],
76
- view_url: str = app_config['Egeria View Server URL'],
77
- user: str = EGERIA_USER,
78
- user_pass: str = EGERIA_USER_PASSWORD,
75
+ view_server: str = app_config.egeria_view_server,
76
+ view_url: str = app_config.egeria_view_server_url,
77
+ user: str = app_settings.User_Profile.user_name,
78
+ user_pass: str = app_settings.User_Profile.user_pwd,
79
79
  output_format: str = "TABLE",
80
80
  **kwargs
81
81
  ):
@@ -225,7 +225,7 @@ def execute_format_set_action(
225
225
 
226
226
  with open(full_file_path, 'w') as f:
227
227
  f.write(output)
228
- print(f"\n==> Output written to {full_file_path}")
228
+ print(f"\n==> Output written to [{format_set_name}]({full_file_path})")
229
229
  return
230
230
 
231
231
  # For TABLE output, add output_format to params
commands/cli/egeria.py CHANGED
@@ -138,8 +138,8 @@ from commands.tech.generic_actions import delete_element
138
138
  EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
139
139
  EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
140
140
  app_settings = get_app_config()
141
- app_config = app_settings["Environment"]
142
- # config_logging()
141
+ app_config = app_settings.Environment
142
+ config_logging()
143
143
 
144
144
 
145
145
  @tui()
@@ -148,42 +148,42 @@ app_config = app_settings["Environment"]
148
148
  @click.group()
149
149
  @click.option(
150
150
  "--server",
151
- default=app_config['Egeria Metadata Store'],
151
+ default=app_config.egeria_metadata_store,
152
152
  help="Egeria metadata store to work with",
153
153
  )
154
154
  @click.option(
155
155
  "--url",
156
- default=app_config["Egeria Platform URL"],
156
+ default=app_config.egeria_platform_url,
157
157
  help="URL of Egeria metadata store platform to connect to",
158
158
  )
159
159
  @click.option(
160
160
  "--integration_daemon",
161
- default=app_config["Egeria Integration Daemon"],
161
+ default=app_config.egeria_integration_daemon,
162
162
  help="Egeria integration daemon to work with",
163
163
  )
164
164
  @click.option(
165
165
  "--integration_daemon_url",
166
- default=app_config['Egeria Integration Daemon URL'],
166
+ default=app_config.egeria_integration_daemon_url,
167
167
  help="URL of Egeria integration daemon platform to connect to",
168
168
  )
169
169
  @click.option(
170
170
  "--view_server",
171
- default=app_config['Egeria View Server'],
171
+ default=app_config.egeria_view_server,
172
172
  help="Egeria view server to work with",
173
173
  )
174
174
  @click.option(
175
175
  "--view_server_url",
176
- default=app_config['Egeria View Server URL'],
176
+ default=app_config.egeria_view_server_url,
177
177
  help="URL of Egeria view server platform to connect to",
178
178
  )
179
179
  @click.option(
180
180
  "--engine_host",
181
- default=app_config['Egeria Engine Host'],
181
+ default=app_config.egeria_engine_host,
182
182
  help="Egeria engine host to work with",
183
183
  )
184
184
  @click.option(
185
185
  "--engine_host_url",
186
- default=app_config['Egeria Engine Host URL'],
186
+ default=app_config.egeria_engine_host_url,
187
187
  help="URL of Egeria engine host platform to connect to",
188
188
  )
189
189
 
@@ -202,40 +202,40 @@ app_config = app_settings["Environment"]
202
202
  "--jupyter",
203
203
  is_flag=True,
204
204
  type=bool,
205
- default=app_config['Egeria Jupyter'],
205
+ default=app_config.egeria_jupyter,
206
206
  help="Enable for rendering in a Jupyter terminal",
207
207
  )
208
208
  @click.option(
209
209
  "--width",
210
- default=app_config['Console Width'],
210
+ default=app_config.console_width,
211
211
  type=int,
212
212
  help="Screen width, in characters, to use",
213
213
  )
214
214
  @click.option(
215
- "--home_glossary_guid",
216
- default=app_settings['User Profile']['Egeria Home Glossary Name'],
215
+ "--home_glossary_name",
216
+ default=app_settings.User_Profile.egeria_home_glossary_name,
217
217
  help="Glossary name to use as the home glossary",
218
218
  )
219
219
  @click.option(
220
220
  "--glossary_path",
221
- default=app_config['Egeria Glossary Path'],
221
+ default=app_config.egeria_glossary_path,
222
222
  help="Path to glossary import/export files",
223
223
  )
224
224
 
225
225
  @click.option(
226
226
  "--root_path",
227
- default=app_config['Pyegeria Root'],
227
+ default=app_config.pyegeria_root,
228
228
  help="Root path to use for file operations",
229
229
  )
230
230
 
231
231
  @click.option(
232
232
  "--inbox_path",
233
- default=app_config['Dr.Egeria Inbox'],
233
+ default=app_config.dr_egeria_inbox,
234
234
  help="Path to inbox files",
235
235
  )
236
236
  @click.option(
237
237
  "--outbox_path",
238
- default=app_config['Dr.Egeria Outbox'],
238
+ default=app_config.dr_egeria_outbox,
239
239
  help="Path to outbox files",
240
240
  )
241
241
 
@@ -255,7 +255,7 @@ def cli(
255
255
  timeout,
256
256
  jupyter,
257
257
  width,
258
- home_glossary_guid,
258
+ home_glossary_name,
259
259
  glossary_path,
260
260
  root_path,
261
261
  inbox_path,
@@ -276,7 +276,7 @@ def cli(
276
276
  timeout,
277
277
  jupyter,
278
278
  width,
279
- home_glossary_guid,
279
+ home_glossary_name,
280
280
  glossary_path,
281
281
  root_path,
282
282
  inbox_path,
@@ -80,37 +80,37 @@ app_config = app_settings["Environment"]
80
80
  )
81
81
  @click.option(
82
82
  "--url",
83
- default=app_config["Egeria Platform URL"],
83
+ default=app_config.egeria_platform_url,
84
84
  help="URL of Egeria metadata store platform to connect to",
85
85
  )
86
86
  @click.option(
87
87
  "--integration_daemon",
88
- default=app_config["Egeria Integration Daemon"],
88
+ default=app_config.egeria_integration_daemon,
89
89
  help="Egeria integration daemon to work with",
90
90
  )
91
91
  @click.option(
92
92
  "--integration_daemon_url",
93
- default=app_config['Egeria Integration Daemon URL'],
93
+ default=app_config.egeria_integration_daemon_url,
94
94
  help="URL of Egeria integration daemon platform to connect to",
95
95
  )
96
96
  @click.option(
97
97
  "--view_server",
98
- default=app_config['Egeria View Server'],
98
+ default=app_config.egeria_view_server,
99
99
  help="Egeria view server to work with",
100
100
  )
101
101
  @click.option(
102
102
  "--view_server_url",
103
- default=app_config['Egeria View Server URL'],
103
+ default=app_config.egeria_view_server_url,
104
104
  help="URL of Egeria view server platform to connect to",
105
105
  )
106
106
  @click.option(
107
107
  "--engine_host",
108
- default=app_config['Egeria Engine Host'],
108
+ default=app_config.egeria_engine_host,
109
109
  help="Egeria engine host to work with",
110
110
  )
111
111
  @click.option(
112
112
  "--engine_host_url",
113
- default=app_config['Egeria Engine Host URL'],
113
+ default=app_config.egeria_engine_host_url,
114
114
  help="URL of Egeria engine host platform to connect to",
115
115
  )
116
116
 
@@ -129,40 +129,40 @@ app_config = app_settings["Environment"]
129
129
  "--jupyter",
130
130
  is_flag=True,
131
131
  type=bool,
132
- default=app_config['Egeria Jupyter'],
132
+ default=app_config.egeria_jupyter,
133
133
  help="Enable for rendering in a Jupyter terminal",
134
134
  )
135
135
  @click.option(
136
136
  "--width",
137
- default=app_config['Console Width'],
137
+ default=app_config.console__width,
138
138
  type=int,
139
139
  help="Screen width, in characters, to use",
140
140
  )
141
141
  @click.option(
142
142
  "--home_glossary_guid",
143
- default=app_settings['User Profile']['Egeria Home Glossary Name'],
143
+ default=app_settings.User_Profile.home_glossary_guid,
144
144
  help="Glossary name to use as the home glossary",
145
145
  )
146
146
  @click.option(
147
147
  "--glossary_path",
148
- default=app_config['Egeria Glossary Path'],
148
+ default=app_config.egeria_platform_glossary_path,
149
149
  help="Path to glossary import/export files",
150
150
  )
151
151
 
152
152
  @click.option(
153
153
  "--root_path",
154
- default=app_config['Pyegeria Root'],
154
+ default=app_config.pyegeria_root,
155
155
  help="Root path to use for file operations",
156
156
  )
157
157
 
158
158
  @click.option(
159
159
  "--inbox_path",
160
- default=app_config['Dr.Egeria Inbox'],
160
+ default=app_config.dr_egeria_inbox,
161
161
  help="Path to inbox files",
162
162
  )
163
163
  @click.option(
164
164
  "--outbox_path",
165
- default=app_config['Dr.Egeria Outbox'],
165
+ default=app_config.dr_egeria_outbox,
166
166
  help="Path to outbox files",
167
167
  )
168
168
 
@@ -17,7 +17,7 @@ class Config(object):
17
17
  timeout: int,
18
18
  jupyter: bool,
19
19
  width: int,
20
- home_glossary_guid: str,
20
+ home_glossary_name: str,
21
21
  glossary_path: str,
22
22
  root_path: str,
23
23
  inbox_path: str,
@@ -39,7 +39,7 @@ class Config(object):
39
39
  self.width = width
40
40
  self.server = server
41
41
  self.url = url
42
- self.home_glossary_guid = home_glossary_guid
42
+ self.home_glossary_name = home_glossary_name
43
43
  self.glossary_path = glossary_path
44
44
  self.root_path = root_path
45
45
  self.inbox_path = inbox_path
pyegeria/__init__.py CHANGED
@@ -11,7 +11,7 @@ the server platform and servers.
11
11
 
12
12
  """
13
13
  from .load_config import load_app_config, get_app_config
14
- from .logging_configuration import config_logging
14
+ from .logging_configuration import config_logging, init_logging
15
15
  from ._globals import (INTEGRATION_GUIDS, TEMPLATE_GUIDS, default_time_out, disable_ssl_warnings, enable_ssl_check,
16
16
  is_debug, max_paging_size, NO_ELEMENTS_FOUND, NO_ASSETS_FOUND, NO_SERVERS_FOUND,
17
17
  NO_CATALOGS_FOUND, NO_GLOSSARIES_FOUND, NO_TERMS_FOUND, NO_CATEGORIES_FOUND, NO_ELEMENT_FOUND,
@@ -360,3 +360,32 @@ def print_exception_table(e: PyegeriaException):
360
360
  console.print(table)
361
361
  else:
362
362
  print(f"\n\n\t Not an Pyegeria exception {e}")
363
+
364
+ def print_basic_exception(e: PyegeriaException):
365
+ """Prints the exception response"""
366
+ related_code = e.related_http_code if hasattr(e, "related_http_code") else ""
367
+ related_response = e.response.json()
368
+ table = Table(title=f"Exception: {e.__class__.__name__}", show_lines=True, header_style="bold", box=box.HEAVY_HEAD)
369
+ table.caption = e.pyegeria_code
370
+ table.add_column("Facet", justify="center")
371
+ table.add_column("Item", justify="left", width=80)
372
+
373
+ if isinstance(e, PyegeriaException):
374
+ table.add_row("HTTP Code", str(e.response_code))
375
+ table.add_row("Egeria Code", str(related_code))
376
+ table.add_row("Caller Method", e.context.get("caller method", "---"))
377
+ table.add_row("Request URL", str(e.response_url))
378
+ table.add_row("Egeria Message",
379
+ format_dict_to_string(related_response.get('exceptionErrorMessage',"")))
380
+ table.add_row("Egeria User Action",
381
+ format_dict_to_string(related_response.get('exceptionUserAction',"")))
382
+
383
+ exception_msg_id = related_response.get("exceptionErrorMessageId", None)
384
+ table.add_row("Pyegeria Exception", exception_msg_id)
385
+ table.add_row("Pyegeria Message",
386
+ f"\n\t{e.error_details['message_template'].format(exception_msg_id)}\n")
387
+
388
+
389
+ console.print(table)
390
+ else:
391
+ print(f"\n\n\t Not an Pyegeria exception {e}")
@@ -96,7 +96,7 @@ output_format_sets = {
96
96
  "aliases": ["Collection", "RootCollection", "Folder", "ReferenceList", "HomeCollection",
97
97
  "ResultSet", "RecentAccess", "WorkItemList", "Namespace"],
98
98
  "annotations": COMMON_ANNOTATIONS,
99
- "formats": [COMMON_FORMATS_ALL, COLLECTION_DICT, COLLECTION_TABLE], # Reusing common formats
99
+ "formats": [ COLLECTION_DICT, COLLECTION_TABLE,COMMON_FORMATS_ALL], # Reusing common formats
100
100
  "action": [{"function": "CollectionManager.find_collections",
101
101
  "user_params": [ "search_string"],
102
102
  "spec_params": { },
@@ -155,7 +155,7 @@ output_format_sets = {
155
155
  "description": "Attributes useful to Data Specification.",
156
156
  "aliases": ["Data Spec", "DataSpec", "DataSpecification"],
157
157
  "annotations": {"wikilinks": ["[[Data Specification]]"]},
158
- "formats": [{"types": ["TABLE"], "columns": COMMON_COLUMNS,}], # Reusing common formats and columns
158
+ "formats": [{"types": ["DICT"], "columns": COMMON_COLUMNS,}], # Reusing common formats and columns
159
159
  "action": [{"function": "CollectionManager.find_collections",
160
160
  "user_params": [ "search_string"],
161
161
  "spec_params": { "classification_name": "DataSpec" },
@@ -172,6 +172,17 @@ output_format_sets = {
172
172
  "spec_params": { },
173
173
  }]
174
174
  },
175
+ "DataField": {
176
+ "heading": "Data Structure Information",
177
+ "description": "Attributes useful to Data Structures.",
178
+ "aliases": ["Data Field", "Data Fields", "DataFields"],
179
+ "annotations": {"wikilinks": ["[[Data Field]]"]},
180
+ "formats": [{"types": ["ALL"], "columns" : COMMON_COLUMNS}], # Reusing common formats and columns
181
+ "action": [{"function": "DataDesigner.find_data_fields",
182
+ "user_params": ["search_string" ],
183
+ "spec_params": { },
184
+ }]
185
+ },
175
186
  "Mandy-DataStruct": {
176
187
  "heading": "Puddy Approves",
177
188
  "description": "This is a tutorial on how to use a data struct description",
@@ -254,7 +265,22 @@ def select_output_format_set(kind: str, output_type: str) -> dict | None:
254
265
  def output_format_set_list()->list[str]:
255
266
  return list(output_format_sets.keys())
256
267
 
257
- def get_output_format_set_heading(format_set: str) -> str:
268
+ def get_output_format_set_heading(format_set: dict) -> str:
258
269
  return output_format_sets[format_set].get("heading")
259
- def get_output_format_set_description(format_set: str) -> str:
270
+ def get_output_format_set_description(format_set: dict) -> str:
260
271
  return output_format_sets[format_set].get("description")
272
+
273
+ def get_output_format_type_match(format_set: dict, output_format: str) -> dict:
274
+ if isinstance(format_set, list):
275
+ for format in format_set.get("formats", []):
276
+ if output_format in format.get("types", []):
277
+ format_set["formats"] = format
278
+ return format_set
279
+
280
+ # Step 5: Handle the fallback case of "ALL"
281
+ for format in format_set.get("formats", []):
282
+ if "ALL" in format.get("types", []):
283
+ format_set["formats"] = format
284
+ return format_set
285
+ else:
286
+ return format_set
@@ -11,7 +11,7 @@ from typing import Dict, Union, List, Optional
11
11
 
12
12
  from loguru import logger
13
13
 
14
- from pyegeria._output_formats import select_output_format_set
14
+ from pyegeria._output_formats import select_output_format_set, get_output_format_type_match
15
15
  from pyegeria._client import Client
16
16
  from pyegeria._globals import NO_ELEMENTS_FOUND, NO_GUID_RETURNED, NO_MEMBERS_FOUND
17
17
  from pyegeria._validators import validate_guid, validate_search_string
@@ -150,8 +150,8 @@ class CollectionManager(Client2):
150
150
 
151
151
  if output_format != 'JSON': # return a simplified markdown representation
152
152
  logger.info(f"Found elements, output format: {output_format}, output_format_set: {output_format_set}")
153
- return self.generate_collection_output(elements, None, None, output_format,
154
- output_format_set=output_format_set)
153
+ return self._generate_collection_output(elements, None, None, output_format,
154
+ output_format_set=output_format_set)
155
155
  return elements
156
156
 
157
157
 
@@ -303,8 +303,8 @@ class CollectionManager(Client2):
303
303
 
304
304
  if output_format != 'JSON': # return a simplified markdown representation
305
305
  logger.info(f"Found elements, output format: {output_format}, output_format_set: {output_format_set}")
306
- return self.generate_collection_output(elements, None, classification_name,
307
- output_format, output_format_set)
306
+ return self._generate_collection_output(elements, None, classification_name,
307
+ output_format, output_format_set)
308
308
  return elements
309
309
 
310
310
 
@@ -549,8 +549,8 @@ class CollectionManager(Client2):
549
549
 
550
550
  if output_format != 'JSON': # return a simplified markdown representation
551
551
  logger.info(f"Found elements, output format: {output_format}, output_format_set: {output_format_set}")
552
- return self.generate_collection_output(elements, filter, classification_name,
553
- output_format, output_format_set)
552
+ return self._generate_collection_output(elements, filter, classification_name,
553
+ output_format, output_format_set)
554
554
  return elements
555
555
 
556
556
 
@@ -687,8 +687,8 @@ class CollectionManager(Client2):
687
687
 
688
688
  if output_format != 'JSON': # return a simplified markdown representation
689
689
  logger.info(f"Found elements, output format: {output_format}, output_format_set: {output_format_set}")
690
- return self.generate_collection_output(elements, filter, collection_type,
691
- output_format, output_format_set)
690
+ return self._generate_collection_output(elements, filter, collection_type,
691
+ output_format, output_format_set)
692
692
  return elements
693
693
 
694
694
 
@@ -818,8 +818,8 @@ class CollectionManager(Client2):
818
818
 
819
819
  if output_format != 'JSON': # return a simplified markdown representation
820
820
  logger.info(f"Found elements, output format: {output_format}, output_format_set: {output_format_set}")
821
- return self.generate_collection_output(elements, None, collection_type,
822
- output_format, output_format_set)
821
+ return self._generate_collection_output(elements, None, collection_type,
822
+ output_format, output_format_set)
823
823
  return elements
824
824
 
825
825
 
@@ -952,8 +952,8 @@ class CollectionManager(Client2):
952
952
 
953
953
  if output_format != 'JSON': # return a simplified markdown representation
954
954
  logger.debug(f"Found elements, output format: {output_format}, output_format_set: {output_format_set}")
955
- return self.generate_collection_output(elements, None, None,
956
- output_format, output_format_set)
955
+ return self._generate_collection_output(elements, None, None,
956
+ output_format, output_format_set)
957
957
  return elements
958
958
 
959
959
 
@@ -1091,8 +1091,8 @@ class CollectionManager(Client2):
1091
1091
 
1092
1092
  if output_format != 'JSON': # return a simplified markdown representation
1093
1093
  logger.info(f"Found elements, output format: {output_format}, output_format_set: {output_format_set}")
1094
- return self.generate_collection_output(elements, None, None,
1095
- output_format, output_format_set)
1094
+ return self._generate_collection_output(elements, None, None,
1095
+ output_format, output_format_set)
1096
1096
  return elements
1097
1097
 
1098
1098
 
@@ -1218,8 +1218,8 @@ class CollectionManager(Client2):
1218
1218
 
1219
1219
  if output_format != 'JSON': # return a simplified markdown representation
1220
1220
  logger.info(f"Found elements, output format: {output_format}, output_format_set: {output_format_set}")
1221
- return self.generate_collection_output(elements, None, None,
1222
- output_format, output_format_set)
1221
+ return self._generate_collection_output(elements, None, None,
1222
+ output_format, output_format_set)
1223
1223
  return elements
1224
1224
 
1225
1225
 
@@ -6461,9 +6461,9 @@ class CollectionManager(Client2):
6461
6461
  return props
6462
6462
 
6463
6463
 
6464
- def generate_collection_output(self, elements: Union[Dict, List[Dict]], filter: Optional[str],
6465
- classification_name: Optional[str], output_format: str = "DICT",
6466
- output_format_set: Optional[dict] | str = None) -> Union[str, List[Dict]]:
6464
+ def _generate_collection_output(self, elements: dict|list[dict], filter: Optional[str],
6465
+ classification_name: Optional[str], output_format: str = "DICT",
6466
+ output_format_set: dict | str = None) -> str| list[dict]:
6467
6467
  """ Generate output for collections in the specified format.
6468
6468
 
6469
6469
  Args:
@@ -6484,15 +6484,16 @@ class CollectionManager(Client2):
6484
6484
  # First see if the user has specified an output_format_set - either a label or a dict
6485
6485
  if output_format_set:
6486
6486
  if isinstance(output_format_set, str):
6487
- output_formats = select_output_format_set(entity_type, output_format)
6487
+ output_formats = select_output_format_set(output_format_set, output_format)
6488
6488
  if isinstance(output_format_set, dict):
6489
- output_formats = output_format_set
6490
-
6489
+ output_formats = get_output_format_type_match(output_format_set, output_format)
6491
6490
  # If no output_format was set, then use the classification_name to lookup the output format
6492
6491
  elif classification_name:
6493
6492
  output_formats = select_output_format_set(classification_name, output_format)
6494
6493
  else:
6495
- output_formats = None
6494
+ # fallback to collections or entity type
6495
+ output_formats = select_output_format_set(entity_type,output_format)
6496
+
6496
6497
  logger.trace(f"Executing generate_collection_output for {entity_type}: {output_formats}")
6497
6498
  return generate_output(
6498
6499
  elements,