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,74 @@
1
+ """
2
+ This module provides access to some objects used or maintained by the
3
+ interpreter and to functions that interact strongly with the interpreter.
4
+
5
+ Dynamic objects:
6
+
7
+ argv -- command line arguments; argv[0] is the script pathname if known
8
+ path -- module search path; path[0] is the script directory, else ''
9
+ modules -- dictionary of loaded modules
10
+
11
+ displayhook -- called to show results in an interactive session
12
+ excepthook -- called to handle any uncaught exception other than SystemExit
13
+ To customize printing in an interactive session or to install a custom
14
+ top-level exception handler, assign other functions to replace these.
15
+
16
+ stdin -- standard input file object; used by input()
17
+ stdout -- standard output file object; used by print()
18
+ stderr -- standard error object; used for error messages
19
+ By assigning other file objects (or objects that behave like files)
20
+ to these, it is possible to redirect all of the interpreter's I/O.
21
+
22
+ last_type -- type of last uncaught exception
23
+ last_value -- value of last uncaught exception
24
+ last_traceback -- traceback of last uncaught exception
25
+ These three are only available in an interactive session after a
26
+ traceback has been printed.
27
+
28
+ Static objects:
29
+
30
+ builtin_module_names -- tuple of module names built into this interpreter
31
+ copyright -- copyright notice pertaining to this interpreter
32
+ exec_prefix -- prefix used to find the machine-specific Python library
33
+ executable -- absolute path of the executable binary of the Python interpreter
34
+ float_info -- a named tuple with information about the float implementation.
35
+ float_repr_style -- string indicating the style of repr() output for floats
36
+ hash_info -- a named tuple with information about the hash algorithm.
37
+ hexversion -- version information encoded as a single integer
38
+ implementation -- Python implementation information.
39
+ int_info -- a named tuple with information about the int implementation.
40
+ maxsize -- the largest supported length of containers.
41
+ maxunicode -- the value of the largest Unicode code point
42
+ platform -- platform identifier
43
+ prefix -- prefix used to find the Python library
44
+ thread_info -- a named tuple with information about the thread implementation.
45
+ version -- the version of this interpreter as a string
46
+ version_info -- version information as a named tuple
47
+ __stdin__ -- the original stdin; don't touch!
48
+ __stdout__ -- the original stdout; don't touch!
49
+ __stderr__ -- the original stderr; don't touch!
50
+ __displayhook__ -- the original displayhook; don't touch!
51
+ __excepthook__ -- the original excepthook; don't touch!
52
+
53
+ Functions:
54
+
55
+ displayhook() -- print an object to the screen, and save it in builtins._
56
+ excepthook() -- print an exception and its traceback to sys.stderr
57
+ exc_info() -- return thread-safe information about the current exception
58
+ exit() -- exit the interpreter by raising SystemExit
59
+ getdlopenflags() -- returns flags to be used for dlopen() calls
60
+ getprofile() -- get the global profiling function
61
+ getrefcount() -- return the reference count for an object (plus one :-)
62
+ getrecursionlimit() -- return the max recursion depth for the interpreter
63
+ getsizeof() -- return the size of an object in bytes
64
+ gettrace() -- get the global debug tracing function
65
+ setcheckinterval() -- control how often the interpreter checks for events
66
+ setdlopenflags() -- set the flags to be used for dlopen() calls
67
+ setprofile() -- set the global profiling function
68
+ setrecursionlimit() -- set the max recursion depth for the interpreter
69
+ settrace() -- set the global debug tracing function
70
+ """
71
+
1
72
  import sys
2
73
  from _typeshed import MaybeNone, OptExcInfo, ProfileFunction, TraceFunction, structseq
3
74
  from _typeshed.importlib import MetaPathFinderProtocol, PathEntryFinderProtocol
