ikamensh / flynt

A tool to automatically convert old string literal formatting to f-strings
MIT License
685 stars 33 forks source link

Use ast to find candidate fstring expressions #183

Closed ikamensh closed 1 year ago

ikamensh commented 1 year ago

This is a long due refactoring. At the time flynt was created, ast module didn't allow to find both start and end of the expression in the source code, therefore it was needed to have another, more complicated solution. Since python 3.8, ast allows to find exact start and end of the expression in the source code, and this was already used in string concatenations.

This PR moves functionality over to the new mechanism, leaving deletion of legacy code for future PRs.