Closed akx closed 1 year ago
I know first-hand that creating smaller PRs is more work; but it would help review and merge this work if you would decouple changes where possible. I see following components: 1) logging vs printing (please add examples of what new output looks like to a user) 2) Lexer state 3) global application state.
No intention to discourage. What benefits do you want to get out of this? Is it purely best practice motivated, or you've got something specific / practical in mind?
No intention to discourage. What benefits do you want to get out of this? Is it purely best practice motivated, or you've got something specific / practical in mind?
Sure. Best practice motivated, and would make it easier to use flynt
programmatically (or multi-thread/multi-process it for faster execution!). I can split this to multiple PRs, no worries :)
I split the lexer bits into a future PR.
This PR gets rid of modifying the state module wherever possible, in favor of a
State
dataclass. Wherever possible, I've tried to keep the low-level APIs state-less (pun intended), so should you need a single transform, you can do that without constructing a full State.Additionally, itA future PR gets rid of modifyingChunk
s class-level state in favor of aLexerContext
which is determined based onstate.multiline
.