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

Improve exception trace with RUF B904 #1641

Merged

Conversation

Skylion007
Copy link
Contributor

@Skylion007 Skylion007 commented Jun 29, 2024

Improve the exception trace of all exceptions in filesystem spec by using the "from" keyword to specify a cause. I also enable a ruff rule B904 to require this cause in the future. I also enable RUF015 which ensure that we always access the first instance of iterable in constant time instead of using a linear time list or tuple constructor. I also had to change one of the exception catches to fix this in memory mapping.

Overall, this should prevent fsspec from swallowing the cause of exceptions nearly as much and return more info to the user when an exception occurs.

Copy link
Member

@martindurant martindurant left a comment

Choose a reason for hiding this comment

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

This was all auto-generated, correct?

I wonder if there any cases in which raise from ... causes bloat in the printout. That aside, I am in favour, es it at least provides the theoretical option for calling code to be more discriminating when handing our exceptions.

fsspec/implementations/dbfs.py Show resolved Hide resolved
fsspec/implementations/dbfs.py Show resolved Hide resolved
@Skylion007
Copy link
Contributor Author

I manually added these to clarify.

@martindurant martindurant merged commit 127a78a into fsspec:master Jul 1, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants