basedpyright 1.12.6 → 1.13.0

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 (60) 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/stdlib/_ast.pyi +279 -42
  6. package/dist/typeshed-fallback/stdlib/_bisect.pyi +149 -12
  7. package/dist/typeshed-fallback/stdlib/_codecs.pyi +125 -14
  8. package/dist/typeshed-fallback/stdlib/_csv.pyi +130 -7
  9. package/dist/typeshed-fallback/stdlib/_ctypes.pyi +72 -17
  10. package/dist/typeshed-fallback/stdlib/_curses.pyi +626 -78
  11. package/dist/typeshed-fallback/stdlib/_decimal.pyi +775 -153
  12. package/dist/typeshed-fallback/stdlib/_heapq.pyi +61 -5
  13. package/dist/typeshed-fallback/stdlib/_imp.pyi +70 -15
  14. package/dist/typeshed-fallback/stdlib/_json.pyi +55 -12
  15. package/dist/typeshed-fallback/stdlib/_locale.pyi +63 -12
  16. package/dist/typeshed-fallback/stdlib/_lsprof.pyi +61 -4
  17. package/dist/typeshed-fallback/stdlib/_operator.pyi +238 -62
  18. package/dist/typeshed-fallback/stdlib/_posixsubprocess.pyi +25 -1
  19. package/dist/typeshed-fallback/stdlib/_random.pyi +23 -5
  20. package/dist/typeshed-fallback/stdlib/_socket.pyi +618 -63
  21. package/dist/typeshed-fallback/stdlib/_stat.pyi +140 -13
  22. package/dist/typeshed-fallback/stdlib/_thread.pyi +215 -22
  23. package/dist/typeshed-fallback/stdlib/_tkinter.pyi +44 -11
  24. package/dist/typeshed-fallback/stdlib/_tracemalloc.pyi +71 -10
  25. package/dist/typeshed-fallback/stdlib/_warnings.pyi +53 -6
  26. package/dist/typeshed-fallback/stdlib/_weakref.pyi +43 -10
  27. package/dist/typeshed-fallback/stdlib/_winapi.pyi +255 -255
  28. package/dist/typeshed-fallback/stdlib/array.pyi +233 -44
  29. package/dist/typeshed-fallback/stdlib/atexit.pyi +50 -5
  30. package/dist/typeshed-fallback/stdlib/audioop.pyi +78 -26
  31. package/dist/typeshed-fallback/stdlib/binascii.pyi +105 -18
  32. package/dist/typeshed-fallback/stdlib/builtins.pyi +5254 -829
  33. package/dist/typeshed-fallback/stdlib/cmath.pyi +99 -23
  34. package/dist/typeshed-fallback/stdlib/errno.pyi +15 -0
  35. package/dist/typeshed-fallback/stdlib/faulthandler.pyi +33 -8
  36. package/dist/typeshed-fallback/stdlib/fcntl.pyi +199 -8
  37. package/dist/typeshed-fallback/stdlib/gc.pyi +130 -18
  38. package/dist/typeshed-fallback/stdlib/grp.pyi +58 -7
  39. package/dist/typeshed-fallback/stdlib/itertools.pyi +281 -42
  40. package/dist/typeshed-fallback/stdlib/marshal.pyi +82 -4
  41. package/dist/typeshed-fallback/stdlib/math.pyi +357 -61
  42. package/dist/typeshed-fallback/stdlib/mmap.pyi +47 -8
  43. package/dist/typeshed-fallback/stdlib/msvcrt.pyi +32 -32
  44. package/dist/typeshed-fallback/stdlib/nt.pyi +118 -111
  45. package/dist/typeshed-fallback/stdlib/parser.pyi +55 -24
  46. package/dist/typeshed-fallback/stdlib/posix.pyi +7 -0
  47. package/dist/typeshed-fallback/stdlib/pwd.pyi +60 -10
  48. package/dist/typeshed-fallback/stdlib/pyexpat/__init__.pyi +61 -12
  49. package/dist/typeshed-fallback/stdlib/readline.pyi +184 -27
  50. package/dist/typeshed-fallback/stdlib/resource.pyi +56 -16
  51. package/dist/typeshed-fallback/stdlib/select.pyi +97 -5
  52. package/dist/typeshed-fallback/stdlib/spwd.pyi +60 -11
  53. package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +386 -48
  54. package/dist/typeshed-fallback/stdlib/syslog.pyi +27 -7
  55. package/dist/typeshed-fallback/stdlib/termios.pyi +88 -8
  56. package/dist/typeshed-fallback/stdlib/time.pyi +314 -37
  57. package/dist/typeshed-fallback/stdlib/unicodedata.pyi +264 -34
  58. package/dist/typeshed-fallback/stdlib/winreg.pyi +172 -132
  59. package/dist/typeshed-fallback/stdlib/zlib.pyi +108 -7
  60. package/package.json +1 -1
