-
Notifications
You must be signed in to change notification settings - Fork 81
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
Pyright enable standard type checking mode #1084
Open
vlaci
wants to merge
6
commits into
main
Choose a base branch
from
pyright-standard-type-checking-mode
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This check is currently turned of in our `basic` `typeCheckingMode` profile, but is enabled in the `standard` profile. Things done here: - matched the signature of `__exit__` and `seekable` to `mmap`'s type stub. - indicate that `seekable` is present in `mmap` in Python 3.13+ - ignored the `seek` method, as we explicitly wanted it to return the file position similarly to the standard file api Error: unblob/file_utils.py unblob/file_utils.py:70:9 - error: Method "seek" overrides class "mmap" in an incompatible manner Return type mismatch: base method returns type "None", override returns type "int" "int" is not assignable to "None" (reportIncompatibleMethodOverride) unblob/file_utils.py:94:9 - error: Method "__exit__" overrides class "mmap" in an incompatible manner Positional parameter count mismatch; base method has 2, but override has 4 Parameter "args" is missing in override (reportIncompatibleMethodOverride) unblob/file_utils.py:103:9 - error: Method "seekable" overrides class "mmap" in an incompatible manner Return type mismatch: base method returns type "Literal[True]", override returns type "bool" "bool" is not assignable to type "Literal[True]" (reportIncompatibleMethodOverride)
This check is currently turned of in our `basic` `typeCheckingMode` profile, but is enabled in the `standard` profile. Things done here: - matched the signature of `default` with `JSONEncoder.default` Error: unblob/models.py unblob/models.py:258:9 - error: Method "default" overrides class "JSONEncoder" in an incompatible manner Parameter 2 name mismatch: base parameter is named "o", override parameter is named "obj" (reportIncompatibleMethodOverride)
This check is currently turned of in our `basic` `typeCheckingMode` profile, but is enabled in the `standard` profile. Things done here: - removed the invalid cross inheritance, as the bases conflict on `extract` method Extractor -> Command ^ | x | v v DirectoryExtractor -> MultiFileCommand Error: unblob/extractors/command.py unblob/extractors/command.py:106:9 - error: Method "extract" overrides class "Command" in an incompatible manner Parameter 2 name mismatch: base parameter is named "inpath", override parameter is named "paths" (reportIncompatibleMethodOverride)
This check is currently turned of in our `basic` `typeCheckingMode` profile, but is enabled in the `standard` profile. Things done here: - made the type of `Handler.EXTRACTOR` covariant, so child-classes can further narrow its type Error: unblob/handlers/archive/cpio.py unblob/handlers/archive/cpio.py:413:5 - error: "EXTRACTOR" overrides symbol of same name in class "Handler" Variable is mutable so its type is invariant Override type "_CPIOExtractorBase" is not the same as base type "Extractor | None" (reportIncompatibleVariableOverride)
This check is currently turned of in our `basic` `typeCheckingMode` profile, but is enabled in the `standard` profile. Things done here: - instead of incompatible overriding `read`, added a new `read_all` method, to better express the functionality of that method Error: unblob/handlers/compression/_gzip_reader.py unblob/handlers/compression/_gzip_reader.py:18:9 - error: Method "read" overrides class "DecompressReader" in an incompatible manner Positional parameter count mismatch; base method has 2, but override has 1 Parameter 2 mismatch: base parameter "size" is keyword parameter, override parameter is position-only (reportIncompatibleMethodOverride)
vlaci
force-pushed
the
pyright-standard-type-checking-mode
branch
from
January 21, 2025 16:15
a63767a
to
cf1bf3c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See individual commits for explanations