pyegeria 5.3.5.2__py3-none-any.whl → 5.3.6.1__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/asset_catalog_omvs.py +8 -8
- pyegeria/commands/cat/freddie_jup.py +124 -0
- pyegeria/commands/cat/freddie_jupyter.py +34 -27
- pyegeria/commands/cat/freddie_md.py +45 -42
- pyegeria/commands/cat/freddie_utils.py +112 -52
- pyegeria/commands/cat/freddies-inbox/freddie_intro.md +221 -0
- pyegeria/commands/cat/freddies-inbox/glossary_creation_experiment.ipynb +341 -0
- pyegeria/commands/cat/freddies-inbox/glossary_exp.md +158 -0
- pyegeria/commands/cat/glossary_creation_experiment.ipynb +235 -0
- {pyegeria-5.3.5.2.dist-info → pyegeria-5.3.6.1.dist-info}/METADATA +1 -1
- {pyegeria-5.3.5.2.dist-info → pyegeria-5.3.6.1.dist-info}/RECORD +14 -9
- {pyegeria-5.3.5.2.dist-info → pyegeria-5.3.6.1.dist-info}/LICENSE +0 -0
- {pyegeria-5.3.5.2.dist-info → pyegeria-5.3.6.1.dist-info}/WHEEL +0 -0
- {pyegeria-5.3.5.2.dist-info → pyegeria-5.3.6.1.dist-info}/entry_points.txt +0 -0
pyegeria/asset_catalog_omvs.py
CHANGED
@@ -557,16 +557,16 @@ class AssetCatalog(Client):
|
|
557
557
|
----------
|
558
558
|
asset_guid : str
|
559
559
|
The unique identity of the asset to get the graph for.
|
560
|
-
|
560
|
+
effective_time: str, default is None
|
561
561
|
Effective time to query on. If not specified, the current time is used.
|
562
|
-
|
562
|
+
as_of_time: str = None
|
563
563
|
as_of_time to query on. If not specified, the current time is used.
|
564
|
-
|
564
|
+
relationship_types: [str], default is None,
|
565
565
|
relationship types to include in the lineage graph. If not specified, all relationship types are included.
|
566
|
-
|
566
|
+
limit_to_isc_q_name: str = None,
|
567
567
|
if specified, filters results to only include information supply chains with the given name.
|
568
|
-
|
569
|
-
if
|
568
|
+
hilight_isc_q_name: str = None,
|
569
|
+
if specified, highlights the information supply chain with the given name.
|
570
570
|
|
571
571
|
start_from : int, optional
|
572
572
|
The index from which to start fetching the engine actions. Default is 0.
|
@@ -595,8 +595,8 @@ class AssetCatalog(Client):
|
|
595
595
|
"effectiveTime": effective_time,
|
596
596
|
"asOfTime": as_of_time,
|
597
597
|
"relationshipTypes": relationship_types,
|
598
|
-
"
|
599
|
-
"
|
598
|
+
"limitToISCQualifiedName": limit_to_isc_q_name,
|
599
|
+
"highlightISCQualifiedName": hilight_isc_q_name,
|
600
600
|
}
|
601
601
|
response = await self._async_make_request("POST", url, body_slimmer(body))
|
602
602
|
return response.json().get("assetLineageGraph", NO_ASSETS_FOUND)
|
@@ -0,0 +1,124 @@
|
|
1
|
+
"""
|
2
|
+
This is an ongoing experiment in parsing and playing with Freddie docs
|
3
|
+
"""
|
4
|
+
import json
|
5
|
+
import marko
|
6
|
+
from jupyter_notebook_parser import JupyterNotebookParser
|
7
|
+
import nbformat
|
8
|
+
import os
|
9
|
+
import re
|
10
|
+
from pyegeria import EgeriaTech
|
11
|
+
from rich import box, print
|
12
|
+
from rich.console import Console
|
13
|
+
from rich.markdown import Markdown
|
14
|
+
from rich.prompt import Prompt
|
15
|
+
from rich.table import Table
|
16
|
+
from freddie_utils import (extract_command, process_glossary_upsert_command, process_term_upsert_command,
|
17
|
+
get_current_datetime_string)
|
18
|
+
|
19
|
+
import click
|
20
|
+
from pyegeria import EgeriaTech, body_slimmer, NO_GLOSSARIES_FOUND, NO_TERMS_FOUND, NO_ELEMENTS_FOUND
|
21
|
+
from pyegeria._exceptions import (
|
22
|
+
InvalidParameterException,
|
23
|
+
PropertyServerException,
|
24
|
+
print_exception_response,
|
25
|
+
)
|
26
|
+
import datetime
|
27
|
+
|
28
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
29
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
30
|
+
EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
|
31
|
+
EGERIA_VIEW_SERVER = os.environ.get("EGERIA_VIEW_SERVER", "view-server")
|
32
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get(
|
33
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
34
|
+
)
|
35
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("EGERIA_INTEGRATION_DAEMON", "integration-daemon")
|
36
|
+
EGERIA_INTEGRATION_DAEMON_URL = os.environ.get(
|
37
|
+
"EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"
|
38
|
+
)
|
39
|
+
EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
|
40
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
41
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
42
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
43
|
+
EGERIA_WIDTH = os.environ.get("EGERIA_WIDTH", 220)
|
44
|
+
EGERIA_JUPYTER = os.environ.get("EGERIA_JUPYTER", False)
|
45
|
+
EGERIA_HOME_GLOSSARY_GUID = os.environ.get("EGERIA_HOME_GLOSSARY_GUID", None)
|
46
|
+
EGERIA_GLOSSARY_PATH = os.environ.get("EGERIA_GLOSSARY_PATH", None)
|
47
|
+
EGERIA_ROOT_PATH = os.environ.get("EGERIA_ROOT_PATH", "/Users/dwolfson/localGit/egeria-v5-3/egeria-workspaces")
|
48
|
+
EGERIA_FREDDIE_INBOX_PATH = os.environ.get("EGERIA_FREDDIE_INBOX_PATH", "exchange/loading-bay/freddies-inbox")
|
49
|
+
EGERIA_FREDDIE_OUTBOX_PATH = os.environ.get("EGERIA_FREDDIE_OUTBOX_PATH", "exchange/distribution-hub/freddies-outbox")
|
50
|
+
commands = ["Create Glossary", "Create Term", "Create Governance Definition", "Update Term"]
|
51
|
+
console = Console(width=int(EGERIA_WIDTH))
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
@click.command("process-jupyter")
|
56
|
+
@click.option("--file-path", help="File path to notebook",
|
57
|
+
default="glossary_creation_experiment.ipynb")
|
58
|
+
@click.option("--directive", default="display-only", help="How to process the file")
|
59
|
+
@click.option("--server", default=EGERIA_VIEW_SERVER, help="Egeria view server to use.")
|
60
|
+
@click.option(
|
61
|
+
"--url", default=EGERIA_VIEW_SERVER_URL, help="URL of Egeria platform to connect to"
|
62
|
+
)
|
63
|
+
@click.option("--userid", default=EGERIA_USER, help="Egeria user")
|
64
|
+
@click.option("--user_pass", default=EGERIA_USER_PASSWORD, help="Egeria user password")
|
65
|
+
def process_jupyter_notebook(
|
66
|
+
file_path: str,
|
67
|
+
directive: str,
|
68
|
+
server: str,
|
69
|
+
url: str,
|
70
|
+
userid: str,
|
71
|
+
user_pass: str,
|
72
|
+
):
|
73
|
+
client = EgeriaTech(server, url, user_id=userid)
|
74
|
+
token = client.create_egeria_bearer_token(userid, user_pass)
|
75
|
+
#
|
76
|
+
# parsed_notebook = JupyterNotebookParser(file_path)
|
77
|
+
#
|
78
|
+
# cell_sources = parsed_notebook.get_markdown_cell_sources()
|
79
|
+
try:
|
80
|
+
updated = False
|
81
|
+
full_file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_FREDDIE_INBOX_PATH, file_path)
|
82
|
+
click.echo(f"Processing notebook: {full_file_path}")
|
83
|
+
with open(full_file_path, 'r') as f:
|
84
|
+
nb = nbformat.read(f, as_version=4)
|
85
|
+
for cell in nb.cells:
|
86
|
+
if cell.cell_type == 'markdown':
|
87
|
+
if cell.source.strip().startswith('#'):
|
88
|
+
potential_command = extract_command(cell.source)
|
89
|
+
if potential_command in commands:
|
90
|
+
if potential_command in ["Create Glossary", "Update Glossary"]:
|
91
|
+
result = process_glossary_upsert_command(client, cell.source, directive)
|
92
|
+
if result:
|
93
|
+
if directive == "process":
|
94
|
+
updated = True
|
95
|
+
cell.source = result
|
96
|
+
else:
|
97
|
+
continue
|
98
|
+
if potential_command in ["Create Term", "Update Term"]:
|
99
|
+
result = process_term_upsert_command(client, cell.source, directive)
|
100
|
+
if result:
|
101
|
+
if directive == "process":
|
102
|
+
updated = True
|
103
|
+
cell.source = result
|
104
|
+
else:
|
105
|
+
continue
|
106
|
+
|
107
|
+
if updated:
|
108
|
+
path, filename = os.path.split(file_path) # Get both parts
|
109
|
+
new_filename = f"processed-{get_current_datetime_string()}-{filename}" # Create the new filename
|
110
|
+
new_file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_FREDDIE_OUTBOX_PATH, new_filename) # Construct the new path
|
111
|
+
os.makedirs(os.path.dirname(new_file_path), exist_ok=True)
|
112
|
+
|
113
|
+
|
114
|
+
with open(new_file_path, 'w') as f2:
|
115
|
+
nbformat.write(nb, f2)
|
116
|
+
click.echo(f"\n==>Notebook written to {new_file_path}")
|
117
|
+
|
118
|
+
except Exception as e:
|
119
|
+
print_exception_response(e)
|
120
|
+
return
|
121
|
+
|
122
|
+
|
123
|
+
if __name__ == "__main__":
|
124
|
+
process_jupyter_notebook()
|
@@ -14,16 +14,15 @@ from rich.markdown import Markdown
|
|
14
14
|
from rich.prompt import Prompt
|
15
15
|
from rich.table import Table
|
16
16
|
from freddie_utils import (extract_command, process_glossary_upsert_command, process_term_upsert_command,
|
17
|
-
get_current_datetime_string)
|
18
|
-
|
17
|
+
get_current_datetime_string, process_per_proj_upsert_command, commands)
|
19
18
|
import click
|
20
|
-
from pyegeria import EgeriaTech, body_slimmer, NO_GLOSSARIES_FOUND, NO_TERMS_FOUND, NO_ELEMENTS_FOUND
|
19
|
+
from pyegeria import EgeriaTech, body_slimmer, NO_GLOSSARIES_FOUND, NO_TERMS_FOUND, NO_ELEMENTS_FOUND, NO_PROJECTS_FOUND
|
21
20
|
from pyegeria._exceptions import (
|
22
21
|
InvalidParameterException,
|
23
22
|
PropertyServerException,
|
24
23
|
print_exception_response,
|
25
24
|
)
|
26
|
-
import datetime
|
25
|
+
from datetime import datetime
|
27
26
|
|
28
27
|
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
29
28
|
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
@@ -44,10 +43,10 @@ EGERIA_WIDTH = os.environ.get("EGERIA_WIDTH", 220)
|
|
44
43
|
EGERIA_JUPYTER = os.environ.get("EGERIA_JUPYTER", False)
|
45
44
|
EGERIA_HOME_GLOSSARY_GUID = os.environ.get("EGERIA_HOME_GLOSSARY_GUID", None)
|
46
45
|
EGERIA_GLOSSARY_PATH = os.environ.get("EGERIA_GLOSSARY_PATH", None)
|
47
|
-
EGERIA_ROOT_PATH = os.environ.get("EGERIA_ROOT_PATH", "/Users/dwolfson/localGit/egeria-v5-3/egeria-
|
48
|
-
EGERIA_FREDDIE_INBOX_PATH = os.environ.get("EGERIA_FREDDIE_INBOX_PATH", "
|
49
|
-
EGERIA_FREDDIE_OUTBOX_PATH = os.environ.get("EGERIA_FREDDIE_OUTBOX_PATH", "
|
50
|
-
|
46
|
+
EGERIA_ROOT_PATH = os.environ.get("EGERIA_ROOT_PATH", "/Users/dwolfson/localGit/egeria-v5-3/egeria-python")
|
47
|
+
EGERIA_FREDDIE_INBOX_PATH = os.environ.get("EGERIA_FREDDIE_INBOX_PATH", "pyegeria/commands/cat/freddies-inbox")
|
48
|
+
EGERIA_FREDDIE_OUTBOX_PATH = os.environ.get("EGERIA_FREDDIE_OUTBOX_PATH", "pyegeria/commands/cat/freddies-outbox")
|
49
|
+
|
51
50
|
console = Console(width=int(EGERIA_WIDTH))
|
52
51
|
|
53
52
|
|
@@ -72,10 +71,9 @@ def process_jupyter_notebook(
|
|
72
71
|
):
|
73
72
|
client = EgeriaTech(server, url, user_id=userid)
|
74
73
|
token = client.create_egeria_bearer_token(userid, user_pass)
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
# cell_sources = parsed_notebook.get_markdown_cell_sources()
|
74
|
+
|
75
|
+
element_dictionary = {}
|
76
|
+
|
79
77
|
try:
|
80
78
|
updated = False
|
81
79
|
full_file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_FREDDIE_INBOX_PATH, file_path)
|
@@ -88,21 +86,28 @@ def process_jupyter_notebook(
|
|
88
86
|
potential_command = extract_command(cell.source)
|
89
87
|
if potential_command in commands:
|
90
88
|
if potential_command in ["Create Glossary", "Update Glossary"]:
|
91
|
-
result = process_glossary_upsert_command(client,
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
89
|
+
result = process_glossary_upsert_command(client, element_dictionary,
|
90
|
+
cell.source, directive)
|
91
|
+
|
92
|
+
elif potential_command in ["Create Term", "Update Term"]:
|
93
|
+
result = process_term_upsert_command(client, element_dictionary,
|
94
|
+
cell.source, directive)
|
95
|
+
elif potential_command in ["Create Personal Project", "Update Personal Project"]:
|
96
|
+
result = process_per_proj_upsert_command(client, element_dictionary, cell.source, directive)
|
97
|
+
else:
|
98
|
+
# If command is not recognized, copy the block as-is
|
99
|
+
result = None
|
100
|
+
|
101
|
+
if result:
|
102
|
+
if directive == "process":
|
103
|
+
updated = True
|
104
|
+
cell.source = result
|
105
|
+
# print(json.dumps(element_dictionary, indent=4))
|
106
|
+
elif directive == "process":
|
107
|
+
# Handle case with errors (skip this block but notify the user)
|
108
|
+
print(f"\n==>\tErrors found while processing command: \'{potential_command}\'\n"
|
109
|
+
f"\tPlease correct and try again. \n")
|
110
|
+
|
106
111
|
|
107
112
|
if updated:
|
108
113
|
path, filename = os.path.split(file_path) # Get both parts
|
@@ -114,6 +119,8 @@ def process_jupyter_notebook(
|
|
114
119
|
with open(new_file_path, 'w') as f2:
|
115
120
|
nbformat.write(nb, f2)
|
116
121
|
click.echo(f"\n==>Notebook written to {new_file_path}")
|
122
|
+
else:
|
123
|
+
click.echo("\nNo updates detected. New file not created.")
|
117
124
|
|
118
125
|
except Exception as e:
|
119
126
|
print_exception_response(e)
|
@@ -17,13 +17,13 @@ from freddie_utils import (extract_command, process_glossary_upsert_command, pro
|
|
17
17
|
get_current_datetime_string, process_per_proj_upsert_command, commands)
|
18
18
|
|
19
19
|
import click
|
20
|
-
from pyegeria import EgeriaTech, body_slimmer, NO_GLOSSARIES_FOUND, NO_TERMS_FOUND, NO_ELEMENTS_FOUND
|
20
|
+
from pyegeria import EgeriaTech, body_slimmer, NO_GLOSSARIES_FOUND, NO_TERMS_FOUND, NO_ELEMENTS_FOUND, NO_PROJECTS_FOUND
|
21
21
|
from pyegeria._exceptions import (
|
22
22
|
InvalidParameterException,
|
23
23
|
PropertyServerException,
|
24
24
|
print_exception_response,
|
25
25
|
)
|
26
|
-
import datetime
|
26
|
+
from datetime import datetime
|
27
27
|
|
28
28
|
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
29
29
|
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
@@ -44,9 +44,10 @@ EGERIA_WIDTH = os.environ.get("EGERIA_WIDTH", 220)
|
|
44
44
|
EGERIA_JUPYTER = os.environ.get("EGERIA_JUPYTER", False)
|
45
45
|
EGERIA_HOME_GLOSSARY_GUID = os.environ.get("EGERIA_HOME_GLOSSARY_GUID", None)
|
46
46
|
EGERIA_GLOSSARY_PATH = os.environ.get("EGERIA_GLOSSARY_PATH", None)
|
47
|
-
EGERIA_ROOT_PATH = os.environ.get("EGERIA_ROOT_PATH", "/Users/dwolfson/localGit/egeria-v5-3/egeria-
|
48
|
-
EGERIA_FREDDIE_INBOX_PATH = os.environ.get("EGERIA_FREDDIE_INBOX_PATH", "
|
49
|
-
EGERIA_FREDDIE_OUTBOX_PATH = os.environ.get("EGERIA_FREDDIE_OUTBOX_PATH", "
|
47
|
+
EGERIA_ROOT_PATH = os.environ.get("EGERIA_ROOT_PATH", "/Users/dwolfson/localGit/egeria-v5-3/egeria-python")
|
48
|
+
EGERIA_FREDDIE_INBOX_PATH = os.environ.get("EGERIA_FREDDIE_INBOX_PATH", "pyegeria/commands/cat/freddies-inbox")
|
49
|
+
EGERIA_FREDDIE_OUTBOX_PATH = os.environ.get("EGERIA_FREDDIE_OUTBOX_PATH", "pyegeria/commands/cat/freddies-outbox")
|
50
|
+
|
50
51
|
console = Console(width=int(EGERIA_WIDTH))
|
51
52
|
|
52
53
|
|
@@ -54,7 +55,7 @@ console = Console(width=int(EGERIA_WIDTH))
|
|
54
55
|
@click.command("process-markdown-file", help="Process a markdown file and return the output as a string.")
|
55
56
|
@click.option("--file-path", help="File path to markdown file",
|
56
57
|
default="glossary_exp.md")
|
57
|
-
@click.option("--directive", default="display", help="How to process the file")
|
58
|
+
@click.option("--directive", default="display-only", help="How to process the file")
|
58
59
|
@click.option("--server", default=EGERIA_VIEW_SERVER, help="Egeria view server to use.")
|
59
60
|
@click.option(
|
60
61
|
"--url", default=EGERIA_VIEW_SERVER_URL, help="URL of Egeria platform to connect to"
|
@@ -69,6 +70,7 @@ def process_markdown_file(
|
|
69
70
|
userid: str,
|
70
71
|
user_pass: str,
|
71
72
|
):
|
73
|
+
|
72
74
|
client = EgeriaTech(server, url, user_id=userid)
|
73
75
|
token = client.create_egeria_bearer_token(userid, user_pass)
|
74
76
|
|
@@ -82,9 +84,12 @@ def process_markdown_file(
|
|
82
84
|
print(f"Error: File not found at path: {full_file_path}")
|
83
85
|
return {} # Return empty dict if file not found
|
84
86
|
|
87
|
+
final_output = (f"\n# Results from processing file {file_path} on "
|
88
|
+
f"{datetime.now().strftime("%Y-%m-%d %H:%M")}\n---\n")
|
85
89
|
h1_blocks = []
|
86
90
|
current_block = ""
|
87
91
|
in_h1_block = False
|
92
|
+
element_dictionary = {}
|
88
93
|
|
89
94
|
for line in lines:
|
90
95
|
line = line.strip() # Remove leading/trailing whitespace
|
@@ -100,57 +105,55 @@ def process_markdown_file(
|
|
100
105
|
in_h1_block = False
|
101
106
|
elif in_h1_block: # Add line to the current H1 block
|
102
107
|
current_block += "\n" + line
|
108
|
+
else:
|
109
|
+
# Add non-H1 blocks directly to the final output
|
110
|
+
final_output += line
|
103
111
|
|
104
112
|
if current_block: # Add the last H1 block
|
105
113
|
h1_blocks.append(current_block)
|
106
114
|
|
107
|
-
|
115
|
+
# Process each identified H1 block
|
108
116
|
for block in h1_blocks:
|
109
|
-
potential_command = extract_command(block)
|
117
|
+
potential_command = extract_command(block) # Extract potential command
|
110
118
|
|
111
119
|
if potential_command in commands:
|
120
|
+
# Process the block based on the command
|
112
121
|
if potential_command in ["Create Glossary", "Update Glossary"]:
|
113
|
-
result = process_glossary_upsert_command(client, block, directive)
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
if
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
updated = True
|
138
|
-
processed_blocks += f'\n---\n{result} \n---\n\n'
|
139
|
-
else:
|
140
|
-
print(f"\n==>\tErrors found while processing command: \'{potential_command}\'\n"
|
141
|
-
f"\tPlease correct and try again. \n")
|
142
|
-
continue
|
143
|
-
|
122
|
+
result = process_glossary_upsert_command(client, element_dictionary, block, directive)
|
123
|
+
elif potential_command in ["Create Term", "Update Term"]:
|
124
|
+
result = process_term_upsert_command(client, element_dictionary, block, directive)
|
125
|
+
elif potential_command in ["Create Personal Project", "Update Personal Project"]:
|
126
|
+
result = process_per_proj_upsert_command(client, element_dictionary, block, directive)
|
127
|
+
else:
|
128
|
+
# If command is not recognized, copy the block as-is
|
129
|
+
result = None
|
130
|
+
|
131
|
+
if result:
|
132
|
+
if directive == "process":
|
133
|
+
updated = True
|
134
|
+
final_output += f"\n---\n{result}\n---\n\n"
|
135
|
+
# print(json.dumps(element_dictionary, indent=4))
|
136
|
+
elif directive == "process":
|
137
|
+
# Handle case with errors (skip this block but notify the user)
|
138
|
+
print(f"\n==>\tErrors found while processing command: \'{potential_command}\'\n"
|
139
|
+
f"\tPlease correct and try again. \n")
|
140
|
+
final_output += f"\n---\n{block}\n---\n\n"
|
141
|
+
else:
|
142
|
+
# If no command is detected, add the block to the final output as-is
|
143
|
+
final_output += f"\n---\n{block}\n---\n\n"
|
144
|
+
|
145
|
+
# Write the final_output to a new file if updated
|
144
146
|
if updated:
|
145
147
|
path, filename = os.path.split(file_path) # Get both parts
|
146
148
|
new_filename = f"processed-{get_current_datetime_string()}-{filename}" # Create the new filename
|
147
149
|
new_file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_FREDDIE_OUTBOX_PATH, new_filename) # Construct the new path
|
148
150
|
os.makedirs(os.path.dirname(new_file_path), exist_ok=True)
|
149
151
|
|
150
|
-
|
151
152
|
with open(new_file_path, 'w') as f2:
|
152
|
-
f2.write(
|
153
|
-
click.echo(f"\n==>Notebook written to {new_file_path}")
|
153
|
+
f2.write(final_output)
|
154
|
+
click.echo(f"\n==> Notebook written to {new_file_path}")
|
155
|
+
else:
|
156
|
+
click.echo("\nNo updates detected. New File not created.")
|
154
157
|
|
155
158
|
|
156
159
|
|