Added a few missing type arguments for generic types used in stdlib stubs

I just found and fixed a bug in pyright's "missing type arguments" check. When type arguments were omitted for a generic type within a subscript expression, the error was being suppressed. With this bug fixed, I found several new cases where type arguments were missing in stdlib stubs. (#5130)

Co-authored-by: Eric Traut <erictr@microsoft.com>
This commit is contained in:
Eric Traut
2021-03-22 18:28:04 -07:00
committed by GitHub
parent a68fb50788
commit 0ec182227c
11 changed files with 15 additions and 14 deletions

View File

@@ -1,4 +1,5 @@
import sys
from typing import Any
# This is a >=3.7 module, so we conditionally include its source.
if sys.version_info >= (3, 7):
@@ -8,7 +9,7 @@ if sys.version_info >= (3, 7):
from typing import BinaryIO, ContextManager, Iterator, TextIO, Union
Package = Union[str, ModuleType]
Resource = Union[str, os.PathLike]
Resource = Union[str, os.PathLike[Any]]
def open_binary(package: Package, resource: Resource) -> BinaryIO: ...
def open_text(package: Package, resource: Resource, encoding: str = ..., errors: str = ...) -> TextIO: ...
def read_binary(package: Package, resource: Resource) -> bytes: ...