@@ -1,3 +1,13 @@
1
+ """
2
+ This module provides access to the Unicode Character Database which
3
+ defines character properties for all Unicode characters. The data in
4
+ this database is based on the UnicodeData.txt file version
5
+ 12.1.0 which is publicly available from ftp://ftp.unicode.org/.
6
+
7
+ The module uses the same names and symbols as defined by the
8
+ UnicodeData File Format 12.1.0.
9
+ """
10
+
1
11
  import sys
2
12
  from _typeshed import ReadOnlyBuffer
3
13
  from typing import Any, Literal, TypeVar, final, overload
@@ -13,61 +23,281 @@ _T = TypeVar("_T")
13
23
 
14
24
  _NormalizationForm: TypeAlias = Literal["NFC", "NFD", "NFKC", "NFKD"]
15
25
 
16
- def bidirectional(chr: str, /) -> str: ...
17
- def category(chr: str, /) -> str: ...
18
- def combining(chr: str, /) -> int: ...
26
+ def bidirectional(chr: str, /) -> str:
27
+ """
28
+ Returns the bidirectional class assigned to the character chr as string.
29
+
30
+ If no such value is defined, an empty string is returned.
31
+ """
32
+ ...
33
+ def category(chr: str, /) -> str:
34
+ """Returns the general category assigned to the character chr as string."""
35
+ ...
36
+ def combining(chr: str, /) -> int:
37
+ """
38
+ Returns the canonical combining class assigned to the character chr as integer.
39
+
40
+ Returns 0 if no combining class is defined.
41
+ """
42
+ ...
19
43
  @overload
20
- def decimal(chr: str, /) -> int: ...
44
+ def decimal(chr: str, /) -> int:
45
+ """
46
+ Converts a Unicode character into its equivalent decimal value.
47
+
48
+ Returns the decimal value assigned to the character chr as integer.
49
+ If no such value is defined, default is returned, or, if not given,
50
+ ValueError is raised.
51
+ """
52
+ ...
21
53
  @overload
22
- def decimal(chr: str, default: _T, /) -> int | _T: ...
23
- def decomposition(chr: str, /) -> str: ...
54
+ def decimal(chr: str, default: _T, /) -> int | _T:
55
+ """
56
+ Converts a Unicode character into its equivalent decimal value.
57
+
58
+ Returns the decimal value assigned to the character chr as integer.
59
+ If no such value is defined, default is returned, or, if not given,
60
+ ValueError is raised.
61
+ """
62
+ ...
63
+ def decomposition(chr: str, /) -> str:
64
+ """
65
+ Returns the character decomposition mapping assigned to the character chr as string.
66
+
67
+ An empty string is returned in case no such mapping is defined.
68
+ """
69
+ ...
24
70
  @overload
25
- def digit(chr: str, /) -> int: ...
71
+ def digit(chr: str, /) -> int:
72
+ """
73
+ Converts a Unicode character into its equivalent digit value.
74
+
75
+ Returns the digit value assigned to the character chr as integer.
76
+ If no such value is defined, default is returned, or, if not given,
77
+ ValueError is raised.
78
+ """
79
+ ...
26
80
  @overload
27
- def digit(chr: str, default: _T, /) -> int | _T: ...
81
+ def digit(chr: str, default: _T, /) -> int | _T:
82
+ """
83
+ Converts a Unicode character into its equivalent digit value.
84
+
85
+ Returns the digit value assigned to the character chr as integer.
86
+ If no such value is defined, default is returned, or, if not given,
87
+ ValueError is raised.
88
+ """
89
+ ...
28
90
 
29
91
  _EastAsianWidth: TypeAlias = Literal["F", "H", "W", "Na", "A", "N"]
30
92
 
31
- def east_asian_width(chr: str, /) -> _EastAsianWidth: ...
32
- def is_normalized(form: _NormalizationForm, unistr: str, /) -> bool: ...
33
- def lookup(name: str | ReadOnlyBuffer, /) -> str: ...
34
- def mirrored(chr: str, /) -> int: ...
93
+ def east_asian_width(chr: str, /) -> _EastAsianWidth:
94
+ """Returns the east asian width assigned to the character chr as string."""
95
+ ...
96
+ def is_normalized(form: _NormalizationForm, unistr: str, /) -> bool:
97
+ """
98
+ Return whether the Unicode string unistr is in the normal form 'form'.
99
+
100
+ Valid values for form are 'NFC', 'NFKC', 'NFD', and 'NFKD'.
101
+ """
102
+ ...
103
+ def lookup(name: str | ReadOnlyBuffer, /) -> str:
104
+ """
105
+ Look up character by name.
106
+
107
+ If a character with the given name is found, return the
108
+ corresponding character. If not found, KeyError is raised.
109
+ """
110
+ ...
111
+ def mirrored(chr: str, /) -> int:
112
+ """
113
+ Returns the mirrored property assigned to the character chr as integer.
114
+
115
+ Returns 1 if the character has been identified as a "mirrored"
116
+ character in bidirectional text, 0 otherwise.
117
+ """
118
+ ...
35
119
  @overload
36
- def name(chr: str, /) -> str: ...
120
+ def name(chr: str, /) -> str:
121
+ """
122
+ Returns the name assigned to the character chr as a string.
123
+
124
+ If no name is defined, default is returned, or, if not given,
125
+ ValueError is raised.
126
+ """
127
+ ...
37
128
  @overload
38
- def name(chr: str, default: _T, /) -> str | _T: ...
39
- def normalize(form: _NormalizationForm, unistr: str, /) -> str: ...
129
+ def name(chr: str, default: _T, /) -> str | _T:
130
+ """
131
+ Returns the name assigned to the character chr as a string.
132
+
133
+ If no name is defined, default is returned, or, if not given,
134
+ ValueError is raised.
135
+ """
136
+ ...
137
+ def normalize(form: _NormalizationForm, unistr: str, /) -> str:
138
+ """
139
+ Return the normal form 'form' for the Unicode string unistr.
140
+
141
+ Valid values for form are 'NFC', 'NFKC', 'NFD', and 'NFKD'.
142
+ """
143
+ ...
40
144
  @overload
41
- def numeric(chr: str, /) -> float: ...
145
+ def numeric(chr: str, /) -> float:
146
+ """
147
+ Converts a Unicode character into its equivalent numeric value.
148
+
149
+ Returns the numeric value assigned to the character chr as float.
150
+ If no such value is defined, default is returned, or, if not given,
151
+ ValueError is raised.
152
+ """
153
+ ...
42
154
  @overload
43
- def numeric(chr: str, default: _T, /) -> float | _T: ...
155
+ def numeric(chr: str, default: _T, /) -> float | _T:
156
+ """
157
+ Converts a Unicode character into its equivalent numeric value.
158
+
159
+ Returns the numeric value assigned to the character chr as float.
160
+ If no such value is defined, default is returned, or, if not given,
161
+ ValueError is raised.
162
+ """
163
+ ...
44
164
  @final
45
165
  class UCD:
46
166
  # The methods below are constructed from the same array in C
47
167
  # (unicodedata_functions) and hence identical to the functions above.
48
168
  unidata_version: str
49
- def bidirectional(self, chr: str, /) -> str: ...
50
- def category(self, chr: str, /) -> str: ...
51
- def combining(self, chr: str, /) -> int: ...
169
+ def bidirectional(self, chr: str, /) -> str:
170
+ """
171
+ Returns the bidirectional class assigned to the character chr as string.
172
+
173
+ If no such value is defined, an empty string is returned.
174
+ """
175
+ ...
176
+ def category(self, chr: str, /) -> str:
177
+ """Returns the general category assigned to the character chr as string."""
178
+ ...
179
+ def combining(self, chr: str, /) -> int:
180
+ """
181
+ Returns the canonical combining class assigned to the character chr as integer.
182
+
183
+ Returns 0 if no combining class is defined.
184
+ """
185
+ ...
52
186
  @overload
53
- def decimal(self, chr: str, /) -> int: ...
187
+ def decimal(self, chr: str, /) -> int:
188
+ """
189
+ Converts a Unicode character into its equivalent decimal value.
190
+
191
+ Returns the decimal value assigned to the character chr as integer.
192
+ If no such value is defined, default is returned, or, if not given,
193
+ ValueError is raised.
194
+ """
195
+ ...
54
196
  @overload
