basedpyright 1.13.2 → 1.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/dist/pyright-langserver.js +1 -1
  2. package/dist/pyright-langserver.js.map +1 -1
  3. package/dist/pyright.js +1 -1
  4. package/dist/pyright.js.map +1 -1
  5. package/dist/typeshed-fallback/commit.txt +1 -1
  6. package/dist/typeshed-fallback/stdlib/VERSIONS +2 -0
  7. package/dist/typeshed-fallback/stdlib/_ast.pyi +42 -279
  8. package/dist/typeshed-fallback/stdlib/_bisect.pyi +221 -221
  9. package/dist/typeshed-fallback/stdlib/_bootlocale.pyi +1 -1
  10. package/dist/typeshed-fallback/stdlib/_collections_abc.pyi +15 -5
  11. package/dist/typeshed-fallback/stdlib/_csv.pyi +213 -213
  12. package/dist/typeshed-fallback/stdlib/_decimal.pyi +0 -18
  13. package/dist/typeshed-fallback/stdlib/_dummy_thread.pyi +33 -33
  14. package/dist/typeshed-fallback/stdlib/_dummy_threading.pyi +180 -164
  15. package/dist/typeshed-fallback/stdlib/_heapq.pyi +67 -67
  16. package/dist/typeshed-fallback/stdlib/_interpqueues.pyi +16 -0
  17. package/dist/typeshed-fallback/stdlib/_interpreters.pyi +50 -0
  18. package/dist/typeshed-fallback/stdlib/_json.pyi +92 -92
  19. package/dist/typeshed-fallback/stdlib/_lsprof.pyi +92 -92
  20. package/dist/typeshed-fallback/stdlib/_msi.pyi +94 -92
  21. package/dist/typeshed-fallback/stdlib/_operator.pyi +0 -24
  22. package/dist/typeshed-fallback/stdlib/_random.pyi +30 -30
  23. package/dist/typeshed-fallback/stdlib/_tkinter.pyi +6 -2
  24. package/dist/typeshed-fallback/stdlib/_weakrefset.pyi +7 -1
  25. package/dist/typeshed-fallback/stdlib/abc.pyi +12 -4
  26. package/dist/typeshed-fallback/stdlib/argparse.pyi +3 -1
  27. package/dist/typeshed-fallback/stdlib/array.pyi +281 -281
  28. package/dist/typeshed-fallback/stdlib/asynchat.pyi +21 -21
  29. package/dist/typeshed-fallback/stdlib/asyncio/events.pyi +35 -4
  30. package/dist/typeshed-fallback/stdlib/asyncio/futures.pyi +107 -15
  31. package/dist/typeshed-fallback/stdlib/asyncio/locks.pyi +9 -3
  32. package/dist/typeshed-fallback/stdlib/asyncio/queues.pyi +10 -2
  33. package/dist/typeshed-fallback/stdlib/asyncio/sslproto.pyi +23 -4
  34. package/dist/typeshed-fallback/stdlib/asyncio/tasks.pyi +107 -12
  35. package/dist/typeshed-fallback/stdlib/asyncio/windows_events.pyi +86 -86
  36. package/dist/typeshed-fallback/stdlib/asyncio/windows_utils.pyi +49 -49
  37. package/dist/typeshed-fallback/stdlib/asyncore.pyi +90 -90
  38. package/dist/typeshed-fallback/stdlib/audioop.pyi +95 -95
  39. package/dist/typeshed-fallback/stdlib/binascii.pyi +123 -123
  40. package/dist/typeshed-fallback/stdlib/binhex.pyi +45 -45
  41. package/dist/typeshed-fallback/stdlib/builtins.pyi +0 -1
  42. package/dist/typeshed-fallback/stdlib/bz2.pyi +59 -6
  43. package/dist/typeshed-fallback/stdlib/cmath.pyi +112 -112
  44. package/dist/typeshed-fallback/stdlib/codecs.pyi +18 -6
  45. package/dist/typeshed-fallback/stdlib/collections/__init__.pyi +200 -56
  46. package/dist/typeshed-fallback/stdlib/concurrent/futures/__init__.pyi +33 -14
  47. package/dist/typeshed-fallback/stdlib/concurrent/futures/_base.pyi +7 -1
  48. package/dist/typeshed-fallback/stdlib/concurrent/futures/thread.pyi +7 -1
  49. package/dist/typeshed-fallback/stdlib/contextvars.pyi +99 -16
  50. package/dist/typeshed-fallback/stdlib/csv.pyi +14 -2
  51. package/dist/typeshed-fallback/stdlib/ctypes/__init__.pyi +7 -1
  52. package/dist/typeshed-fallback/stdlib/ctypes/_endian.pyi +6 -2
  53. package/dist/typeshed-fallback/stdlib/curses/panel.pyi +16 -4
  54. package/dist/typeshed-fallback/stdlib/dataclasses.pyi +7 -1
  55. package/dist/typeshed-fallback/stdlib/datetime.pyi +346 -104
  56. package/dist/typeshed-fallback/stdlib/dbm/gnu.pyi +52 -2
  57. package/dist/typeshed-fallback/stdlib/dbm/ndbm.pyi +26 -2
  58. package/dist/typeshed-fallback/stdlib/difflib.pyi +7 -1
  59. package/dist/typeshed-fallback/stdlib/distutils/__init__.pyi +5 -5
  60. package/dist/typeshed-fallback/stdlib/distutils/archive_util.pyi +35 -35
  61. package/dist/typeshed-fallback/stdlib/distutils/bcppcompiler.pyi +3 -3
  62. package/dist/typeshed-fallback/stdlib/distutils/ccompiler.pyi +173 -173
  63. package/dist/typeshed-fallback/stdlib/distutils/cmd.pyi +99 -99
  64. package/dist/typeshed-fallback/stdlib/distutils/command/bdist.pyi +25 -25
  65. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_dumb.pyi +21 -21
  66. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_msi.pyi +45 -45
  67. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_rpm.pyi +52 -52
  68. package/dist/typeshed-fallback/stdlib/distutils/command/bdist_wininst.pyi +16 -16
  69. package/dist/typeshed-fallback/stdlib/distutils/command/build.pyi +33 -33
  70. package/dist/typeshed-fallback/stdlib/distutils/command/build_clib.pyi +27 -27
  71. package/dist/typeshed-fallback/stdlib/distutils/command/build_ext.pyi +50 -50
  72. package/dist/typeshed-fallback/stdlib/distutils/command/build_py.pyi +44 -44
  73. package/dist/typeshed-fallback/stdlib/distutils/command/build_scripts.pyi +24 -24
  74. package/dist/typeshed-fallback/stdlib/distutils/command/check.pyi +39 -39
  75. package/dist/typeshed-fallback/stdlib/distutils/command/clean.pyi +17 -17
  76. package/dist/typeshed-fallback/stdlib/distutils/command/config.pyi +84 -84
  77. package/dist/typeshed-fallback/stdlib/distutils/command/install.pyi +65 -65
  78. package/dist/typeshed-fallback/stdlib/distutils/command/install_data.pyi +19 -19
  79. package/dist/typeshed-fallback/stdlib/distutils/command/install_egg_info.pyi +18 -18
  80. package/dist/typeshed-fallback/stdlib/distutils/command/install_headers.pyi +16 -16
  81. package/dist/typeshed-fallback/stdlib/distutils/command/install_lib.pyi +25 -25
  82. package/dist/typeshed-fallback/stdlib/distutils/command/install_scripts.pyi +18 -18
  83. package/dist/typeshed-fallback/stdlib/distutils/command/register.pyi +20 -20
  84. package/dist/typeshed-fallback/stdlib/distutils/command/sdist.pyi +44 -44
  85. package/dist/typeshed-fallback/stdlib/distutils/command/upload.pyi +17 -17
  86. package/dist/typeshed-fallback/stdlib/distutils/config.pyi +17 -17
  87. package/dist/typeshed-fallback/stdlib/distutils/core.pyi +57 -57
  88. package/dist/typeshed-fallback/stdlib/distutils/cygwinccompiler.pyi +20 -20
  89. package/dist/typeshed-fallback/stdlib/distutils/debug.pyi +1 -1
  90. package/dist/typeshed-fallback/stdlib/distutils/dep_util.pyi +14 -14
  91. package/dist/typeshed-fallback/stdlib/distutils/dir_util.pyi +23 -23
  92. package/dist/typeshed-fallback/stdlib/distutils/dist.pyi +149 -149
  93. package/dist/typeshed-fallback/stdlib/distutils/errors.pyi +19 -19
  94. package/dist/typeshed-fallback/stdlib/distutils/extension.pyi +36 -36
  95. package/dist/typeshed-fallback/stdlib/distutils/fancy_getopt.pyi +34 -34
  96. package/dist/typeshed-fallback/stdlib/distutils/file_util.pyi +38 -38
  97. package/dist/typeshed-fallback/stdlib/distutils/filelist.pyi +58 -58
  98. package/dist/typeshed-fallback/stdlib/distutils/log.pyi +25 -25
  99. package/dist/typeshed-fallback/stdlib/distutils/msvccompiler.pyi +3 -3
  100. package/dist/typeshed-fallback/stdlib/distutils/spawn.pyi +6 -6
  101. package/dist/typeshed-fallback/stdlib/distutils/sysconfig.pyi +33 -33
  102. package/dist/typeshed-fallback/stdlib/distutils/text_file.pyi +21 -21
  103. package/dist/typeshed-fallback/stdlib/distutils/unixccompiler.pyi +3 -3
  104. package/dist/typeshed-fallback/stdlib/distutils/util.pyi +50 -50
  105. package/dist/typeshed-fallback/stdlib/distutils/version.pyi +38 -36
  106. package/dist/typeshed-fallback/stdlib/dummy_threading.pyi +2 -2
  107. package/dist/typeshed-fallback/stdlib/email/_header_value_parser.pyi +3 -1
  108. package/dist/typeshed-fallback/stdlib/email/charset.pyi +3 -1
  109. package/dist/typeshed-fallback/stdlib/email/header.pyi +3 -1
  110. package/dist/typeshed-fallback/stdlib/email/headerregistry.pyi +6 -1
  111. package/dist/typeshed-fallback/stdlib/enum.pyi +8 -1
  112. package/dist/typeshed-fallback/stdlib/filecmp.pyi +7 -1
  113. package/dist/typeshed-fallback/stdlib/fileinput.pyi +7 -1
  114. package/dist/typeshed-fallback/stdlib/formatter.pyi +88 -88
  115. package/dist/typeshed-fallback/stdlib/fractions.pyi +6 -2
  116. package/dist/typeshed-fallback/stdlib/functools.pyi +65 -13
  117. package/dist/typeshed-fallback/stdlib/graphlib.pyi +7 -1
  118. package/dist/typeshed-fallback/stdlib/gzip.pyi +3 -1
  119. package/dist/typeshed-fallback/stdlib/hashlib.pyi +42 -14
  120. package/dist/typeshed-fallback/stdlib/heapq.pyi +3 -1
  121. package/dist/typeshed-fallback/stdlib/hmac.pyi +30 -2
  122. package/dist/typeshed-fallback/stdlib/http/cookies.pyi +7 -1
  123. package/dist/typeshed-fallback/stdlib/imp.pyi +62 -62
  124. package/dist/typeshed-fallback/stdlib/importlib/abc.pyi +3 -1
  125. package/dist/typeshed-fallback/stdlib/importlib/machinery.pyi +3 -1
  126. package/dist/typeshed-fallback/stdlib/importlib/metadata/__init__.pyi +79 -15
  127. package/dist/typeshed-fallback/stdlib/importlib/metadata/_meta.pyi +3 -1
  128. package/dist/typeshed-fallback/stdlib/importlib/resources/simple.pyi +3 -1
  129. package/dist/typeshed-fallback/stdlib/io.pyi +428 -44
  130. package/dist/typeshed-fallback/stdlib/ipaddress.pyi +153 -28
  131. package/dist/typeshed-fallback/stdlib/itertools.pyi +5 -1
  132. package/dist/typeshed-fallback/stdlib/json/encoder.pyi +14 -2
  133. package/dist/typeshed-fallback/stdlib/keyword.pyi +6 -2
  134. package/dist/typeshed-fallback/stdlib/lib2to3/pytree.pyi +12 -2
  135. package/dist/typeshed-fallback/stdlib/logging/__init__.pyi +17 -3
  136. package/dist/typeshed-fallback/stdlib/lzma.pyi +107 -9
  137. package/dist/typeshed-fallback/stdlib/mailbox.pyi +14 -2
  138. package/dist/typeshed-fallback/stdlib/math.pyi +424 -424
  139. package/dist/typeshed-fallback/stdlib/mmap.pyi +160 -160
  140. package/dist/typeshed-fallback/stdlib/msilib/__init__.pyi +177 -177
  141. package/dist/typeshed-fallback/stdlib/msilib/schema.pyi +94 -94
  142. package/dist/typeshed-fallback/stdlib/msilib/sequence.pyi +13 -13
  143. package/dist/typeshed-fallback/stdlib/msilib/text.pyi +7 -7
  144. package/dist/typeshed-fallback/stdlib/multiprocessing/connection.pyi +9 -3
  145. package/dist/typeshed-fallback/stdlib/multiprocessing/context.pyi +12 -2
  146. package/dist/typeshed-fallback/stdlib/multiprocessing/dummy/__init__.pyi +3 -1
  147. package/dist/typeshed-fallback/stdlib/multiprocessing/managers.pyi +10 -2
  148. package/dist/typeshed-fallback/stdlib/multiprocessing/pool.pyi +7 -1
  149. package/dist/typeshed-fallback/stdlib/multiprocessing/popen_spawn_win32.pyi +30 -30
  150. package/dist/typeshed-fallback/stdlib/multiprocessing/process.pyi +15 -4
  151. package/dist/typeshed-fallback/stdlib/multiprocessing/queues.pyi +14 -2
  152. package/dist/typeshed-fallback/stdlib/multiprocessing/shared_memory.pyi +19 -5
  153. package/dist/typeshed-fallback/stdlib/nis.pyi +31 -4
  154. package/dist/typeshed-fallback/stdlib/numbers.pyi +26 -6
  155. package/dist/typeshed-fallback/stdlib/opcode.pyi +3 -1
  156. package/dist/typeshed-fallback/stdlib/optparse.pyi +3 -1
  157. package/dist/typeshed-fallback/stdlib/os/__init__.pyi +1447 -217
  158. package/dist/typeshed-fallback/stdlib/pathlib.pyi +42 -11
  159. package/dist/typeshed-fallback/stdlib/pickle.pyi +200 -12
  160. package/dist/typeshed-fallback/stdlib/posixpath.pyi +6 -2
  161. package/dist/typeshed-fallback/stdlib/pyexpat/errors.pyi +2 -0
  162. package/dist/typeshed-fallback/stdlib/pyexpat/model.pyi +2 -0
  163. package/dist/typeshed-fallback/stdlib/queue.pyi +57 -9
  164. package/dist/typeshed-fallback/stdlib/re.pyi +219 -57
  165. package/dist/typeshed-fallback/stdlib/sched.pyi +8 -1
  166. package/dist/typeshed-fallback/stdlib/signal.pyi +95 -19
  167. package/dist/typeshed-fallback/stdlib/smtpd.pyi +91 -91
  168. package/dist/typeshed-fallback/stdlib/socket.pyi +12 -2
  169. package/dist/typeshed-fallback/stdlib/sqlite3/dbapi2.pyi +417 -83
  170. package/dist/typeshed-fallback/stdlib/ssl.pyi +133 -22
  171. package/dist/typeshed-fallback/stdlib/statistics.pyi +20 -5
  172. package/dist/typeshed-fallback/stdlib/struct.pyi +114 -13
  173. package/dist/typeshed-fallback/stdlib/subprocess.pyi +14 -2
  174. package/dist/typeshed-fallback/stdlib/symbol.pyi +93 -93
  175. package/dist/typeshed-fallback/stdlib/symtable.pyi +30 -1
  176. package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +7 -3
  177. package/dist/typeshed-fallback/stdlib/tarfile.pyi +6 -2
  178. package/dist/typeshed-fallback/stdlib/tempfile.pyi +17 -3
  179. package/dist/typeshed-fallback/stdlib/threading.pyi +68 -7
  180. package/dist/typeshed-fallback/stdlib/tkinter/__init__.pyi +3 -1
  181. package/dist/typeshed-fallback/stdlib/turtle.pyi +11 -3
  182. package/dist/typeshed-fallback/stdlib/types.pyi +306 -79
  183. package/dist/typeshed-fallback/stdlib/typing.pyi +310 -31
  184. package/dist/typeshed-fallback/stdlib/typing_extensions.pyi +42 -11
  185. package/dist/typeshed-fallback/stdlib/unittest/__init__.pyi +6 -1
  186. package/dist/typeshed-fallback/stdlib/unittest/case.pyi +7 -1
  187. package/dist/typeshed-fallback/stdlib/unittest/mock.pyi +3 -1
  188. package/dist/typeshed-fallback/stdlib/urllib/parse.pyi +51 -3
  189. package/dist/typeshed-fallback/stdlib/weakref.pyi +6 -2
  190. package/dist/typeshed-fallback/stdlib/winsound.pyi +44 -28
  191. package/dist/typeshed-fallback/stdlib/xml/dom/minicompat.pyi +6 -2
  192. package/dist/typeshed-fallback/stdlib/xml/dom/minidom.pyi +33 -11
  193. package/dist/typeshed-fallback/stdlib/xml/etree/ElementTree.pyi +30 -10
  194. package/dist/typeshed-fallback/stdlib/xml/parsers/expat/errors.pyi +2 -0
  195. package/dist/typeshed-fallback/stdlib/xml/parsers/expat/model.pyi +2 -0
  196. package/dist/typeshed-fallback/stdlib/xxlimited.pyi +19 -4
  197. package/dist/typeshed-fallback/stdlib/zipimport.pyi +31 -0
  198. package/dist/typeshed-fallback/stdlib/zlib.pyi +157 -157
  199. package/dist/typeshed-fallback/stdlib/zoneinfo/__init__.pyi +18 -6
  200. package/dist/typeshed-fallback/stubs/assertpy/assertpy/extracting.pyi +2 -2
  201. package/dist/typeshed-fallback/stubs/docker/docker/_types.pyi +18 -1
  202. package/dist/typeshed-fallback/stubs/docker/docker/api/container.pyi +5 -19
  203. package/dist/typeshed-fallback/stubs/docker/docker/api/daemon.pyi +2 -1
  204. package/dist/typeshed-fallback/stubs/docker/docker/models/containers.pyi +268 -6
  205. package/dist/typeshed-fallback/stubs/docker/docker/types/containers.pyi +3 -7
  206. package/dist/typeshed-fallback/stubs/docker/docker/types/daemon.pyi +10 -4
  207. package/dist/typeshed-fallback/stubs/docutils/docutils/parsers/rst/states.pyi +47 -0
  208. package/dist/typeshed-fallback/stubs/gdb/gdb/__init__.pyi +1 -1
  209. package/dist/typeshed-fallback/stubs/networkx/networkx/algorithms/shortest_paths/generic.pyi +1 -1
  210. package/dist/typeshed-fallback/stubs/openpyxl/METADATA.toml +1 -1
  211. package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/extended.pyi +0 -2
  212. package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/styles/named_styles.pyi +2 -1
  213. package/dist/typeshed-fallback/stubs/pygit2/METADATA.toml +1 -1
  214. package/dist/typeshed-fallback/stubs/pytest-lazy-fixture/pytest_lazyfixture.pyi +2 -2
  215. package/dist/typeshed-fallback/stubs/python-crontab/METADATA.toml +1 -1
  216. package/dist/typeshed-fallback/stubs/reportlab/METADATA.toml +1 -1
  217. package/dist/typeshed-fallback/stubs/reportlab/reportlab/lib/rl_safe_eval.pyi +23 -11
  218. package/dist/typeshed-fallback/stubs/reportlab/reportlab/pdfbase/pdfdoc.pyi +6 -0
  219. package/dist/typeshed-fallback/stubs/setuptools/METADATA.toml +1 -1
  220. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/archive_util.pyi +8 -8
  221. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/ccompiler.pyi +11 -17
  222. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/cmd.pyi +11 -11
  223. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/build_py.pyi +1 -2
  224. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/filelist.pyi +4 -12
  225. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/sysconfig.pyi +2 -4
  226. package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/util.pyi +5 -8
  227. package/dist/typeshed-fallback/stubs/str2bool/METADATA.toml +2 -0
  228. package/dist/typeshed-fallback/stubs/str2bool/str2bool/__init__.pyi +7 -0
  229. package/package.json +1 -1
@@ -1,88 +1,88 @@
1
- from collections.abc import Iterable
2
- from typing import IO, Any
3
- from typing_extensions import TypeAlias
4
-
5
- AS_IS: None
6
- _FontType: TypeAlias = tuple[str, bool, bool, bool]
7
- _StylesType: TypeAlias = tuple[Any, ...]
8
-
9
- class NullFormatter:
10
- writer: NullWriter | None
11
- def __init__(self, writer: NullWriter | None = None) -> None: ...
12
- def end_paragraph(self, blankline: int) -> None: ...
13
- def add_line_break(self) -> None: ...
14
- def add_hor_rule(self, *args: Any, **kw: Any) -> None: ...
15
- def add_label_data(self, format: str, counter: int, blankline: int | None = None) -> None: ...
16
- def add_flowing_data(self, data: str) -> None: ...
17
- def add_literal_data(self, data: str) -> None: ...
18
- def flush_softspace(self) -> None: ...
19
- def push_alignment(self, align: str | None) -> None: ...
20
- def pop_alignment(self) -> None: ...
21
- def push_font(self, x: _FontType) -> None: ...
22
- def pop_font(self) -> None: ...
23
- def push_margin(self, margin: int) -> None: ...
24
- def pop_margin(self) -> None: ...
25
- def set_spacing(self, spacing: str | None) -> None: ...
26
- def push_style(self, *styles: _StylesType) -> None: ...
27
- def pop_style(self, n: int = 1) -> None: ...
28
- def assert_line_data(self, flag: int = 1) -> None: ...
29
-
30
- class AbstractFormatter:
31
- writer: NullWriter
32
- align: str | None
33
- align_stack: list[str | None]
34
- font_stack: list[_FontType]
35
- margin_stack: list[int]
36
- spacing: str | None
37
- style_stack: Any
38
- nospace: int
39
- softspace: int
40
- para_end: int
41
- parskip: int
42
- hard_break: int
43
- have_label: int
44
- def __init__(self, writer: NullWriter) -> None: ...
45
- def end_paragraph(self, blankline: int) -> None: ...
46
- def add_line_break(self) -> None: ...
47
- def add_hor_rule(self, *args: Any, **kw: Any) -> None: ...
48
- def add_label_data(self, format: str, counter: int, blankline: int | None = None) -> None: ...
49
- def format_counter(self, format: Iterable[str], counter: int) -> str: ...
50
- def format_letter(self, case: str, counter: int) -> str: ...
51
- def format_roman(self, case: str, counter: int) -> str: ...
52
- def add_flowing_data(self, data: str) -> None: ...
53
- def add_literal_data(self, data: str) -> None: ...
54
- def flush_softspace(self) -> None: ...
55
- def push_alignment(self, align: str | None) -> None: ...
56
- def pop_alignment(self) -> None: ...
57
- def push_font(self, font: _FontType) -> None: ...
58
- def pop_font(self) -> None: ...
59
- def push_margin(self, margin: int) -> None: ...
60
- def pop_margin(self) -> None: ...
61
- def set_spacing(self, spacing: str | None) -> None: ...
62
- def push_style(self, *styles: _StylesType) -> None: ...
63
- def pop_style(self, n: int = 1) -> None: ...
64
- def assert_line_data(self, flag: int = 1) -> None: ...
65
-
66
- class NullWriter:
67
- def flush(self) -> None: ...
68
- def new_alignment(self, align: str | None) -> None: ...
69
- def new_font(self, font: _FontType) -> None: ...
70
- def new_margin(self, margin: int, level: int) -> None: ...
71
- def new_spacing(self, spacing: str | None) -> None: ...
72
- def new_styles(self, styles: tuple[Any, ...]) -> None: ...
73
- def send_paragraph(self, blankline: int) -> None: ...
74
- def send_line_break(self) -> None: ...
75
- def send_hor_rule(self, *args: Any, **kw: Any) -> None: ...
76
- def send_label_data(self, data: str) -> None: ...
77
- def send_flowing_data(self, data: str) -> None: ...
78
- def send_literal_data(self, data: str) -> None: ...
79
-
80
- class AbstractWriter(NullWriter): ...
81
-
82
- class DumbWriter(NullWriter):
83
- file: IO[str]
84
- maxcol: int
85
- def __init__(self, file: IO[str] | None = None, maxcol: int = 72) -> None: ...
86
- def reset(self) -> None: ...
87
-
88
- def test(file: str | None = None) -> None: ...
1
+ from collections.abc import Iterable
2
+ from typing import IO, Any
3
+ from typing_extensions import TypeAlias
4
+
5
+ AS_IS: None
6
+ _FontType: TypeAlias = tuple[str, bool, bool, bool]
7
+ _StylesType: TypeAlias = tuple[Any, ...]
8
+
9
+ class NullFormatter:
10
+ writer: NullWriter | None
11
+ def __init__(self, writer: NullWriter | None = None) -> None: ...
12
+ def end_paragraph(self, blankline: int) -> None: ...
13
+ def add_line_break(self) -> None: ...
14
+ def add_hor_rule(self, *args: Any, **kw: Any) -> None: ...
15
+ def add_label_data(self, format: str, counter: int, blankline: int | None = None) -> None: ...
16
+ def add_flowing_data(self, data: str) -> None: ...
17
+ def add_literal_data(self, data: str) -> None: ...
18
+ def flush_softspace(self) -> None: ...
19
+ def push_alignment(self, align: str | None) -> None: ...
20
+ def pop_alignment(self) -> None: ...
21
+ def push_font(self, x: _FontType) -> None: ...
22
+ def pop_font(self) -> None: ...
23
+ def push_margin(self, margin: int) -> None: ...
24
+ def pop_margin(self) -> None: ...
25
+ def set_spacing(self, spacing: str | None) -> None: ...
26
+ def push_style(self, *styles: _StylesType) -> None: ...
27
+ def pop_style(self, n: int = 1) -> None: ...
28
+ def assert_line_data(self, flag: int = 1) -> None: ...
29
+
30
+ class AbstractFormatter:
31
+ writer: NullWriter
32
+ align: str | None
33
+ align_stack: list[str | None]
34
+ font_stack: list[_FontType]
35
+ margin_stack: list[int]
36
+ spacing: str | None
37
+ style_stack: Any
38
+ nospace: int
39
+ softspace: int
40
+ para_end: int
41
+ parskip: int
42
+ hard_break: int
43
+ have_label: int
44
+ def __init__(self, writer: NullWriter) -> None: ...
45
+ def end_paragraph(self, blankline: int) -> None: ...
46
+ def add_line_break(self) -> None: ...
47
+ def add_hor_rule(self, *args: Any, **kw: Any) -> None: ...
48
+ def add_label_data(self, format: str, counter: int, blankline: int | None = None) -> None: ...
49
+ def format_counter(self, format: Iterable[str], counter: int) -> str: ...
50
+ def format_letter(self, case: str, counter: int) -> str: ...
51
+ def format_roman(self, case: str, counter: int) -> str: ...
52
+ def add_flowing_data(self, data: str) -> None: ...
53
+ def add_literal_data(self, data: str) -> None: ...
54
+ def flush_softspace(self) -> None: ...
55
+ def push_alignment(self, align: str | None) -> None: ...
56
+ def pop_alignment(self) -> None: ...
57
+ def push_font(self, font: _FontType) -> None: ...
58
+ def pop_font(self) -> None: ...
59
+ def push_margin(self, margin: int) -> None: ...
60
+ def pop_margin(self) -> None: ...
61
+ def set_spacing(self, spacing: str | None) -> None: ...
62
+ def push_style(self, *styles: _StylesType) -> None: ...
63
+ def pop_style(self, n: int = 1) -> None: ...
64
+ def assert_line_data(self, flag: int = 1) -> None: ...
65
+
66
+ class NullWriter:
67
+ def flush(self) -> None: ...
68
+ def new_alignment(self, align: str | None) -> None: ...
69
+ def new_font(self, font: _FontType) -> None: ...
70
+ def new_margin(self, margin: int, level: int) -> None: ...
71
+ def new_spacing(self, spacing: str | None) -> None: ...
72
+ def new_styles(self, styles: tuple[Any, ...]) -> None: ...
73
+ def send_paragraph(self, blankline: int) -> None: ...
74
+ def send_line_break(self) -> None: ...
75
+ def send_hor_rule(self, *args: Any, **kw: Any) -> None: ...
76
+ def send_label_data(self, data: str) -> None: ...
77
+ def send_flowing_data(self, data: str) -> None: ...
78
+ def send_literal_data(self, data: str) -> None: ...
79
+
80
+ class AbstractWriter(NullWriter): ...
81
+
82
+ class DumbWriter(NullWriter):
83
+ file: IO[str]
84
+ maxcol: int
85
+ def __init__(self, file: IO[str] | None = None, maxcol: int = 72) -> None: ...
86
+ def reset(self) -> None: ...
87
+
88
+ def test(file: str | None = None) -> None: ...
@@ -144,7 +144,11 @@ class Fraction(Rational):
144
144
  # Not actually defined within fractions.py, but provides more useful
