Skip to content

Commit 4d01adb

Browse files
committed
attempt at fixing safe_get 4
1 parent cc88de9 commit 4d01adb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

python/rubin/rag/extra_scripts/parse_jira_tickets.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,14 @@ def extract_parent_issue(jira_data: dict) -> dict:
105105
return {}
106106

107107

108-
def safe_get(d: dict, path: list, default: str = "Not found") -> str:
108+
def safe_get(d: dict[str, any], path: list[str], default: any = None) -> any:
109109
"""Safely get a value from a nested dictionary."""
110110
for key in path:
111111
if isinstance(d, dict):
112112
d = d.get(key, default)
113-
return d if isinstance(d, str) else default
113+
else:
114+
return default
115+
return d
114116

115117

116118
def reformat_jira_data(jira_data: dict, ticket: str) -> dict:

0 commit comments

Comments
 (0)