You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The exception handler logs errors but doesn’t return a value, causing the function to return None instead of a dict. It should return an empty dict or appropriate default on failure.
Convert the lists in content to sets and explicitly return the resulting dict. This aligns the output with the declared return type and ensures the function returns a value.
req.raise_for_status()
content: dict[str, list[str]] = req.json()
+return {filename: set(funcs) for filename, funcs in content.items()}
Suggestion importance[1-10]: 9
__
Why: The function never returns a value on success and the annotation expects set[str], so converting lists to sets and returning fixes both the missing return and the type mismatch.
High
Return empty dict on error
Ensure the function always returns a dictionary on failure by adding a return statement in the exception block. This prevents it from implicitly returning None and breaking callers expecting a dict.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Bug fix
Description
Remove custom 404 and 500 handlers
Rely on
req.raise_for_status()for errorsEliminate unused status code variables
Changes walkthrough 📝
cfapi.py
Simplify error handling in get_blocklisted_functionscodeflash/api/cfapi.py
not_foundandinternal_server_errorvariablesreq.raise_for_status()for all HTTP errors