Skip to content

Commit

Permalink
add descriptions of files when invoking ListRegistryPaths with new ut…
Browse files Browse the repository at this point in the history
…il function
  • Loading branch information
Jgmedina95 committed Jan 4, 2024
1 parent c7fda1d commit 286ce8c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions mdagent/utils/path_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,23 @@ def list_path_names(self):
"contain name mappings."
)

def list_path_names_and_descriptions(self):
if not self._check_for_json():
return "JSON file does not exist"
with open(self.json_file_path, "r") as json_file:
data = json.load(json_file)
names = [key for key in data.keys()]
descriptions = [data[key]["description"] for key in data.keys()]
names_w_descriptions = [
f"{name}: {description}" for name, description in zip(names, descriptions)
]
return (
"Files found in registry: " + ", ".join(names_w_descriptions)
if names
else "No names found. The JSON file is empty or does not"
"contain name mappings."
)

def get_timestamp(self):
# Get the current date and time
now = datetime.now()
Expand Down

0 comments on commit 286ce8c

Please sign in to comment.