145
145
  # overrides
146
146
  @property
147
- def real(self) -> Fraction: ...
147
+ def real(self) -> Fraction:
148
+ """Real numbers are their real component."""
149
+ ...
148
150
  @property
149
- def imag(self) -> Literal[0]: ...
151
+ def imag(self) -> Literal[0]:
152
+ """Real numbers have no imaginary component."""
153
+ ...
150
154
  def conjugate(self) -> Fraction: ...
@@ -36,9 +36,31 @@ _PWrapper = ParamSpec("_PWrapper")
36
36
  _RWrapper = TypeVar("_RWrapper")
37
37
 
38
38
  @overload
39
- def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T, /) -> _T: ...
39
+ def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T, /) -> _T:
40
+ """
41
+ reduce(function, sequence[, initial]) -> value
42
+
43
+ Apply a function of two arguments cumulatively to the items of a sequence,
44
+ from left to right, so as to reduce the sequence to a single value.
45
+ For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates
46
+ ((((1+2)+3)+4)+5). If initial is present, it is placed before the items
47
+ of the sequence in the calculation, and serves as a default when the
48
+ sequence is empty.
49
+ """
50
+ ...
40
51
  @overload
41
- def reduce(function: Callable[[_T, _T], _T], sequence: Iterable[_T], /) -> _T: ...
52
+ def reduce(function: Callable[[_T, _T], _T], sequence: Iterable[_T], /) -> _T:
53
+ """
54
+ reduce(function, sequence[, initial]) -> value
55
+
56
+ Apply a function of two arguments cumulatively to the items of a sequence,
57
+ from left to right, so as to reduce the sequence to a single value.
58
+ For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates
59
+ ((((1+2)+3)+4)+5). If initial is present, it is placed before the items
60
+ of the sequence in the calculation, and serves as a default when the
61
+ sequence is empty.
62
+ """
63
+ ...
42
64
 
