-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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: "bare_pytest_raises" to use the ast module #32932
REF: "bare_pytest_raises" to use the ast module #32932
Conversation
Now it uses the ast module instead of the tokenize module
@MomIsBestFriend tangential to this bc I was thinking about an ast-based check: one anti-pattern we have is using private functions across modules (e.g. core.indexing._maybe_numeric_slice used in io.formats.style). How hard would it be to track those down? |
@jbrockmendel If you meant tracking every use of private function that is not defined is the exact same file, I spouse is doable. One problem I think is going to be with |
Dont go out of your way on my account; focus on what you're most interested in. We appreciate the effort your putting in. |
I want to make progress, I am not really familiar with the code base, I really like when you give me issues you'd like to see me work on, because this is how I make progress.
@jbrockmendel Can you confirm I got it correctly? |
…rns-refactor-to-use-ast
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - I think can simplify a bit but otherwise looks good
continue | ||
for next_token in tokens[counter:]: | ||
if next_token.type == token.NAME and next_token.string == "match": | ||
def get_fqdn(node: ast.AST) -> Optional[str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this I think you can just call node.func.value.id
to get pytest and node.func.attr
for the raises portion
thanks @MomIsBestFriend |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
There is also a performance boost: