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

How to "find" function call with arguments? #10

Open
dimaqq opened this issue Feb 20, 2019 · 0 comments
Open

How to "find" function call with arguments? #10

dimaqq opened this issue Feb 20, 2019 · 0 comments

Comments

@dimaqq
Copy link

dimaqq commented Feb 20, 2019

Hi, I've just discovered astpath and it's really cool!

I can get the file and line at the start of the match, but how do I get the whole match?
Suppose I'm searching for logging.debug and my code looks as follows, thanks to black:

...
logging.debug(
  "A very %s long %r line %s with %s a lot of %r format specifiers",
  something.foo.bar,
  [some.expression > that - results - in - an < object for x in y],
  yet.another.blah,
  ...
)
...

I wish that astpath could tell me the exact boundaries of the function call including the call arguments.

I can simulate some of this with before_ and after_context but that's kinda hacky...

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

No branches or pull requests

1 participant