55
- def decimal(self, chr: str, default: _T, /) -> int | _T: ...
56
- def decomposition(self, chr: str, /) -> str: ...
197
+ def decimal(self, chr: str, default: _T, /) -> int | _T:
198
+ """
199
+ Converts a Unicode character into its equivalent decimal value.
200
+
201
+ Returns the decimal value assigned to the character chr as integer.
202
+ If no such value is defined, default is returned, or, if not given,
203
+ ValueError is raised.
204
+ """
205
+ ...
206
+ def decomposition(self, chr: str, /) -> str:
207
+ """
208
+ Returns the character decomposition mapping assigned to the character chr as string.
209
+
210
+ An empty string is returned in case no such mapping is defined.
211
+ """
212
+ ...
57
213
  @overload
58
- def digit(self, chr: str, /) -> int: ...
214
+ def digit(self, chr: str, /) -> int:
215
+ """
216
+ Converts a Unicode character into its equivalent digit value.
217
+
218
+ Returns the digit value assigned to the character chr as integer.
219
+ If no such value is defined, default is returned, or, if not given,
220
+ ValueError is raised.
221
+ """
222
+ ...
59
223
  @overload
60
- def digit(self, chr: str, default: _T, /) -> int | _T: ...
61
- def east_asian_width(self, chr: str, /) -> _EastAsianWidth: ...
62
- def is_normalized(self, form: _NormalizationForm, unistr: str, /) -> bool: ...
63
- def lookup(self, name: str | ReadOnlyBuffer, /) -> str: ...
64
- def mirrored(self, chr: str, /) -> int: ...
224
+ def digit(self, chr: str, default: _T, /) -> int | _T:
225
+ """
226
+ Converts a Unicode character into its equivalent digit value.
227
+
228
+ Returns the digit value assigned to the character chr as integer.
229
+ If no such value is defined, default is returned, or, if not given,
230
+ ValueError is raised.
231
+ """
232
+ ...
233
+ def east_asian_width(self, chr: str, /) -> _EastAsianWidth:
234
+ """Returns the east asian width assigned to the character chr as string."""
235
+ ...
236
+ def is_normalized(self, form: _NormalizationForm, unistr: str, /) -> bool:
237
+ """
238
+ Return whether the Unicode string unistr is in the normal form 'form'.
239
+
240
+ Valid values for form are 'NFC', 'NFKC', 'NFD', and 'NFKD'.
241
+ """
242
+ ...
243
+ def lookup(self, name: str | ReadOnlyBuffer, /) -> str:
244
+ """
245
+ Look up character by name.
246
+
247
+ If a character with the given name is found, return the
248
+ corresponding character. If not found, KeyError is raised.
249
+ """
250
+ ...
251
+ def mirrored(self, chr: str, /) -> int:
252
+ """
253
+ Returns the mirrored property assigned to the character chr as integer.
254
+
255
+ Returns 1 if the character has been identified as a "mirrored"
256
+ character in bidirectional text, 0 otherwise.
257
+ """
258
+ ...
65
259
  @overload
66
- def name(self, chr: str, /) -> str: ...
260
+ def name(self, chr: str, /) -> str:
261
+ """
262
+ Returns the name assigned to the character chr as a string.
263
+
264
+ If no name is defined, default is returned, or, if not given,
265
+ ValueError is raised.
266
+ """
267
+ ...
67
268
  @overload
68
- def name(self, chr: str, default: _T, /) -> str | _T: ...
69
- def normalize(self, form: _NormalizationForm, unistr: str, /) -> str: ...
269
+ def name(self, chr: str, default: _T, /) -> str | _T:
270
+ """
271
+ Returns the name assigned to the character chr as a string.
272
+
273
+ If no name is defined, default is returned, or, if not given,
274
+ ValueError is raised.
275
+ """
276
+ ...
277
+ def normalize(self, form: _NormalizationForm, unistr: str, /) -> str:
278
+ """
279
+ Return the normal form 'form' for the Unicode string unistr.
280
+
281
+ Valid values for form are 'NFC', 'NFKC', 'NFD', and 'NFKD'.
282
+ """
283
+ ...
70
284
  @overload
71
- def numeric(self, chr: str, /) -> float: ...
285
+ def numeric(self, chr: str, /) -> float:
286
+ """
287
+ Converts a Unicode character into its equivalent numeric value.
288
+
289
+ Returns the numeric value assigned to the character chr as float.
290
+ If no such value is defined, default is returned, or, if not given,
291
+ ValueError is raised.
292
+ """
293
+ ...
72
294
  @overload
