massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / fileinput.pyi
1 import sys
2 from _typeshed import Self, StrOrBytesPath
3 from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator
4
5 if sys.version_info >= (3, 9):
6     from types import GenericAlias
7
8 if sys.version_info >= (3, 10):
9     def input(
10         files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
11         inplace: bool = ...,
12         backup: str = ...,
13         *,
14         mode: str = ...,
15         openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ...,
16         encoding: str | None = ...,
17         errors: str | None = ...,
18     ) -> FileInput[AnyStr]: ...
19
20 elif sys.version_info >= (3, 8):
21     def input(
22         files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
23         inplace: bool = ...,
24         backup: str = ...,
25         *,
26         mode: str = ...,
27         openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ...,
28     ) -> FileInput[AnyStr]: ...
29
30 else:
31     def input(
32         files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
33         inplace: bool = ...,
34         backup: str = ...,
35         bufsize: int = ...,
36         mode: str = ...,
37         openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ...,
38     ) -> FileInput[AnyStr]: ...
39
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: ...
48
49 class FileInput(Iterable[AnyStr], Generic[AnyStr]):
50     if sys.version_info >= (3, 10):
51         def __init__(
52             self,
53             files: None | StrOrBytesPath | Iterable[StrOrBytesPath] = ...,
54             inplace: bool = ...,
55             backup: str = ...,
56             *,
57             mode: str = ...,
58             openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ...,
59             encoding: str | None = ...,
60             errors: str | None = ...,
61         ) -> None: ...
62     elif sys.version_info >= (3, 8):
63         def __init__(
64             self,
65             files: None | StrOrBytesPath | Iterable[StrOrBytesPath] = ...,
66             inplace: bool = ...,
67             backup: str = ...,
68             *,
69             mode: str = ...,
70             openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ...,
71         ) -> None: ...
72     else:
73         def __init__(
74             self,
75             files: None | StrOrBytesPath | Iterable[StrOrBytesPath] = ...,
76             inplace: bool = ...,
77             backup: str = ...,
78             bufsize: int = ...,
79             mode: str = ...,
80             openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ...,
81         ) -> None: ...
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: ...
99
100 if sys.version_info >= (3, 10):
101     def hook_compressed(
102         filename: StrOrBytesPath, mode: str, *, encoding: str | None = ..., errors: str | None = ...
103     ) -> IO[Any]: ...
104
105 else:
106     def hook_compressed(filename: StrOrBytesPath, mode: str) -> IO[Any]: ...
107
108 def hook_encoded(encoding: str, errors: str | None = ...) -> Callable[[StrOrBytesPath, str], IO[Any]]: ...