As part of an effort to write code that works consistently on both Python 2 and 3, I would like to test for any unadorned string literals (any opening " or ' not preceded by a b or u).
I'm fine with writing test cases, so I just need a function that returns all unadorned string literals across my .py files.
I can think of ways to do this with grep that are pretty nasty. AST looks potentially helpful, too. But I feel like somebody must have already solved this problem before, so thought I'd ask.
Aucun commentaire:
Enregistrer un commentaire