mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-25 09:28:14 +00:00
[ty] Todo-types for os.fdopen, NamedTemporaryFile, and Path.open (#20549)
## Summary
This applies the trick that we use for `builtins.open` to similar
functions that have the same problem. The reason is that the problem
would otherwise become even more pronounced once we add understanding of
the implicit type of `self` parameters, because then something like
`(base_path / "test.bin").open("rb")` also leads to a wrong return type
and can result in false positives.
## Test Plan
New Markdown tests
This commit is contained in:
parent
eea87e24e3
commit
fcc76bb7b2
7 changed files with 240 additions and 100 deletions
|
|
@ -318,6 +318,9 @@ pub enum KnownModule {
|
|||
TypingExtensions,
|
||||
Typing,
|
||||
Sys,
|
||||
Os,
|
||||
Tempfile,
|
||||
Pathlib,
|
||||
Abc,
|
||||
Dataclasses,
|
||||
Collections,
|
||||
|
|
@ -347,6 +350,9 @@ impl KnownModule {
|
|||
Self::Typeshed => "_typeshed",
|
||||
Self::TypingExtensions => "typing_extensions",
|
||||
Self::Sys => "sys",
|
||||
Self::Os => "os",
|
||||
Self::Tempfile => "tempfile",
|
||||
Self::Pathlib => "pathlib",
|
||||
Self::Abc => "abc",
|
||||
Self::Dataclasses => "dataclasses",
|
||||
Self::Collections => "collections",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue