Skip to content

Chore: clean tokenizer/dialect code from **opts, and minor typing improvements#7422

Merged
georgesittas merged 5 commits intotobymao:mainfrom
OutSquareCapital:clean-opts
Apr 1, 2026
Merged

Chore: clean tokenizer/dialect code from **opts, and minor typing improvements#7422
georgesittas merged 5 commits intotobymao:mainfrom
OutSquareCapital:clean-opts

Conversation

@OutSquareCapital
Copy link
Copy Markdown
Contributor

This PR is a follow up of this comment.

**opts for tokenizer was an unused argument across all the chain.
This is now cleaned up, and allowed at the same time to delete various methods overrides in the Athena dialect ->
the dict assignements inside those methods weren't used at all later, and this is easily provable since now the base classes methods are strongly typed, hence we know that those keys aren't called anywhere.

This should also bring very minor performance improvements, thanks to avoiding various useless dict unpackings.

I also took this opportunity to bring minor typing improvements who were close to my changes.

Note that it's preferrable to NOT import types from modules with star imports, as this completely block LSP's (pyright at the very least) from resolving the symbols.
This is why a few import lines have been changed as well.

- Import {Dialect, Hive, Trino} from correct modules to help LSP's catch errors (star imports at folder level cause issues for them)
- Add `object` annotation for `**kwargs`
- Delete dead code for method overloads who were asssigning values to kwargs, that weren't used afterwards
- Clean up the `__init__()` method of the Tokenizer by avoiding unused args and kwargs and overall making the code more concise
- added a few types annotations in Tokenizer base classes
- import Dialect from correct module for LSP's
- deleted the unused `**opts` argument from `Tokenizer.__init__()`
- lint fix for unused typing import in athena dialect
- mypc had issues with Hive and Trino imports in AthenaParser
- took the opportunity to clean up/improve the signature of  `AthenaParser.__init__()`
@georgesittas georgesittas merged commit ce16997 into tobymao:main Apr 1, 2026
8 checks passed
@OutSquareCapital OutSquareCapital deleted the clean-opts branch April 1, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants