Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: Add ruff rules TRY3xx #4098

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cbornet
Copy link
Collaborator

@cbornet cbornet commented Oct 10, 2024

Add ruff rules TRY3xx
TRY301 issues are fixed but not enforcing them atm as they are a bit hard to grok.

@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. python Pull requests that update Python code labels Oct 10, 2024
# This means the Flow ID is not a valid UUID which means it can't find the flow
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=str(exc)) from exc
logger.exception(exc)
raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(exc)) from exc
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this exception was missing in StatementError's handling

except Exception as e:
if "No result found" in str(e):
raise HTTPException(status_code=404, detail="Folder not found") from e
raise HTTPException(status_code=500, detail=str(e)) from e

if not folder:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this was missing

@@ -203,12 +214,17 @@ async def download_file(
):
"""Download all flows from folder."""
try:
return session.exec(select(Folder).where(Folder.id == folder_id, Folder.user_id == current_user.id)).first()
folder = session.exec(select(Folder).where(Folder.id == folder_id, Folder.user_id == current_user.id)).first()
except Exception as e:
if "No result found" in str(e):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how this can happen...

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer python Pull requests that update Python code size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants