2 from _typeshed import Self, StrOrBytesPath
3 from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator
5 if sys.version_info >= (3, 9):
6 from types import GenericAlias
8 if sys.version_info >= (3, 10):
10 files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
15 openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ...,
16 encoding: str | None = ...,
17 errors: str | None = ...,
18 ) -> FileInput[AnyStr]: ...
20 elif sys.version_info >= (3, 8):
22 files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
27 openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ...,
28 ) -> FileInput[AnyStr]: ...
32 files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
37 openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ...,
38 ) -> FileInput[AnyStr]: ...
40 def close() -> None: ...
41 def nextfile() -> None: ...
42 def filename() -> str: ...
43 def lineno() -> int: ...
44 def filelineno() -> int: ...
45 def fileno() -> int: ...
46 def isfirstline() -> bool: ...
47 def isstdin() -> bool: ...
49 class FileInput(Iterable[AnyStr], Generic[AnyStr]):
50 if sys.version_info >= (3, 10):
53 files: None | StrOrBytesPath | Iterable[StrOrBytesPath] = ...,
58 openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ...,
59 encoding: str | None = ...,
60 errors: str | None = ...,
62 elif sys.version_info >= (3, 8):
65 files: None | StrOrBytesPath | Iterable[StrOrBytesPath] = ...,
70 openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ...,
75 files: None | StrOrBytesPath | Iterable[StrOrBytesPath] = ...,
80 openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ...,
82 def __del__(self) -> None: ...
83 def close(self) -> None: ...
84 def __enter__(self: Self) -> Self: ...
85 def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ...
86 def __iter__(self) -> Iterator[AnyStr]: ...
87 def __next__(self) -> AnyStr: ...
88 def __getitem__(self, i: int) -> AnyStr: ...
89 def nextfile(self) -> None: ...
90 def readline(self) -> AnyStr: ...
91 def filename(self) -> str: ...
92 def lineno(self) -> int: ...
93 def filelineno(self) -> int: ...
94 def fileno(self) -> int: ...
95 def isfirstline(self) -> bool: ...
96 def isstdin(self) -> bool: ...
97 if sys.version_info >= (3, 9):
98 def __class_getitem__(cls, item: Any) -> GenericAlias: ...
100 if sys.version_info >= (3, 10):
102 filename: StrOrBytesPath, mode: str, *, encoding: str | None = ..., errors: str | None = ...
106 def hook_compressed(filename: StrOrBytesPath, mode: str) -> IO[Any]: ...
108 def hook_encoded(encoding: str, errors: str | None = ...) -> Callable[[StrOrBytesPath, str], IO[Any]]: ...