-
Notifications
You must be signed in to change notification settings - Fork 17.2k
text-splitters: Set strict mypy rules #30900
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
base: master
Are you sure you want to change the base?
Conversation
cbornet
commented
Apr 17, 2025
- Add strict mypy rules
- Fix mypy violations
- Add error codes to all type ignores
- Add ruff rule PGH003
- Bump mypy version to 1.15
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -70,7 +74,7 @@ ignore_missing_imports = "True" | |||
target-version = "py39" | |||
|
|||
[tool.ruff.lint] | |||
select = ["E", "F", "I", "T201", "D"] | |||
select = ["E", "F", "I", "PGH003", "T201", "D"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add UP
(pyupgrade)? Reminded of this bc of the List
-> list
changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be done in a different PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, can be done in another PR
token_ids_with_start_and_end_token_ids = self.tokenizer.encode( | ||
text, | ||
max_length=self._max_length_equal_32_bit_integer, | ||
truncation="do_not_truncate", | ||
) | ||
return token_ids_with_start_and_end_token_ids | ||
return cast("list[int]", token_ids_with_start_and_end_token_ids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surprised we have to cast this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because mypy can't figure the type so it uses Any
which is incompatible with the method signature.
Happy to merge once CI is happy |
4a5e08f
to
7f762cf
Compare
7f762cf
to
748e778
Compare
It now is 😃 |