Skip to content

Commit deb6027

Browse files
committed
Updates to config variables for consistency - and then corresponding cleanup
Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
1 parent d9c0346 commit deb6027

101 files changed

Lines changed: 659 additions & 587 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

commands/cat/collection_actions.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414

1515

1616
from pyegeria import (
17-
EgeriaTech, body_slimmer, settings,
17+
print_basic_exception,
18+
EgeriaTech,
19+
settings,
20+
EgeriaTech,
21+
settings,
22+
settings,
1823
PyegeriaAPIException, PyegeriaClientException, print_basic_exception, print_exception_table
1924
)
2025
app_config = settings.Environment

commands/cat/dr_egeria.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
# User credentials are only from environment variables or command line (not stored in config for security)
3030
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
3131
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
32-
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", app_config.console_width or 190))
33-
EGERIA_JUPYTER = os.environ.get("EGERIA_JUPYTER", str(app_config.egeria_jupyter)).lower() in ("true", "1", "yes")
32+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", settings.Environment.egeria_width or 190))
33+
EGERIA_JUPYTER = os.environ.get("EGERIA_JUPYTER", str(settings.Environment.egeria_jupyter)).lower() in ("true", "1", "yes")
3434

3535
console = Console(width=EGERIA_WIDTH)
3636

@@ -80,7 +80,7 @@ def process_markdown_file(input_file: str, output_folder: str, directive: str,
8080
usage_level = "Advanced" if advanced else "Basic"
8181
try:
8282
# Instantiate the client
83-
from pyegeria import EgeriaTech
83+
from pyegeria import settings, EgeriaTech
8484
client = EgeriaTech(server, url, userid, user_pass)
8585
client.create_egeria_bearer_token()
8686
asyncio.run(process_md_file_v2(

commands/cat/dr_egeria_command_help.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
MarkdownIt = None
2727

2828
from pyegeria import (
29+
PyegeriaException,
30+
print_basic_exception,
31+
EgeriaTech,
32+
settings,
33+
EgeriaTech,
34+
settings,
35+
settings,
2936
EgeriaTech,
3037
PyegeriaException, print_basic_exception, print_validation_error,
3138
)
@@ -45,7 +52,7 @@
4552
# Let's check config.py for the exact attribute name.
4653

4754
EGERIA_HOME_GLOSSARY_GUID = user_profile.egeria_home_glossary_name
48-
EGERIA_WIDTH = env.console_width
55+
EGERIA_WIDTH = settings.Environment.egeria_width
4956
EGERIA_PLATFORM_URL = env.egeria_platform_url
5057
EGERIA_VIEW_SERVER = env.egeria_view_server
5158
EGERIA_VIEW_SERVER_URL = env.egeria_view_server_url
@@ -54,7 +61,7 @@
5461
EGERIA_JUPYTER = env.egeria_jupyter
5562

5663
def _get_console_width_from_config(default_width: int = EGERIA_WIDTH) -> int:
57-
return env.console_width
64+
return settings.Environment.egeria_width
5865

5966
def _get_outbox_dir() -> str:
6067
root = env.pyegeria_root

commands/cat/exp_list_glossaries.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323

2424
from pyegeria import (
25+
print_basic_exception,
26+
EgeriaTech,
27+
EgeriaTech,
2528
EgeriaTech,
2629
PyegeriaAPIException, PyegeriaClientException, print_basic_exception, print_exception_table
2730
)

commands/cat/get_asset_graph.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
from commands.cat.run_report import list_generic
1616
from pyegeria.core.config import settings
1717
from pyegeria import (
18+
PyegeriaException,
19+
print_basic_exception,
20+
settings,
21+
settings,
1822
PyegeriaAPIException, PyegeriaClientException, print_basic_exception, print_exception_table, PyegeriaException
1923
)
2024

@@ -26,13 +30,13 @@
2630

2731
guid_list = []
2832

29-
console = Console(width=app_config.console_width, force_terminal=(not app_config.egeria_jupyter))
33+
console = Console(width=settings.Environment.egeria_width, force_terminal=(not app_config.egeria_jupyter))
3034

3135

3236
def asset_viewer(asset_guid: str, output_format: str = "TABLE", view_server: str = app_config.egeria_view_server,
3337
view_url: str = app_config.egeria_view_server_url, user: str = EGERIA_USER,
34-
user_pass: str = EGERIA_USER_PASSWORD, jupyter: bool = app_config.egeria_jupyter,
35-
width: int = app_config.console_width, prompt_missing: bool = False, write_file: bool = False,
38+
user_pass: str = EGERIA_USER_PASSWORD, jupyter: bool = settings.Environment.egeria_jupyter,
39+
width: int = settings.Environment.egeria_width, prompt_missing: bool = False, write_file: bool = False,
3640
render_table: bool = False, table_caption: str | None = None, use_pager: bool = True):
3741
try:
3842
list_generic(report_spec="Asset-Graph", output_format=output_format, view_server=view_server,

commands/cat/get_collection_tree.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from rich.tree import Tree
1818

1919
from pyegeria import (
20+
print_basic_exception,
2021
CollectionManager,
2122
NO_ELEMENTS_FOUND,
2223
PyegeriaAPIException, PyegeriaClientException, print_basic_exception, print_exception_table

commands/cat/get_project_dependencies.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from rich.tree import Tree
2020

2121
from pyegeria import (
22+
print_basic_exception,
2223
ProjectManager,
2324
PyegeriaAPIException, PyegeriaClientException,
2425
print_basic_exception,

commands/cat/get_project_structure.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from rich.tree import Tree
2020

2121
from pyegeria import (
22+
print_basic_exception,
2223
ProjectManager,
2324
PyegeriaAPIException, PyegeriaClientException, print_basic_exception, print_exception_table, print_validation_error
2425
)

commands/cat/get_tech_type_elements.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
from commands.cat.run_report import list_generic
1515
from pyegeria import (
16+
print_basic_exception,
17+
config_logging,
18+
settings,
19+
settings,
1620
settings,
1721
config_logging, print_basic_exception, PyegeriaAPIException, PyegeriaClientException
1822
)
@@ -22,7 +26,7 @@
2226

2327
app_config = settings.Environment
2428
config_logging()
25-
console = Console(width=app_config.console_width)
29+
console = Console(width=settings.Environment.egeria_width)
2630

2731
guid_list = []
2832

@@ -33,8 +37,8 @@ def tech_viewer(
3337
platform_url: str,
3438
user: str,
3539
user_pass: str,
36-
jupyter: bool = app_config.egeria_jupyter,
37-
width: int = app_config.console_width,
40+
jupyter: bool = settings.Environment.egeria_jupyter,
41+
width: int = settings.Environment.egeria_width,
3842
):
3943
try:
4044
list_generic(report_spec = "Tech-Type-Elements", output_format = "TABLE", view_server = server_name,

commands/cat/glossary_actions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010

1111
import json
1212
import os
13-
import sys
1413

1514
import click
1615

1716
from pyegeria import (
18-
EgeriaTech, body_slimmer, settings, NO_ELEMENTS_FOUND, TERM_STATUS,
19-
PyegeriaAPIException, PyegeriaClientException, print_basic_exception, print_exception_table
17+
TERM_STATUS, EgeriaTech, NO_ELEMENTS_FOUND, body_slimmer,
18+
settings,
19+
PyegeriaAPIException, PyegeriaClientException, print_basic_exception
2020
)
2121

2222
app_config = settings.Environment

0 commit comments

Comments
 (0)