@@ -239,35 +310,162 @@ class _version_info(_UninstantiableStructseq, tuple[int, int, int, _ReleaseLevel
239
310
 
240
311
  version_info: _version_info
241
312
 
242
- def call_tracing(func: Callable[..., _T], args: Any, /) -> _T: ...
243
- def _clear_type_cache() -> None: ...
244
- def _current_frames() -> dict[int, FrameType]: ...
245
- def _getframe(depth: int = 0, /) -> FrameType: ...
246
- def _debugmallocstats() -> None: ...
247
- def __displayhook__(object: object, /) -> None: ...
248
- def __excepthook__(exctype: type[BaseException], value: BaseException, traceback: TracebackType | None, /) -> None: ...
249
- def exc_info() -> OptExcInfo: ...
313
+ def call_tracing(func: Callable[..., _T], args: Any, /) -> _T:
314
+ """
315
+ Call func(*args), while tracing is enabled.
316
+
317
+ The tracing state is saved, and restored afterwards. This is intended
318
+ to be called from a debugger from a checkpoint, to recursively debug
319
+ some other code.
320
+ """
321
+ ...
322
+ def _clear_type_cache() -> None:
323
+ """Clear the internal type lookup cache."""
324
+ ...
325
+ def _current_frames() -> dict[int, FrameType]:
326
+ """
327
+ Return a dict mapping each thread's thread id to its current stack frame.
328
+
329
+ This function should be used for specialized purposes only.
330
+ """
331
+ ...
332
+ def _getframe(depth: int = 0, /) -> FrameType:
333
+ """
334
+ Return a frame object from the call stack.
335
+
336
+ If optional integer depth is given, return the frame object that many
337
+ calls below the top of the stack. If that is deeper than the call
338
+ stack, ValueError is raised. The default for depth is zero, returning
339
+ the frame at the top of the call stack.
340
+
341
+ This function should be used for internal and specialized purposes
342
+ only.
343
+ """
344
+ ...
345
+ def _debugmallocstats() -> None:
346
+ """
347
+ Print summary info to stderr about the state of pymalloc's structures.
348
+
349
+ In Py_DEBUG mode, also perform some expensive internal consistency
350
+ checks.
351
+ """
352
+ ...
353
+ def __displayhook__(object: object, /) -> None:
354
+ """Print an object to sys.stdout and also save it in builtins._"""
355
+ ...
356
+ def __excepthook__(exctype: type[BaseException], value: BaseException, traceback: TracebackType | None, /) -> None:
357
+ """Handle an exception by displaying it with a traceback on sys.stderr."""
358
+ ...
359
+ def exc_info() -> OptExcInfo:
360
+ """
361
+ Return current exception information: (type, value, traceback).
362
+
363
+ Return information about the most recent exception caught by an except
364
+ clause in the current stack frame or in an older stack frame.
365
+ """
366
+ ...
250
367
 
251
368
  if sys.version_info >= (3, 11):
252
- def exception() -> BaseException | None: ...
253
-
254
- def exit(status: _ExitCode = None, /) -> NoReturn: ...
255
- def getallocatedblocks() -> int: ...
256
- def getdefaultencoding() -> str: ...
369
+ def exception() -> BaseException | None:
370
+ """
371
+ Return the current exception.
372
+
373
+ Return the most recent exception caught by an except clause
374
+ in the current stack frame or in an older stack frame, or None
375
+ if no such exception exists.
376
+ """
377
+ ...
378
+
379
+ def exit(status: _ExitCode = None, /) -> NoReturn:
380
+ """
381
+ Exit the interpreter by raising SystemExit(status).
382
+
383
+ If the status is omitted or None, it defaults to zero (i.e., success).
384
+ If the status is an integer, it will be used as the system exit status.
385
+ If it is another kind of object, it will be printed and the system
386
+ exit status will be one (i.e., failure).
387
+ """
388
+ ...
389
+ def getallocatedblocks() -> int:
390
+ """Return the number of memory blocks currently allocated."""
391
+ ...
392
+ def getdefaultencoding() -> str:
393
+ """Return the current default encoding used by the Unicode implementation."""
394
+ ...
257
395
 
258
396
  if sys.platform != "win32":
259
- def getdlopenflags() -> int: ...
260
-
261
- def getfilesystemencoding() -> str: ...
262
- def getfilesystemencodeerrors() -> str: ...
263
- def getrefcount(object: Any, /) -> int: ...
264
- def getrecursionlimit() -> int: ...
265
- def getsizeof(obj: object, default: int = ...) -> int: ...
266
- def getswitchinterval() -> float: ...
267
- def getprofile() -> ProfileFunction | None: ...
268
- def setprofile(function: ProfileFunction | None, /) -> None: ...
269
- def gettrace() -> TraceFunction | None: ...
270
- def settrace(function: TraceFunction | None, /) -> None: ...
397
+ def getdlopenflags() -> int:
398
+ """
399
+ Return the current value of the flags that are used for dlopen calls.
400
+
401
+ The flag constants are defined in the os module.
402
+ """
403
+ ...
404
+
405
+ def getfilesystemencoding() -> str:
406
+ """Return the encoding used to convert Unicode filenames to OS filenames."""
407
+ ...
408
+ def getfilesystemencodeerrors() -> str:
409
+ """Return the error mode used Unicode to OS filename conversion."""
410
+ ...
411
+ def getrefcount(object: Any, /) -> int:
412
+ """
413
+ Return the reference count of object.
414
+
415
+ The count returned is generally one higher than you might expect,
416
+ because it includes the (temporary) reference as an argument to
417
+ getrefcount().
418
+ """
419
+ ...
420
+ def getrecursionlimit() -> int:
421
+ """
422
+ Return the current value of the recursion limit.
423
+
424
+ The recursion limit is the maximum depth of the Python interpreter
425
+ stack. This limit prevents infinite recursion from causing an overflow
426
+ of the C stack and crashing Python.
427
+ """
428
+ ...
429
+ def getsizeof(obj: object, default: int = ...) -> int:
430
+ """
431
+ getsizeof(object [, default]) -> int
432
+
433
+ Return the size of object in bytes.
434
+ """
435
+ ...
436
+ def getswitchinterval() -> float:
437
+ """Return the current thread switch interval; see sys.setswitchinterval()."""
438
+ ...
439
+ def getprofile() -> ProfileFunction | None:
440
+ """
441
+ Return the profiling function set with sys.setprofile.
442
+
443
+ See the profiler chapter in the library manual.
444
+ """
445
+ ...
446
+ def setprofile(function: ProfileFunction | None, /) -> None:
447
+ """
448
+ setprofile(function)
449
+
450
+ Set the profiling function. It will be called on each function call
451
+ and return. See the profiler chapter in the library manual.
452
+ """
453
+ ...
454
+ def gettrace() -> TraceFunction | None:
455
+ """
456
+ Return the global debug tracing function set with sys.settrace.
457
+
458
+ See the debugger chapter in the library manual.
459
+ """
460
+ ...
461
+ def settrace(function: TraceFunction | None, /) -> None:
462
+ """
463
+ settrace(function)
464
+
465
+ Set the global debug tracing function. It will be called on each
466
+ function call. See the debugger chapter in the library manual.
467
+ """
468
+ ...
271
469
 
272
470
  if sys.platform == "win32":
273
471
  # A tuple of length 5, even though it has more than 5 attributes.
@@ -296,26 +494,107 @@ if sys.platform == "win32":
296
494
 
297
495
  def getwindowsversion() -> _WinVersion: ...
298
496
 
299
- def intern(string: str, /) -> str: ...
300
- def is_finalizing() -> bool: ...
301
- def breakpointhook(*args: Any, **kwargs: Any) -> Any: ...
497
+ def intern(string: str, /) -> str:
498
+ """
499
+ ``Intern'' the given string.
500
+
501
+ This enters the string in the (global) table of interned strings whose
502
+ purpose is to speed up dictionary lookups. Return the string itself or
503
+ the previously interned string object with the same value.
504
+ """
505
+ ...
506
+ def is_finalizing() -> bool:
507
+ """Return True if Python is exiting."""
508
+ ...
509
+ def breakpointhook(*args: Any, **kwargs: Any) -> Any:
510
+ """
511
+ breakpointhook(*args, **kws)
512
+
513
+ This hook function is called by built-in breakpoint().
514
+ """
515
+ ...
302
516
 
303
517
  __breakpointhook__ = breakpointhook # Contains the original value of breakpointhook
304
518
 
305
519
  if sys.platform != "win32":
306
- def setdlopenflags(flags: int, /) -> None: ...
307
-
308
- def setrecursionlimit(limit: int, /) -> None: ...
309
- def setswitchinterval(interval: float, /) -> None: ...
520
+ def setdlopenflags(flags: int, /) -> None:
521
+ """
522
+ Set the flags used by the interpreter for dlopen calls.
523
+
524
+ This is used, for example, when the interpreter loads extension
525
+ modules. Among other things, this will enable a lazy resolving of
526
+ symbols when importing a module, if called as sys.setdlopenflags(0).
527
+ To share symbols across extension modules, call as
528
+ sys.setdlopenflags(os.RTLD_GLOBAL). Symbolic names for the flag
529
+ modules can be found in the os module (RTLD_xxx constants, e.g.
530
+ os.RTLD_LAZY).
531
+ """
532
+ ...
533
+
534
+ def setrecursionlimit(limit: int, /) -> None:
535
+ """
536
+ Set the maximum depth of the Python interpreter stack to n.
537
+
538
+ This limit prevents infinite recursion from causing an overflow of the C
539
+ stack and crashing Python. The highest possible limit is platform-
540
+ dependent.
541
+ """
542
+ ...
543
+ def setswitchinterval(interval: float, /) -> None:
544
+ """
545
+ Set the ideal thread switching delay inside the Python interpreter.
546
+
547
+ The actual frequency of switching threads can be lower if the
548
+ interpreter executes long sequences of uninterruptible code
549
+ (this is implementation-specific and workload-dependent).
550
+
551
+ The parameter must represent the desired switching delay in seconds
552
+ A typical value is 0.005 (5 milliseconds).
553
+ """
554
+ ...
310
555
  def gettotalrefcount() -> int: ... # Debug builds only
311
556
 
312
557
  if sys.version_info < (3, 9):
313
- def getcheckinterval() -> int: ... # deprecated
314
- def setcheckinterval(n: int, /) -> None: ... # deprecated
558
+ def getcheckinterval() -> int:
559
+ """Return the current check interval; see sys.setcheckinterval()."""
560
+ ...
561
+ def setcheckinterval(n: int, /) -> None:
562
+ """
563
+ Set the async event check interval to n instructions.
564
+
565
+ This tells the Python interpreter to check for asynchronous events
566
+ every n instructions.
567
+
568
+ This also affects how often thread switches occur.
569
+ """
570
+ ...
315
571
 
316
572
  if sys.version_info < (3, 9):
317
573
  # An 11-tuple or None
318
- def callstats() -> tuple[int, int, int, int, int, int, int, int, int, int, int] | None: ...
574
+ def callstats() -> tuple[int, int, int, int, int, int, int, int, int, int, int] | None:
575
+ """
576
+ Return a tuple of function call statistics.
577
+
578
+ A tuple is returned only if CALL_PROFILE was defined when Python was
579
+ built. Otherwise, this returns None.
580
+
581
+ When enabled, this function returns detailed, implementation-specific
582
+ details about the number of function calls executed. The return value
583
+ is a 11-tuple where the entries in the tuple are counts of:
584
+ 0. all function calls
585
+ 1. calls to PyFunction_Type objects
586
+ 2. PyFunction calls that do not create an argument tuple
587
+ 3. PyFunction calls that do not create an argument tuple
588
+ and bypass PyEval_EvalCodeEx()
589
+ 4. PyMethod calls
590
+ 5. PyMethod calls on bound methods
591
+ 6. PyType calls
592
+ 7. PyCFunction calls
593
+ 8. generator calls
594
+ 9. All other calls
595
+ 10. Number of stack pops performed by call_function()
596
+ """
597
+ ...
319
598
 
320
599
  # Doesn't exist at runtime, but exported in the stubs so pytest etc. can annotate their code more easily.
321
600
  class UnraisableHookArgs(Protocol):
@@ -327,9 +606,29 @@ class UnraisableHookArgs(Protocol):
327
606
 
328
607
  unraisablehook: Callable[[UnraisableHookArgs], Any]
329
608
 
330
- def __unraisablehook__(unraisable: UnraisableHookArgs, /) -> Any: ...
331
- def addaudithook(hook: Callable[[str, tuple[Any, ...]], Any]) -> None: ...
332
- def audit(event: str, /, *args: Any) -> None: ...
609
+ def __unraisablehook__(unraisable: UnraisableHookArgs, /) -> Any:
610
+ """
611
+ Handle an unraisable exception.
612
+
613
+ The unraisable argument has the following attributes:
614
+
615
+ * exc_type: Exception type.
616
+ * exc_value: Exception value, can be None.
617
+ * exc_traceback: Exception traceback, can be None.
618
+ * err_msg: Error message, can be None.
619
+ * object: Object causing the exception, can be None.
620
+ """
621
+ ...
622
+ def addaudithook(hook: Callable[[str, tuple[Any, ...]], Any]) -> None:
623
+ """Adds a new audit hook callback."""
624
+ ...
625
+ def audit(event: str, /, *args: Any) -> None:
626
+ """
627
+ audit(event, *args)
628
+
629
+ Passes the event to any audit hooks that are attached.
630
+ """
631
+ ...
333
632
 
334
633
  _AsyncgenHook: TypeAlias = Callable[[AsyncGenerator[Any, Any]], None] | None
335
634
 
@@ -340,29 +639,68 @@ class _asyncgen_hooks(structseq[_AsyncgenHook], tuple[_AsyncgenHook, _AsyncgenHo
340
639
  @property
341
640
  def finalizer(self) -> _AsyncgenHook: ...
342
641
 
343
- def get_asyncgen_hooks() -> _asyncgen_hooks: ...
344
- def set_asyncgen_hooks(firstiter: _AsyncgenHook = ..., finalizer: _AsyncgenHook = ...) -> None: ...
642
+ def get_asyncgen_hooks() -> _asyncgen_hooks:
643
+ """
644
+ Return the installed asynchronous generators hooks.
645
+
646
+ This returns a namedtuple of the form (firstiter, finalizer).
647
+ """
648
+ ...
649
+ def set_asyncgen_hooks(firstiter: _AsyncgenHook = ..., finalizer: _AsyncgenHook = ...) -> None:
650
+ """
651
+ set_asyncgen_hooks(* [, firstiter] [, finalizer])
652
+
653
+ Set a finalizer for async generators objects.
654
+ """
655
+ ...
345
656
 
346
657
  if sys.platform == "win32":
347
658
  def _enablelegacywindowsfsencoding() -> None: ...
348
659
 
349
- def get_coroutine_origin_tracking_depth() -> int: ...
350
- def set_coroutine_origin_tracking_depth(depth: int) -> None: ...
660
+ def get_coroutine_origin_tracking_depth() -> int:
661
+ """Check status of origin tracking for coroutine objects in this thread."""
662
+ ...
663
+ def set_coroutine_origin_tracking_depth(depth: int) -> None:
664
+ """
665
+ Enable or disable origin tracking for coroutine objects in this thread.
666
+
667
+ Coroutine objects will track 'depth' frames of traceback information
668
+ about where they came from, available in their cr_origin attribute.
669
+
670
+ Set a depth of 0 to disable.
671
+ """
672
+ ...
351
673
 
352
674
  # The following two functions were added in 3.11.0, 3.10.7, 3.9.14, and 3.8.14,
353
675
  # as part of the response to CVE-2020-10735
354
- def set_int_max_str_digits(maxdigits: int) -> None: ...
355
- def get_int_max_str_digits() -> int: ...
676
+ def set_int_max_str_digits(maxdigits: int) -> None:
677
+ """Set the maximum string digits limit for non-binary int<->str conversions."""
678
+ ...
679
+ def get_int_max_str_digits() -> int:
680
+ """Return the maximum string digits limit for non-binary int<->str conversions."""
681
+ ...
356
682
 
357
683
  if sys.version_info >= (3, 12):
358
- def getunicodeinternedsize() -> int: ...
359
- def deactivate_stack_trampoline() -> None: ...
360
- def is_stack_trampoline_active() -> bool: ...
684
+ def getunicodeinternedsize() -> int:
685
+ """Return the number of elements of the unicode interned dictionary"""
686
+ ...
687
+ def deactivate_stack_trampoline() -> None:
688
+ """
689
+ Deactivate the current stack profiler trampoline backend.
690
+
691
+ If no stack profiler is activated, this function has no effect.
692
+ """
693
+ ...
694
+ def is_stack_trampoline_active() -> bool:
695
+ """Return *True* if a stack profiler trampoline is active."""
696
+ ...
361
697
  # It always exists, but raises on non-linux platforms:
362
698
  if sys.platform == "linux":
363
699
  def activate_stack_trampoline(backend: str, /) -> None: ...
364
700
  else:
365
- def activate_stack_trampoline(backend: str, /) -> NoReturn: ...
701
+ def activate_stack_trampoline(backend: str, /) -> NoReturn:
702
+ """Activate stack profiler trampoline *backend*."""
703
+ ...
366
704
 
367
705
  from . import _monitoring
368
706
 
@@ -44,12 +44,32 @@ if sys.platform != "win32":
44
44
  LOG_RAS: Literal[120]
45
45
  LOG_REMOTEAUTH: Literal[104]
46
46
 
47
- def LOG_MASK(pri: int, /) -> int: ...
48
- def LOG_UPTO(pri: int, /) -> int: ...
49
- def closelog() -> None: ...
50
- def openlog(ident: str = ..., logoption: int = ..., facility: int = ...) -> None: ...
51
- def setlogmask(maskpri: int, /) -> int: ...
47
+ def LOG_MASK(pri: int, /) -> int:
48
+ """Calculates the mask for the individual priority pri."""
49
+ ...
50
+ def LOG_UPTO(pri: int, /) -> int:
51
+ """Calculates the mask for all priorities up to and including pri."""
52
+ ...
53
+ def closelog() -> None:
54
+ """Reset the syslog module values and call the system library closelog()."""
55
+ ...
56
+ def openlog(ident: str = ..., logoption: int = ..., facility: int = ...) -> None:
57
+ """Set logging options of subsequent syslog() calls."""
58
+ ...
59
+ def setlogmask(maskpri: int, /) -> int:
60
+ """Set the priority mask to maskpri and return the previous mask value."""
61
+ ...
52
62
  @overload
53
- def syslog(priority: int, message: str) -> None: ...
63
+ def syslog(priority: int, message: str) -> None:
64
+ """
65
+ syslog([priority=LOG_INFO,] message)
66
+ Send the string message to the system logger.
67
+ """
68
+ ...
54
69
  @overload
55
- def syslog(message: str) -> None: ...
70
+ def syslog(message: str) -> None:
71
+ """
72
+ syslog([priority=LOG_INFO,] message)
73
+ Send the string message to the system logger.
74
+ """
75
+ ...
@@ -1,3 +1,14 @@
1
+ """
2
+ This module provides an interface to the Posix calls for tty I/O control.
3
+ For a complete description of these calls, see the Posix or Unix manual
4
+ pages. It is only available for those Unix versions that support Posix
5
+ termios style tty I/O control.
6
+
7
+ All functions in this module take a file descriptor fd as their first
8
+ argument. This can be an integer file descriptor, such as returned by
9
+ sys.stdin.fileno(), or a file object, such as sys.stdin itself.
10
+ """
11
+
1
12
  import sys
2
13
  from _typeshed import FileDescriptorLike
3
14
  from typing import Any
@@ -254,14 +265,83 @@ if sys.platform != "win32":
254
265
  XCASE: int
255
266
  XTABS: int
256
267
 
257
- def tcgetattr(fd: FileDescriptorLike, /) -> _AttrReturn: ...
258
- def tcsetattr(fd: FileDescriptorLike, when: int, attributes: _Attr, /) -> None: ...
259
- def tcsendbreak(fd: FileDescriptorLike, duration: int, /) -> None: ...
260
- def tcdrain(fd: FileDescriptorLike, /) -> None: ...
261
- def tcflush(fd: FileDescriptorLike, queue: int, /) -> None: ...
262
- def tcflow(fd: FileDescriptorLike, action: int, /) -> None: ...
268
+ def tcgetattr(fd: FileDescriptorLike, /) -> _AttrReturn:
269
+ """
270
+ tcgetattr(fd) -> list_of_attrs
271
+
272
+ Get the tty attributes for file descriptor fd, as follows:
273
+ [iflag, oflag, cflag, lflag, ispeed, ospeed, cc] where cc is a list
274
+ of the tty special characters (each a string of length 1, except the items
275
+ with indices VMIN and VTIME, which are integers when these fields are
276
+ defined). The interpretation of the flags and the speeds as well as the
277
+ indexing in the cc array must be done using the symbolic constants defined
278
+ in this module.
279
+ """
280
+ ...
281
+ def tcsetattr(fd: FileDescriptorLike, when: int, attributes: _Attr, /) -> None:
282
+ """
283
+ tcsetattr(fd, when, attributes) -> None
284
+
285
+ Set the tty attributes for file descriptor fd.
286
+ The attributes to be set are taken from the attributes argument, which
287
+ is a list like the one returned by tcgetattr(). The when argument
288
+ determines when the attributes are changed: termios.TCSANOW to
289
+ change immediately, termios.TCSADRAIN to change after transmitting all
290
+ queued output, or termios.TCSAFLUSH to change after transmitting all
291
+ queued output and discarding all queued input.
292
+ """
293
+ ...
294
+ def tcsendbreak(fd: FileDescriptorLike, duration: int, /) -> None:
295
+ """
296
+ tcsendbreak(fd, duration) -> None
297
+
298
+ Send a break on file descriptor fd.
299
+ A zero duration sends a break for 0.25-0.5 seconds; a nonzero duration
300
+ has a system dependent meaning.
301
+ """
302
+ ...
303
+ def tcdrain(fd: FileDescriptorLike, /) -> None:
304
+ """
305
+ tcdrain(fd) -> None
306
+
307
+ Wait until all output written to file descriptor fd has been transmitted.
308
+ """
309
+ ...
310
+ def tcflush(fd: FileDescriptorLike, queue: int, /) -> None:
311
+ """
312
+ tcflush(fd, queue) -> None
313
+
314
+ Discard queued data on file descriptor fd.
315
+ The queue selector specifies which queue: termios.TCIFLUSH for the input
316
+ queue, termios.TCOFLUSH for the output queue, or termios.TCIOFLUSH for
317
+ both queues.
318
+ """
319
+ ...
320
+ def tcflow(fd: FileDescriptorLike, action: int, /) -> None:
321
+ """
322
+ tcflow(fd, action) -> None
323
+
324
+ Suspend or resume input or output on file descriptor fd.
325
+ The action argument can be termios.TCOOFF to suspend output,
326
+ termios.TCOON to restart output, termios.TCIOFF to suspend input,
327
+ or termios.TCION to restart input.
328
+ """
329
+ ...
263
330
  if sys.version_info >= (3, 11):
264
- def tcgetwinsize(fd: FileDescriptorLike, /) -> tuple[int, int]: ...
265
- def tcsetwinsize(fd: FileDescriptorLike, winsize: tuple[int, int], /) -> None: ...
331
+ def tcgetwinsize(fd: FileDescriptorLike, /) -> tuple[int, int]:
332
+ """
333
+ Get the tty winsize for file descriptor fd.
334
+
335
+ Returns a tuple (ws_row, ws_col).
336
+ """
337
+ ...
338
+ def tcsetwinsize(fd: FileDescriptorLike, winsize: tuple[int, int], /) -> None:
339
+ """
340
+ Set the tty winsize for file descriptor fd.
341
+
342
+ The winsize to be set is taken from the winsize argument, which
343
+ is a two-item tuple (ws_row, ws_col) like the one returned by tcgetwinsize().
344
+ """
345
+ ...
266
346
 
267
347
  class error(Exception): ...