Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add static type hints #293

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add static type hints #293

wants to merge 1 commit into from

Conversation

Timmmm
Copy link
Contributor

@Timmmm Timmmm commented Oct 4, 2024

Add static type hints, and switch to literals for some dicts to improve type inference (and it's nicer code anyway).

This makes the code easier to understand and navigate, and also detected a few bugs:

  1. Missing brackets on e.upper.
  2. ext_name may not exist on line 399 (I haven't fixed this).
  3. Not strictly related to types, but a lot of the regexes were not raw strings and therefore contained invalid escape sequences. Python prints a warning about these in recent versions.

It is currently not verified in CI by pyright, but that will come in a future MR. These changes were just verified by VSCode.

Add static type hints, and switch to literals for some dicts to improve type inference (and it's nicer code anyway).

This makes the code easier to understand and navigate, and also detected a few of bugs:

1. Missing brackets on `e.upper`.
2. `ext_name` may not exist on line 399 (I haven't fixed this).
3. Not strictly related to types, but a lot of the regexes were not raw strings and therefore contained invalid escape sequences. Python prints a warning about these in recent versions.

It is currently not verified in CI by pyright, but that will come in a future MR. These changes were just verified by VSCode.
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.

1 participant