Skip to content

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

@dimaqq

Description

@dimaqq

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions