Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Discussion options

You must be logged in to vote

Yes that's a limitation of our static analysis agent: ast gives us regular strings, and we loose the information of whether they were triple-quoted strings or not. Then, when "unparsing" expressions, we cannot know whether we should render as regular or triple-quoted strings.

I see two solutions to this:

  • somehow fetch again the string from source (thanks to line/column number/offsets)
  • parse code as a CST (Concrete Syntax Tree) instead of AST (Abstract Syntax Tree) to maintain source format (drastic change, not happening soon)

It might also be possible to work around this with a Griffe extension, but I'm not sure if that's possible yet, I'll have to run some tests. The extension would ac…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@ddkasa
Comment options

@pawamoy
Comment options

@ddkasa
Comment options

@pawamoy
Comment options

@ddkasa
Comment options

Answer selected by ddkasa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation templates Jinja templates griffe extension Can be solved with a Griffe extension
2 participants