Skip to content

Commit

Permalink
🐛 Fix for #478 KeyError: 'latestVersion' (#518)
Browse files Browse the repository at this point in the history
* removing the keyerror

Signed-off-by: AdityaBITMESRA <[email protected]>

* Fixing up trunk check formatting error

Signed-off-by: Shawn Hurley <[email protected]>

---------

Signed-off-by: AdityaBITMESRA <[email protected]>
Signed-off-by: Shawn Hurley <[email protected]>
Co-authored-by: Shawn Hurley <[email protected]>
  • Loading branch information
AdityaPandeyCN and shawn-hurley authored Dec 12, 2024
1 parent 0cbca2e commit b81db13
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions kai/reactive_codeplanner/agent/dependency_agent/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,23 @@ def search_fqdn_query(query: str) -> Optional[FQDNResponse] | list[FQDNResponse]
### context.
all_found_deps = []
for d in docs:
all_found_deps.append(
FQDNResponse(
artifact_id=d["a"], group_id=d["g"], version=d["latestVersion"]
if "latestVersion" in d:
all_found_deps.append(
FQDNResponse(
artifact_id=d["a"], group_id=d["g"], version=d["latestVersion"]
)
)
)
return all_found_deps
return all_found_deps if all_found_deps else None
else:
doc = docs[0]
return FQDNResponse(
artifact_id=doc["a"], group_id=doc["g"], version=doc["latestVersion"]
)

if "latestVersion" in doc:

return FQDNResponse(
artifact_id=doc["a"], group_id=doc["g"], version=doc["latestVersion"]
)

return None


def search_fqdn(code: str) -> Optional[FQDNResponse] | list[FQDNResponse]:
Expand Down

0 comments on commit b81db13

Please sign in to comment.