43
65
  class _CacheInfo(NamedTuple):
44
66
  hits: int
@@ -54,9 +76,15 @@ if sys.version_info >= (3, 9):
54
76
  @final
55
77
  class _lru_cache_wrapper(Generic[_T]):
56
78
  __wrapped__: Callable[..., _T]
57
- def __call__(self, *args: Hashable, **kwargs: Hashable) -> _T: ...
58
- def cache_info(self) -> _CacheInfo: ...
59
- def cache_clear(self) -> None: ...
79
+ def __call__(self, *args: Hashable, **kwargs: Hashable) -> _T:
80
+ """Call self as a function."""
81
+ ...
82
+ def cache_info(self) -> _CacheInfo:
83
+ """Report cache statistics"""
84
+ ...
85
+ def cache_clear(self) -> None:
86
+ """Clear the cache and cache statistics"""
87
+ ...
60
88
  if sys.version_info >= (3, 9):
61
89
  def cache_parameters(self) -> _CacheParameters: ...
62
90
 
@@ -120,19 +148,31 @@ else:
120
148
  ) -> _Wrapper[_PWrapped, _RWrapped]: ...
121
149
 
122
150
  def total_ordering(cls: type[_T]) -> type[_T]: ...
123
- def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], SupportsAllComparisons]: ...
151
+ def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], SupportsAllComparisons]:
152
+ """Convert a cmp= function into a key= function."""
153
+ ...
124
154
 
125
155
  class partial(Generic[_T]):
126
156
  @property
127
- def func(self) -> Callable[..., _T]: ...
157
+ def func(self) -> Callable[..., _T]:
158
+ """function object to use in future partial calls"""
159
+ ...
128
160
  @property
129
- def args(self) -> tuple[Any, ...]: ...
161
+ def args(self) -> tuple[Any, ...]:
162
+ """tuple of arguments to future partial calls"""
163
+ ...
130
164
  @property
131
- def keywords(self) -> dict[str, Any]: ...
165
+ def keywords(self) -> dict[str, Any]:
166
+ """dictionary of keyword arguments to future partial calls"""
167
+ ...
132
168
  def __new__(cls, func: Callable[..., _T], /, *args: Any, **kwargs: Any) -> Self: ...
133
- def __call__(self, /, *args: Any, **kwargs: Any) -> _T: ...
169
+ def __call__(self, /, *args: Any, **kwargs: Any) -> _T:
170
+ """Call self as a function."""
171
+ ...
134
172
  if sys.version_info >= (3, 9):
135
- def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
173
+ def __class_getitem__(cls, item: Any, /) -> GenericAlias:
174
+ """See PEP 585"""
175
+ ...
136
176
 
137
177
  # With protocols, this could change into a generic protocol that defines __get__ and returns _T