73
- def numeric(self, chr: str, default: _T, /) -> float | _T: ...
295
+ def numeric(self, chr: str, default: _T, /) -> float | _T:
296
+ """
297
+ Converts a Unicode character into its equivalent numeric value.
298
+
299
+ Returns the numeric value assigned to the character chr as float.
300
+ If no such value is defined, default is returned, or, if not given,
301
+ ValueError is raised.
302
+ """
303
+ ...
@@ -1,132 +1,172 @@
1
- import sys
2
- from _typeshed import ReadableBuffer, Unused
3
- from types import TracebackType
4
- from typing import Any, Final, Literal, final, overload
5
- from typing_extensions import Self, TypeAlias
6
-
7
- if sys.platform == "win32":
8
- _KeyType: TypeAlias = HKEYType | int
9
- def CloseKey(hkey: _KeyType, /) -> None: ...
10
- def ConnectRegistry(computer_name: str | None, key: _KeyType, /) -> HKEYType: ...
11
- def CreateKey(key: _KeyType, sub_key: str | None, /) -> HKEYType: ...
12
- def CreateKeyEx(key: _KeyType, sub_key: str | None, reserved: int = 0, access: int = 131078) -> HKEYType: ...
13
- def DeleteKey(key: _KeyType, sub_key: str, /) -> None: ...
14
- def DeleteKeyEx(key: _KeyType, sub_key: str, access: int = 256, reserved: int = 0) -> None: ...
15
- def DeleteValue(key: _KeyType, value: str, /) -> None: ...
16
- def EnumKey(key: _KeyType, index: int, /) -> str: ...
17
- def EnumValue(key: _KeyType, index: int, /) -> tuple[str, Any, int]: ...
18
- def ExpandEnvironmentStrings(string: str, /) -> str: ...
19
- def FlushKey(key: _KeyType, /) -> None: ...
20
- def LoadKey(key: _KeyType, sub_key: str, file_name: str, /) -> None: ...
21
- def OpenKey(key: _KeyType, sub_key: str, reserved: int = 0, access: int = 131097) -> HKEYType: ...
22
- def OpenKeyEx(key: _KeyType, sub_key: str, reserved: int = 0, access: int = 131097) -> HKEYType: ...
23
- def QueryInfoKey(key: _KeyType, /) -> tuple[int, int, int]: ...
24
- def QueryValue(key: _KeyType, sub_key: str | None, /) -> str: ...
25
- def QueryValueEx(key: _KeyType, name: str, /) -> tuple[Any, int]: ...
26
- def SaveKey(key: _KeyType, file_name: str, /) -> None: ...
27
- def SetValue(key: _KeyType, sub_key: str, type: int, value: str, /) -> None: ...
28
- @overload # type=REG_DWORD|REG_QWORD
29
- def SetValueEx(
30
- key: _KeyType, value_name: str | None, reserved: Unused, type: Literal[4, 5], value: int | None, /
31
- ) -> None: ...
32
- @overload # type=REG_SZ|REG_EXPAND_SZ
33
- def SetValueEx(
34
- key: _KeyType, value_name: str | None, reserved: Unused, type: Literal[1, 2], value: str | None, /
35
- ) -> None: ...
36
- @overload # type=REG_MULTI_SZ
37
- def SetValueEx(
38
- key: _KeyType, value_name: str | None, reserved: Unused, type: Literal[7], value: list[str] | None, /
39
- ) -> None: ...
40
- @overload # type=REG_BINARY and everything else
41
- def SetValueEx(
42
- key: _KeyType,
43
- value_name: str | None,
44
- reserved: Unused,
45
- type: Literal[0, 3, 8, 9, 10, 11],
46
- value: ReadableBuffer | None,
47
- /,
48
- ) -> None: ...
49
- @overload # Unknown or undocumented
50
- def SetValueEx(
51
- key: _KeyType,
52
- value_name: str | None,
53
- reserved: Unused,
54
- type: int,
55
- value: int | str | list[str] | ReadableBuffer | None,
56
- /,
57
- ) -> None: ...
58
- def DisableReflectionKey(key: _KeyType, /) -> None: ...
59
- def EnableReflectionKey(key: _KeyType, /) -> None: ...
60
- def QueryReflectionKey(key: _KeyType, /) -> bool: ...
61
-
62
- HKEY_CLASSES_ROOT: int
63
- HKEY_CURRENT_USER: int
64
- HKEY_LOCAL_MACHINE: int
65
- HKEY_USERS: int
66
- HKEY_PERFORMANCE_DATA: int
67
- HKEY_CURRENT_CONFIG: int
68
- HKEY_DYN_DATA: int
69
-
70
- KEY_ALL_ACCESS: Final = 983103
71
- KEY_WRITE: Final = 131078
72
- KEY_READ: Final = 131097
73
- KEY_EXECUTE: Final = 131097
74
- KEY_QUERY_VALUE: Final = 1
75
- KEY_SET_VALUE: Final = 2
76
- KEY_CREATE_SUB_KEY: Final = 4
77
- KEY_ENUMERATE_SUB_KEYS: Final = 8
78
- KEY_NOTIFY: Final = 16
79
- KEY_CREATE_LINK: Final = 32
80
-
81
- KEY_WOW64_64KEY: Final = 256
82
- KEY_WOW64_32KEY: Final = 512
83
-
84
- REG_BINARY: Final = 3
85
- REG_DWORD: Final = 4
86
- REG_DWORD_LITTLE_ENDIAN: Final = 4
87
- REG_DWORD_BIG_ENDIAN: Final = 5
88
- REG_EXPAND_SZ: Final = 2
89
- REG_LINK: Final = 6
90
- REG_MULTI_SZ: Final = 7
91
- REG_NONE: Final = 0
92
- REG_QWORD: Final = 11
93
- REG_QWORD_LITTLE_ENDIAN: Final = 11
94
- REG_RESOURCE_LIST: Final = 8
95
- REG_FULL_RESOURCE_DESCRIPTOR: Final = 9
96
- REG_RESOURCE_REQUIREMENTS_LIST: Final = 10
97
- REG_SZ: Final = 1
98
-
99
- REG_CREATED_NEW_KEY: Final = 1 # undocumented
100
- REG_LEGAL_CHANGE_FILTER: Final = 268435471 # undocumented
101
- REG_LEGAL_OPTION: Final = 31 # undocumented
102
- REG_NOTIFY_CHANGE_ATTRIBUTES: Final = 2 # undocumented
103
- REG_NOTIFY_CHANGE_LAST_SET: Final = 4 # undocumented
104
- REG_NOTIFY_CHANGE_NAME: Final = 1 # undocumented
105
- REG_NOTIFY_CHANGE_SECURITY: Final = 8 # undocumented
106
- REG_NO_LAZY_FLUSH: Final = 4 # undocumented
107
- REG_OPENED_EXISTING_KEY: Final = 2 # undocumented
108
- REG_OPTION_BACKUP_RESTORE: Final = 4 # undocumented
109
- REG_OPTION_CREATE_LINK: Final = 2 # undocumented
110
- REG_OPTION_NON_VOLATILE: Final = 0 # undocumented
111
- REG_OPTION_OPEN_LINK: Final = 8 # undocumented
112
- REG_OPTION_RESERVED: Final = 0 # undocumented
113
- REG_OPTION_VOLATILE: Final = 1 # undocumented
114
- REG_REFRESH_HIVE: Final = 2 # undocumented
115
- REG_WHOLE_HIVE_VOLATILE: Final = 1 # undocumented
116
-
117
- error = OSError
118
-
119
- # Though this class has a __name__ of PyHKEY, it's exposed as HKEYType for some reason
120
- @final
121
- class HKEYType:
122
- def __bool__(self) -> bool: ...
123
- def __int__(self) -> int: ...
124
- def __enter__(self) -> Self: ...
125
- def __exit__(
126
- self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
127
- ) -> bool | None: ...
128
- def Close(self) -> None: ...
129
- def Detach(self) -> int: ...
130
- def __hash__(self) -> int: ...
131
- @property
132
- def handle(self) -> int: ...
1
+ """
2
+ This module provides access to the Windows registry API.
3
+
4
+ Functions:
5
+
6
+ CloseKey() - Closes a registry key.
7
+ ConnectRegistry() - Establishes a connection to a predefined registry handle
8
+ on another computer.
9
+ CreateKey() - Creates the specified key, or opens it if it already exists.
10
+ DeleteKey() - Deletes the specified key.
11
+ DeleteValue() - Removes a named value from the specified registry key.
12
+ EnumKey() - Enumerates subkeys of the specified open registry key.
13
+ EnumValue() - Enumerates values of the specified open registry key.
14
+ ExpandEnvironmentStrings() - Expand the env strings in a REG_EXPAND_SZ
15
+ string.
16
+ FlushKey() - Writes all the attributes of the specified key to the registry.
17
+ LoadKey() - Creates a subkey under HKEY_USER or HKEY_LOCAL_MACHINE and
18
+ stores registration information from a specified file into that
19
+ subkey.
20
+ OpenKey() - Opens the specified key.
21
+ OpenKeyEx() - Alias of OpenKey().
22
+ QueryValue() - Retrieves the value associated with the unnamed value for a
23
+ specified key in the registry.
24
+ QueryValueEx() - Retrieves the type and data for a specified value name
25
+ associated with an open registry key.
26
+ QueryInfoKey() - Returns information about the specified key.
27
+ SaveKey() - Saves the specified key, and all its subkeys a file.
28
+ SetValue() - Associates a value with a specified key.
29
+ SetValueEx() - Stores data in the value field of an open registry key.
30
+
31
+ Special objects:
32
+
33
+ HKEYType -- type object for HKEY objects
34
+ error -- exception raised for Win32 errors
35
+
36
+ Integer constants:
37
+ Many constants are defined - see the documentation for each function
38
+ to see what constants are used, and where.
39
+ """
40
+
41
+ import sys
42
+ from _typeshed import ReadableBuffer, Unused
43
+ from types import TracebackType
44
+ from typing import Any, Final, Literal, final, overload
45
+ from typing_extensions import Self, TypeAlias
46
+
47
+ if sys.platform == "win32":
48
+ _KeyType: TypeAlias = HKEYType | int
49
+ def CloseKey(hkey: _KeyType, /) -> None: ...
50
+ def ConnectRegistry(computer_name: str | None, key: _KeyType, /) -> HKEYType: ...
51
+ def CreateKey(key: _KeyType, sub_key: str | None, /) -> HKEYType: ...
52
+ def CreateKeyEx(key: _KeyType, sub_key: str | None, reserved: int = 0, access: int = 131078) -> HKEYType: ...
53
+ def DeleteKey(key: _KeyType, sub_key: str, /) -> None: ...
54
+ def DeleteKeyEx(key: _KeyType, sub_key: str, access: int = 256, reserved: int = 0) -> None: ...
55
+ def DeleteValue(key: _KeyType, value: str, /) -> None: ...
56
+ def EnumKey(key: _KeyType, index: int, /) -> str: ...
57
+ def EnumValue(key: _KeyType, index: int, /) -> tuple[str, Any, int]: ...
58
+ def ExpandEnvironmentStrings(string: str, /) -> str: ...
59
+ def FlushKey(key: _KeyType, /) -> None: ...
60
+ def LoadKey(key: _KeyType, sub_key: str, file_name: str, /) -> None: ...
61
+ def OpenKey(key: _KeyType, sub_key: str, reserved: int = 0, access: int = 131097) -> HKEYType: ...
62
+ def OpenKeyEx(key: _KeyType, sub_key: str, reserved: int = 0, access: int = 131097) -> HKEYType: ...
63
+ def QueryInfoKey(key: _KeyType, /) -> tuple[int, int, int]: ...
64
+ def QueryValue(key: _KeyType, sub_key: str | None, /) -> str: ...
65
+ def QueryValueEx(key: _KeyType, name: str, /) -> tuple[Any, int]: ...
66
+ def SaveKey(key: _KeyType, file_name: str, /) -> None: ...
67
+ def SetValue(key: _KeyType, sub_key: str, type: int, value: str, /) -> None: ...
68
+ @overload # type=REG_DWORD|REG_QWORD
69
+ def SetValueEx(
70
+ key: _KeyType, value_name: str | None, reserved: Unused, type: Literal[4, 5], value: int | None, /
71
+ ) -> None: ...
72
+ @overload # type=REG_SZ|REG_EXPAND_SZ
73
+ def SetValueEx(
74
+ key: _KeyType, value_name: str | None, reserved: Unused, type: Literal[1, 2], value: str | None, /
75
+ ) -> None: ...
76
+ @overload # type=REG_MULTI_SZ
77
+ def SetValueEx(
78
+ key: _KeyType, value_name: str | None, reserved: Unused, type: Literal[7], value: list[str] | None, /
79
+ ) -> None: ...
80
+ @overload # type=REG_BINARY and everything else
81
+ def SetValueEx(
82
+ key: _KeyType,
83
+ value_name: str | None,
84
+ reserved: Unused,
85
+ type: Literal[0, 3, 8, 9, 10, 11],
86
+ value: ReadableBuffer | None,
87
+ /,
88
+ ) -> None: ...
89
+ @overload # Unknown or undocumented
90
+ def SetValueEx(
91
+ key: _KeyType,
92
+ value_name: str | None,
93
+ reserved: Unused,
94
+ type: int,
95
+ value: int | str | list[str] | ReadableBuffer | None,
96
+ /,
97
+ ) -> None: ...
98
+ def DisableReflectionKey(key: _KeyType, /) -> None: ...
99
+ def EnableReflectionKey(key: _KeyType, /) -> None: ...
100
+ def QueryReflectionKey(key: _KeyType, /) -> bool: ...
101
+
102
+ HKEY_CLASSES_ROOT: int
103
+ HKEY_CURRENT_USER: int
104
+ HKEY_LOCAL_MACHINE: int
105
+ HKEY_USERS: int
106
+ HKEY_PERFORMANCE_DATA: int
107
+ HKEY_CURRENT_CONFIG: int
108
+ HKEY_DYN_DATA: int
109
+
110
+ KEY_ALL_ACCESS: Final = 983103
111
+ KEY_WRITE: Final = 131078
112
+ KEY_READ: Final = 131097
113
+ KEY_EXECUTE: Final = 131097
114
+ KEY_QUERY_VALUE: Final = 1
115
+ KEY_SET_VALUE: Final = 2
116
+ KEY_CREATE_SUB_KEY: Final = 4
117
+ KEY_ENUMERATE_SUB_KEYS: Final = 8
118
+ KEY_NOTIFY: Final = 16
119
+ KEY_CREATE_LINK: Final = 32
120
+
121
+ KEY_WOW64_64KEY: Final = 256
122
+ KEY_WOW64_32KEY: Final = 512
123
+
124
+ REG_BINARY: Final = 3
125
+ REG_DWORD: Final = 4
126
+ REG_DWORD_LITTLE_ENDIAN: Final = 4
127
+ REG_DWORD_BIG_ENDIAN: Final = 5
128
+ REG_EXPAND_SZ: Final = 2
129
+ REG_LINK: Final = 6
130
+ REG_MULTI_SZ: Final = 7
131
+ REG_NONE: Final = 0
132
+ REG_QWORD: Final = 11
133
+ REG_QWORD_LITTLE_ENDIAN: Final = 11
134
+ REG_RESOURCE_LIST: Final = 8
135
+ REG_FULL_RESOURCE_DESCRIPTOR: Final = 9
136
+ REG_RESOURCE_REQUIREMENTS_LIST: Final = 10
137
+ REG_SZ: Final = 1
138
+
139
+ REG_CREATED_NEW_KEY: Final = 1 # undocumented
140
+ REG_LEGAL_CHANGE_FILTER: Final = 268435471 # undocumented
141
+ REG_LEGAL_OPTION: Final = 31 # undocumented
142
+ REG_NOTIFY_CHANGE_ATTRIBUTES: Final = 2 # undocumented
143
+ REG_NOTIFY_CHANGE_LAST_SET: Final = 4 # undocumented
144
+ REG_NOTIFY_CHANGE_NAME: Final = 1 # undocumented
145
+ REG_NOTIFY_CHANGE_SECURITY: Final = 8 # undocumented
146
+ REG_NO_LAZY_FLUSH: Final = 4 # undocumented
147
+ REG_OPENED_EXISTING_KEY: Final = 2 # undocumented
148
+ REG_OPTION_BACKUP_RESTORE: Final = 4 # undocumented
149
+ REG_OPTION_CREATE_LINK: Final = 2 # undocumented
150
+ REG_OPTION_NON_VOLATILE: Final = 0 # undocumented
151
+ REG_OPTION_OPEN_LINK: Final = 8 # undocumented
152
+ REG_OPTION_RESERVED: Final = 0 # undocumented
153
+ REG_OPTION_VOLATILE: Final = 1 # undocumented
154
+ REG_REFRESH_HIVE: Final = 2 # undocumented
155
+ REG_WHOLE_HIVE_VOLATILE: Final = 1 # undocumented
156
+
157
+ error = OSError
158
+
159
+ # Though this class has a __name__ of PyHKEY, it's exposed as HKEYType for some reason
160
+ @final
161
+ class HKEYType:
162
+ def __bool__(self) -> bool: ...
163
+ def __int__(self) -> int: ...
164
+ def __enter__(self) -> Self: ...
165
+ def __exit__(
166
+ self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
167
+ ) -> bool | None: ...
168
+ def Close(self) -> None: ...
169
+ def Detach(self) -> int: ...
170
+ def __hash__(self) -> int: ...
171
+ @property
172
+ def handle(self) -> int: ...