Skip to content

Parse raised exceptions and their error messages sans interpolation/format spec #3519

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

Closed
wants to merge 1 commit into from
Closed

Conversation

cpcloud
Copy link
Member

@cpcloud cpcloud commented May 3, 2013

This PR partially addresses #3024. It also provides a shiny new script useful looking at the current state of the messages in raised exceptions. Here's an example of some output:

Example

pandas-shiny-new-parse-asserts

You can reproduce this with

scripts/parse_except.py --type empty --module pandas --kind assert

from the top level pandas directory.

Description

The above line searches for all empty raises in the module pandas whose constructor matches the regular expression '.*assert.*'--not case sensitive.

Note: This assumes you have installed pandas with python setup.py develop. This will not work without that (well, that's not strictly true, but it will search for pandas code that's installed wherever you installed it /usr/*/site-packages/*/pandas or $VIRTUAL_ENV/*/pandas, for example, which is probably not what you want).

To see all of the options and a short description you can do the usual:

scripts/parse_except.py --help

@cpcloud
Copy link
Member Author

cpcloud commented May 3, 2013

This could probably use a NodeVisitor subclass...but I wanted to hack this together before optimizing.

@cpcloud
Copy link
Member Author

cpcloud commented May 17, 2013

@jreback this could be merged if y'all think it's useful...all the nan's in the above pic are gone now since i filled all those missing or vague assert messages in and a few others as well. rls notes here?

@cpcloud
Copy link
Member Author

cpcloud commented May 30, 2013

@jreback @y-p i will close this if there's no chance of it getting in. no sense in keeping things open unnecessarily...

@jreback
Copy link
Contributor

jreback commented May 30, 2013

I didnt' realize you changed a bunch of no-message AssertionErrors.....so this is good...

does this pass travis?

@cpcloud
Copy link
Member Author

cpcloud commented May 30, 2013

I didnt' realize you changed a bunch of no-message AssertionErrors.....so this is good...

i was hoping that the script would be useful (alas, i probably spent too much time creating the assertion-table-lister thing because i think asts are fun) it should pass...it wasn't before because i did 1e9 rebases in a row and travis doen't like that

@jreback
Copy link
Contributor

jreback commented May 30, 2013

@cpcloud
you might want to join pandas-dev ml:

http://mail.python.org/mailman/listinfo/pandas-dev

@cpcloud
Copy link
Member Author

cpcloud commented May 30, 2013

this passes

parse asserts script initial commit

Signed-off-by: Phillip Cloud <[email protected]>

CLN: start adding messages to empty assertions

Signed-off-by: Phillip Cloud <[email protected]>

ENH: new script to find raised exceptions that lack an error message

You can also look at the current error messages for every raised exception
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