138
178
  _Descriptor: TypeAlias = Any
@@ -149,7 +189,13 @@ class partialmethod(Generic[_T]):
149
189
  @property
150
190
  def __isabstractmethod__(self) -> bool: ...
151
191
  if sys.version_info >= (3, 9):
152
- def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
192
+ def __class_getitem__(cls, item: Any, /) -> GenericAlias:
193
+ """
194
+ Represent a PEP 585 generic type
195
+
196
+ E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
197
+ """
198
+ ...
153
199
 
154
200
  class _SingleDispatchCallable(Generic[_T]):
155
201
  registry: types.MappingProxyType[Any, Callable[..., _T]]
@@ -196,7 +242,13 @@ class cached_property(Generic[_T_co]):
196
242
  # __set__ is not defined at runtime, but @cached_property is designed to be settable
197
243
  def __set__(self, instance: object, value: _T_co) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
198
244
  if sys.version_info >= (3, 9):
199
- def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
245
+ def __class_getitem__(cls, item: Any, /) -> GenericAlias:
246
+ """
247
+ Represent a PEP 585 generic type
248
+
249
+ E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
250
+ """
251
+ ...
200
252
 
201
253
  if sys.version_info >= (3, 9):
202
254
  def cache(user_function: Callable[..., _T], /) -> _lru_cache_wrapper[_T]: ...
@@ -23,6 +23,12 @@ class TopologicalSorter(Generic[_T]):
23
23
  def get_ready(self) -> tuple[_T, ...]: ...
24
24
  def static_order(self) -> Iterable[_T]: ...
25
25
  if sys.version_info >= (3, 11):
26
- def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
26
+ def __class_getitem__(cls, item: Any, /) -> GenericAlias:
27
+ """
28
+ Represent a PEP 585 generic type
29
+
30
+ E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
31
+ """
32
+ ...
27
33
 
28
34
  class CycleError(ValueError): ...
@@ -140,7 +140,9 @@ class GzipFile(_compression.BaseStream):
140
140
  def filename(self) -> str: ...
141
141
 
142
142
  @property
143
- def mtime(self) -> int | None: ...
143
+ def mtime(self) -> int | None:
144
+ """Last modification time read from stream, or None"""
145
+ ...
144
146
  crc: int
145
147
  def write(self, data: ReadableBuffer) -> int: ...
146
148
  def read(self, size: int | None = -1) -> bytes: ...
@@ -63,28 +63,54 @@ class _Hash:
63
63
 
64
64
  if sys.version_info >= (3, 9):
65
65
  def new(name: str, data: ReadableBuffer = b"", *, usedforsecurity: bool = ...) -> _Hash: ...
66
- def md5(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
67
- def sha1(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
68
- def sha224(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
69
- def sha256(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
70
- def sha384(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
71
- def sha512(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
66
+ def md5(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash:
67
+ """Returns a md5 hash object; optionally initialized with a string"""
68
+ ...
69
+ def sha1(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash:
70
+ """Returns a sha1 hash object; optionally initialized with a string"""
71
+ ...
72
+ def sha224(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash:
73
+ """Returns a sha224 hash object; optionally initialized with a string"""
74
+ ...
75
+ def sha256(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash:
76
+ """Returns a sha256 hash object; optionally initialized with a string"""
77
+ ...
78
+ def sha384(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash:
79
+ """Returns a sha384 hash object; optionally initialized with a string"""
80
+ ...
81
+ def sha512(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash:
82
+ """Returns a sha512 hash object; optionally initialized with a string"""
83
+ ...
72
84
 
73
85
  else:
74
86
  def new(name: str, data: ReadableBuffer = b"") -> _Hash: ...
75
- def md5(string: ReadableBuffer = b"") -> _Hash: ...
76
- def sha1(string: ReadableBuffer = b"") -> _Hash: ...
77
- def sha224(string: ReadableBuffer = b"") -> _Hash: ...
78
- def sha256(string: ReadableBuffer = b"") -> _Hash: ...
79
- def sha384(string: ReadableBuffer = b"") -> _Hash: ...
80
- def sha512(string: ReadableBuffer = b"") -> _Hash: ...
87
+ def md5(string: ReadableBuffer = b"") -> _Hash:
88
+ """Returns a md5 hash object; optionally initialized with a string"""
89
+ ...
90
+ def sha1(string: ReadableBuffer = b"") -> _Hash:
91
+ """Returns a sha1 hash object; optionally initialized with a string"""
92
+ ...
93
+ def sha224(string: ReadableBuffer = b"") -> _Hash:
94
+ """Returns a sha224 hash object; optionally initialized with a string"""
95
+ ...
96
+ def sha256(string: ReadableBuffer = b"") -> _Hash:
97
+ """Returns a sha256 hash object; optionally initialized with a string"""
98
+ ...
99
+ def sha384(string: ReadableBuffer = b"") -> _Hash:
100
+ """Returns a sha384 hash object; optionally initialized with a string"""
101
+ ...
102
+ def sha512(string: ReadableBuffer = b"") -> _Hash:
103
+ """Returns a sha512 hash object; optionally initialized with a string"""
104
+ ...
81
105
 
82
106
  algorithms_guaranteed: AbstractSet[str]
83
107
  algorithms_available: AbstractSet[str]
84
108
 
85
109
  def pbkdf2_hmac(
86
110
  hash_name: str, password: ReadableBuffer, salt: ReadableBuffer, iterations: int, dklen: int | None = None
87
- ) -> bytes: ...
111
+ ) -> bytes:
112
+ """Password based key derivation function 2 (PKCS #5 v2.0) with HMAC as pseudorandom function."""
113
+ ...
88
114
 
89
115
  class _VarLenHash:
90
116
  digest_size: int
@@ -105,7 +131,9 @@ shake_256 = _VarLenHash
105
131
 
106
132
  def scrypt(
107
133
  password: ReadableBuffer, *, salt: ReadableBuffer, n: int, r: int, p: int, maxmem: int = 0, dklen: int = 64
108
- ) -> bytes: ...
134
+ ) -> bytes:
135
+ """scrypt password-based key derivation function."""
136
+ ...
109
137
  @final
110
138
  class _BlakeHash(_Hash):
111
139
  MAX_DIGEST_SIZE: int
@@ -14,4 +14,6 @@ def merge(
14
14
  ) -> Iterable[_S]: ...
15
15
  def nlargest(n: int, iterable: Iterable[_S], key: Callable[[_S], SupportsRichComparison] | None = None) -> list[_S]: ...
16
16
  def nsmallest(n: int, iterable: Iterable[_S], key: Callable[[_S], SupportsRichComparison] | None = None) -> list[_S]: ...
17
- def _heapify_max(heap: list[Any], /) -> None: ... # undocumented
17
+ def _heapify_max(heap: list[Any], /) -> None:
18
+ """Maxheap variant of heapify."""
19
+ ...
@@ -32,7 +32,35 @@ class HMAC:
32
32
  def copy(self) -> HMAC: ...
33
33
 
34
34
  @overload
35
- def compare_digest(a: ReadableBuffer, b: ReadableBuffer, /) -> bool: ...
35
+ def compare_digest(a: ReadableBuffer, b: ReadableBuffer, /) -> bool:
36
+ """
37
+ Return 'a == b'.
38
+
39
+ This function uses an approach designed to prevent
40
+ timing analysis, making it appropriate for cryptography.
41
+
42
+ a and b must both be of the same type: either str (ASCII only),
43
+ or any bytes-like object.
44
+
45
+ Note: If a and b are of different lengths, or if an error occurs,
46
+ a timing attack could theoretically reveal information about the
47
+ types and lengths of a and b--but not their values.
48
+ """
49
+ ...
36
50
  @overload
37
- def compare_digest(a: AnyStr, b: AnyStr, /) -> bool: ...
51
+ def compare_digest(a: AnyStr, b: AnyStr, /) -> bool:
52
+ """
53
+ Return 'a == b'.
54
+
55
+ This function uses an approach designed to prevent
56
+ timing analysis, making it appropriate for cryptography.
57
+
58
+ a and b must both be of the same type: either str (ASCII only),
59
+ or any bytes-like object.
60
+
61
+ Note: If a and b are of different lengths, or if an error occurs,
62
+ a timing attack could theoretically reveal information about the
63
+ types and lengths of a and b--but not their values.
64
+ """
65
+ ...
38
66
  def digest(key: SizedBuffer, msg: ReadableBuffer, digest: _DigestMod) -> bytes: ...
@@ -45,7 +45,13 @@ class Morsel(dict[str, Any], Generic[_T]):
45
45
  def __eq__(self, morsel: object) -> bool: ...
46
46
  def __setitem__(self, K: str, V: Any) -> None: ...
47
47
  if sys.version_info >= (3, 9):
48
- def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
48
+ def __class_getitem__(cls, item: Any, /) -> GenericAlias:
49
+ """
50
+ Represent a PEP 585 generic type
51
+
52
+ E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
53
+ """
54
+ ...
49
55
 
50
56
  class BaseCookie(dict[str, Morsel[_T]], Generic[_T]):
51
57
  def __init__(self, input: _DataType | None = None) -> None: ...
@@ -1,62 +1,62 @@
1
- import types
2
- from _imp import (
3
- acquire_lock as acquire_lock,
4
- create_dynamic as create_dynamic,
5
- get_frozen_object as get_frozen_object,
6
- init_frozen as init_frozen,
7
- is_builtin as is_builtin,
8
- is_frozen as is_frozen,
9
- is_frozen_package as is_frozen_package,
10
- lock_held as lock_held,
11
- release_lock as release_lock,
12
- )
13
- from _typeshed import StrPath
14
- from os import PathLike
15
- from types import TracebackType
16
- from typing import IO, Any, Protocol
17
-
18
- SEARCH_ERROR: int
19
- PY_SOURCE: int
20
- PY_COMPILED: int
21
- C_EXTENSION: int
22
- PY_RESOURCE: int
23
- PKG_DIRECTORY: int
24
- C_BUILTIN: int
25
- PY_FROZEN: int
26
- PY_CODERESOURCE: int
27
- IMP_HOOK: int
28
-
29
- def new_module(name: str) -> types.ModuleType: ...
30
- def get_magic() -> bytes: ...
31
- def get_tag() -> str: ...
32
- def cache_from_source(path: StrPath, debug_override: bool | None = None) -> str: ...
33
- def source_from_cache(path: StrPath) -> str: ...
34
- def get_suffixes() -> list[tuple[str, str, int]]: ...
35
-
36
- class NullImporter:
37
- def __init__(self, path: StrPath) -> None: ...
38
- def find_module(self, fullname: Any) -> None: ...
39
-
40
- # Technically, a text file has to support a slightly different set of operations than a binary file,
41
- # but we ignore that here.
42
- class _FileLike(Protocol):
43
- closed: bool
44
- mode: str
45
- def read(self) -> str | bytes: ...
46
- def close(self) -> Any: ...
47
- def __enter__(self) -> Any: ...
48
- def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None, /) -> Any: ...
49
-
50
- # PathLike doesn't work for the pathname argument here
51
- def load_source(name: str, pathname: str, file: _FileLike | None = None) -> types.ModuleType: ...
52
- def load_compiled(name: str, pathname: str, file: _FileLike | None = None) -> types.ModuleType: ...
53
- def load_package(name: str, path: StrPath) -> types.ModuleType: ...
54
- def load_module(name: str, file: _FileLike | None, filename: str, details: tuple[str, str, int]) -> types.ModuleType: ...
55
-
56
- # IO[Any] is a TextIOWrapper if name is a .py file, and a FileIO otherwise.
57
- def find_module(
58
- name: str, path: None | list[str] | list[PathLike[str]] | list[StrPath] = None
59
- ) -> tuple[IO[Any], str, tuple[str, str, int]]: ...
60
- def reload(module: types.ModuleType) -> types.ModuleType: ...
61
- def init_builtin(name: str) -> types.ModuleType | None: ...
62
- def load_dynamic(name: str, path: str, file: Any = None) -> types.ModuleType: ... # file argument is ignored
1
+ import types
2
+ from _imp import (
3
+ acquire_lock as acquire_lock,
4
+ create_dynamic as create_dynamic,
5
+ get_frozen_object as get_frozen_object,
6
+ init_frozen as init_frozen,
7
+ is_builtin as is_builtin,
8
+ is_frozen as is_frozen,
9
+ is_frozen_package as is_frozen_package,
10
+ lock_held as lock_held,
11
+ release_lock as release_lock,
12
+ )
13
+ from _typeshed import StrPath
14
+ from os import PathLike
15
+ from types import TracebackType
16
+ from typing import IO, Any, Protocol
17
+
18
+ SEARCH_ERROR: int
19
+ PY_SOURCE: int
20
+ PY_COMPILED: int
21
+ C_EXTENSION: int
22
+ PY_RESOURCE: int
23
+ PKG_DIRECTORY: int
24
+ C_BUILTIN: int
25
+ PY_FROZEN: int
26
+ PY_CODERESOURCE: int
27
+ IMP_HOOK: int
28
+
29
+ def new_module(name: str) -> types.ModuleType: ...
30
+ def get_magic() -> bytes: ...
31
+ def get_tag() -> str: ...
32
+ def cache_from_source(path: StrPath, debug_override: bool | None = None) -> str: ...
33
+ def source_from_cache(path: StrPath) -> str: ...
34
+ def get_suffixes() -> list[tuple[str, str, int]]: ...
35
+
36
+ class NullImporter:
37
+ def __init__(self, path: StrPath) -> None: ...
38
+ def find_module(self, fullname: Any) -> None: ...
39
+
40
+ # Technically, a text file has to support a slightly different set of operations than a binary file,
41
+ # but we ignore that here.
42
+ class _FileLike(Protocol):
43
+ closed: bool
44
+ mode: str
45
+ def read(self) -> str | bytes: ...
46
+ def close(self) -> Any: ...
47
+ def __enter__(self) -> Any: ...
48
+ def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None, /) -> Any: ...
49
+
50
+ # PathLike doesn't work for the pathname argument here
51
+ def load_source(name: str, pathname: str, file: _FileLike | None = None) -> types.ModuleType: ...
52
+ def load_compiled(name: str, pathname: str, file: _FileLike | None = None) -> types.ModuleType: ...
53
+ def load_package(name: str, path: StrPath) -> types.ModuleType: ...
54
+ def load_module(name: str, file: _FileLike | None, filename: str, details: tuple[str, str, int]) -> types.ModuleType: ...
55
+
56
+ # IO[Any] is a TextIOWrapper if name is a .py file, and a FileIO otherwise.
57
+ def find_module(
58
+ name: str, path: None | list[str] | list[PathLike[str]] | list[StrPath] = None
59
+ ) -> tuple[IO[Any], str, tuple[str, str, int]]: ...
60
+ def reload(module: types.ModuleType) -> types.ModuleType: ...
61
+ def init_builtin(name: str) -> types.ModuleType | None: ...
62
+ def load_dynamic(name: str, path: str, file: Any = None) -> types.ModuleType: ... # file argument is ignored
@@ -151,7 +151,9 @@ if sys.version_info >= (3, 9):
151
151
  def open(self, mode: Literal["rb"], /) -> IO[bytes]: ...
152
152
  @property
153
153
  @abstractmethod
154
- def name(self) -> str: ...
154
+ def name(self) -> str:
155
+ """The base name of this object without any parent references."""
156
+ ...
155
157
  if sys.version_info >= (3, 10):
156
158
  def __truediv__(self, child: str, /) -> Traversable: ...
157
159
  else:
@@ -24,7 +24,9 @@ class ModuleSpec:
24
24
  loader_state: Any
25
25
  cached: str | None
26
26
  @property
27
- def parent(self) -> str | None: ...
27
+ def parent(self) -> str | None:
28
+ """The name of the module's parent."""
29
+ ...
28
30
  has_location: bool
29
31
  def __eq__(self, other: object) -> bool: ...
30
32