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,11 +1,67 @@
1
+ """
2
+ Heap queue algorithm (a.k.a. priority queue).
3
+
4
+ Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
5
+ all k, counting elements from 0. For the sake of comparison,
6
+ non-existing elements are considered to be infinite. The interesting
7
+ property of a heap is that a[0] is always its smallest element.
8
+
9
+ Usage:
10
+
11
+ heap = [] # creates an empty heap
12
+ heappush(heap, item) # pushes a new item on the heap
13
+ item = heappop(heap) # pops the smallest item from the heap
14
+ item = heap[0] # smallest item on the heap without popping it
15
+ heapify(x) # transforms list into a heap, in-place, in linear time
16
+ item = heapreplace(heap, item) # pops and returns smallest item, and adds
17
+ # new item; the heap size is unchanged
18
+
19
+ Our API differs from textbook heap algorithms as follows:
20
+
21
+ - We use 0-based indexing. This makes the relationship between the
22
+ index for a node and the indexes for its children slightly less
23
+ obvious, but is more suitable since Python uses 0-based indexing.
24
+
25
+ - Our heappop() method returns the smallest item, not the largest.
26
+
27
+ These two make it possible to view the heap as a regular Python list
28
+ without surprises: heap[0] is the smallest item, and heap.sort()
29
+ maintains the heap invariant!
30
+ """
31
+
1
32
  from typing import Any, Final, TypeVar
2
33
 
3
34
  _T = TypeVar("_T")
4
35
 
5
36
  __about__: Final[str]
6
37
 
7
- def heapify(heap: list[Any], /) -> None: ...
8
- def heappop(heap: list[_T], /) -> _T: ...
9
- def heappush(heap: list[_T], item: _T, /) -> None: ...
10
- def heappushpop(heap: list[_T], item: _T, /) -> _T: ...
11
- def heapreplace(heap: list[_T], item: _T, /) -> _T: ...
38
+ def heapify(heap: list[Any], /) -> None:
39
+ """Transform list into a heap, in-place, in O(len(heap)) time."""
40
+ ...
41
+ def heappop(heap: list[_T], /) -> _T:
42
+ """Pop the smallest item off the heap, maintaining the heap invariant."""
43
+ ...
44
+ def heappush(heap: list[_T], item: _T, /) -> None:
45
+ """Push item onto heap, maintaining the heap invariant."""
46
+ ...
47
+ def heappushpop(heap: list[_T], item: _T, /) -> _T:
48
+ """
49
+ Push item on the heap, then pop and return the smallest item from the heap.
50
+
51
+ The combined action runs more efficiently than heappush() followed by
52
+ a separate call to heappop().
53
+ """
54
+ ...
55
+ def heapreplace(heap: list[_T], item: _T, /) -> _T:
56
+ """
57
+ Pop and return the current smallest value, and add the new item.
58
+
59
+ This is more efficient than heappop() followed by heappush(), and can be
60
+ more appropriate when using a fixed-size heap. Note that the value
61
+ returned may be larger than item! That constrains reasonable uses of
62
+ this routine unless written as part of a conditional replacement:
63
+
64
+ if item > heap[0]:
65
+ item = heapreplace(heap, item)
66
+ """
67
+ ...
@@ -1,3 +1,5 @@
1
+ """(Extremely) low-level import machinery bits as used by importlib and imp."""
2
+
1
3
  import sys
2
4
  import types
3
5
  from _typeshed import ReadableBuffer
@@ -7,22 +9,75 @@ from typing import Any
7
9
  check_hash_based_pycs: str
8
10
 
9
11
  def source_hash(key: int, source: ReadableBuffer) -> bytes: ...
10
- def create_builtin(spec: ModuleSpec, /) -> types.ModuleType: ...
11
- def create_dynamic(spec: ModuleSpec, file: Any = None, /) -> types.ModuleType: ...
12
- def acquire_lock() -> None: ...
13
- def exec_builtin(mod: types.ModuleType, /) -> int: ...
14
- def exec_dynamic(mod: types.ModuleType, /) -> int: ...
15
- def extension_suffixes() -> list[str]: ...
16
- def init_frozen(name: str, /) -> types.ModuleType: ...
17
- def is_builtin(name: str, /) -> int: ...
18
- def is_frozen(name: str, /) -> bool: ...
19
- def is_frozen_package(name: str, /) -> bool: ...
20
- def lock_held() -> bool: ...
21
- def release_lock() -> None: ...
12
+ def create_builtin(spec: ModuleSpec, /) -> types.ModuleType:
13
+ """Create an extension module."""
14
+ ...
15
+ def create_dynamic(spec: ModuleSpec, file: Any = None, /) -> types.ModuleType:
16
+ """Create an extension module."""
17
+ ...
18
+ def acquire_lock() -> None:
19
+ """
20
+ Acquires the interpreter's import lock for the current thread.
21
+
22
+ This lock should be used by import hooks to ensure thread-safety when importing
23
+ modules. On platforms without threads, this function does nothing.
24
+ """
25
+ ...
26
+ def exec_builtin(mod: types.ModuleType, /) -> int:
27
+ """Initialize a built-in module."""
28
+ ...
29
+ def exec_dynamic(mod: types.ModuleType, /) -> int:
30
+ """Initialize an extension module."""
31
+ ...
32
+ def extension_suffixes() -> list[str]:
33
+ """Returns the list of file suffixes used to identify extension modules."""
34
+ ...
35
+ def init_frozen(name: str, /) -> types.ModuleType:
36
+ """Initializes a frozen module."""
37
+ ...
38
+ def is_builtin(name: str, /) -> int:
39
+ """Returns True if the module name corresponds to a built-in module."""
40
+ ...
41
+ def is_frozen(name: str, /) -> bool:
42
+ """Returns True if the module name corresponds to a frozen module."""
43
+ ...
44
+ def is_frozen_package(name: str, /) -> bool:
45
+ """Returns True if the module name is of a frozen package."""
46
+ ...
47
+ def lock_held() -> bool:
48
+ """
49
+ Return True if the import lock is currently held, else False.
50
+
51
+ On platforms without threads, return False.
52
+ """
53
+ ...
54
+ def release_lock() -> None:
55
+ """
56
+ Release the interpreter's import lock.
57
+
58
+ On platforms without threads, this function does nothing.
59
+ """
60
+ ...
22
61
 
23
62
  if sys.version_info >= (3, 11):
24
- def find_frozen(name: str, /, *, withdata: bool = False) -> tuple[memoryview | None, bool, str | None] | None: ...
25
- def get_frozen_object(name: str, data: ReadableBuffer | None = None, /) -> types.CodeType: ...
63
+ def find_frozen(name: str, /, *, withdata: bool = False) -> tuple[memoryview | None, bool, str | None] | None:
64
+ """
65
+ Return info about the corresponding frozen module (if there is one) or None.
66
+
67
+ The returned info (a 2-tuple):
68
+
69
+ * data the raw marshalled bytes
70
+ * is_package whether or not it is a package
71
+ * origname the originally frozen module's name, or None if not
72
+ a stdlib module (this will usually be the same as
73
+ the module's current name)
74
+ """
75
+ ...
76
+ def get_frozen_object(name: str, data: ReadableBuffer | None = None, /) -> types.CodeType:
77
+ """Create a code object for a frozen module."""
78
+ ...
26
79
 
27
80
  else:
28
- def get_frozen_object(name: str, /) -> types.CodeType: ...
81
+ def get_frozen_object(name: str, /) -> types.CodeType:
82
+ """Create a code object for a frozen module."""
83
+ ...
@@ -1,24 +1,43 @@
1
+ """json speedups"""
2
+
1
3
  from collections.abc import Callable
2
4
  from typing import Any, final
3
5
 
4
6
  @final
5
7
  class make_encoder:
8
+ """_iterencode(obj, _current_indent_level) -> iterable"""
6
9
  @property
7
- def sort_keys(self) -> bool: ...
10
+ def sort_keys(self) -> bool:
11
+ """sort_keys"""
12
+ ...
8
13
  @property
9
- def skipkeys(self) -> bool: ...
14
+ def skipkeys(self) -> bool:
15
+ """skipkeys"""
16
+ ...
10
17
  @property
11
- def key_separator(self) -> str: ...
18
+ def key_separator(self) -> str:
19
+ """key_separator"""
20
+ ...
12
21
  @property
13
- def indent(self) -> int | None: ...
22
+ def indent(self) -> int | None:
23
+ """indent"""
24
+ ...
14
25
  @property
15
- def markers(self) -> dict[int, Any] | None: ...
26
+ def markers(self) -> dict[int, Any] | None:
27
+ """markers"""
28
+ ...
16
29
  @property
17
- def default(self) -> Callable[[Any], Any]: ...
30
+ def default(self) -> Callable[[Any], Any]:
31
+ """default"""
32
+ ...
18
33
  @property
19
- def encoder(self) -> Callable[[str], str]: ...
34
+ def encoder(self) -> Callable[[str], str]:
35
+ """encoder"""
36
+ ...
20
37
  @property
21
- def item_separator(self) -> str: ...
38
+ def item_separator(self) -> str:
39
+ """item_separator"""
40
+ ...
22
41
  def __init__(
23
42
  self,
24
43
  markers: dict[int, Any] | None,
@@ -31,10 +50,13 @@ class make_encoder:
31
50
  skipkeys: bool,
32
51
  allow_nan: bool,
33
52
  ) -> None: ...
34
- def __call__(self, obj: object, _current_indent_level: int) -> Any: ...
53
+ def __call__(self, obj: object, _current_indent_level: int) -> Any:
54
+ """Call self as a function."""
55
+ ...
35
56
 
36
57
  @final
37
58
  class make_scanner:
59
+ """JSON scanner object"""
38
60
  object_hook: Any
39
61
  object_pairs_hook: Any
40
62
  parse_int: Any
@@ -43,7 +65,28 @@ class make_scanner:
43
65
  strict: bool
44
66
  # TODO: 'context' needs the attrs above (ducktype), but not __call__.
45
67
  def __init__(self, context: make_scanner) -> None: ...
46
- def __call__(self, string: str, index: int) -> tuple[Any, int]: ...
68
+ def __call__(self, string: str, index: int) -> tuple[Any, int]:
69
+ """Call self as a function."""
70
+ ...
71
+
72
+ def encode_basestring_ascii(s: str, /) -> str:
73
+ """
74
+ encode_basestring_ascii(string) -> string
75
+
76
+ Return an ASCII-only JSON representation of a Python string
77
+ """
78
+ ...
79
+ def scanstring(string: str, end: int, strict: bool = ...) -> tuple[str, int]:
80
+ """
81
+ scanstring(string, end, strict=True) -> (string, end)
82
+
83
+ Scan the string s for a JSON string. End is the index of the
84
+ character in s after the quote that started the JSON string.
85
+ Unescapes all valid JSON string escape sequences and raises ValueError
86
+ on attempt to decode an invalid string. If strict is False then literal
87
+ control characters are allowed in the string.
47
88
 
48
- def encode_basestring_ascii(s: str, /) -> str: ...
49
- def scanstring(string: str, end: int, strict: bool = ...) -> tuple[str, int]: ...
89
+ Returns a tuple of the decoded string and the index of the character in s
90
+ after the end quote.
91
+ """
92
+ ...
@@ -1,3 +1,5 @@
1
+ """Support for POSIX locales."""
2
+
1
3
  import sys
2
4
  from _typeshed import StrPath
3
5
  from collections.abc import Mapping
@@ -10,14 +12,28 @@ LC_NUMERIC: int
10
12
  LC_ALL: int
11
13
  CHAR_MAX: int
12
14
 
13
- def setlocale(category: int, locale: str | None = None, /) -> str: ...
14
- def localeconv() -> Mapping[str, int | str | list[int]]: ...
15
+ def setlocale(category: int, locale: str | None = None, /) -> str:
16
+ """(integer,string=None) -> string. Activates/queries locale processing."""
17
+ ...
18
+ def localeconv() -> Mapping[str, int | str | list[int]]:
19
+ """() -> dict. Returns numeric and monetary locale-specific parameters."""
20
+ ...
15
21
 
16
22
  if sys.version_info >= (3, 11):
17
- def getencoding() -> str: ...
23
+ def getencoding() -> str:
24
+ """Get the current locale encoding."""
25
+ ...
26
+
27
+ def strcoll(os1: str, os2: str, /) -> int:
28
+ """string,string -> int. Compares two strings according to the locale."""
29
+ ...
30
+ def strxfrm(string: str, /) -> str:
31
+ """
32
+ strxfrm(string) -> string.
18
33
 
19
- def strcoll(os1: str, os2: str, /) -> int: ...
20
- def strxfrm(string: str, /) -> str: ...
34
+ Return a string that can be used as a key for locale-aware comparisons.
35
+ """
36
+ ...
21
37
 
22
38
  # native gettext functions
23
39
  # https://docs.python.org/3/library/locale.html#access-to-message-catalogs
@@ -87,14 +103,49 @@ if sys.platform != "win32":
87
103
  CRNCYSTR: int
88
104
  ALT_DIGITS: int
89
105
 
90
- def nl_langinfo(key: int, /) -> str: ...
106
+ def nl_langinfo(key: int, /) -> str:
107
+ """
108
+ nl_langinfo(key) -> string
109
+ Return the value for the locale information associated with key.
110
+ """
111
+ ...
91
112
 
92
113
  # This is dependent on `libintl.h` which is a part of `gettext`
93
114
  # system dependency. These functions might be missing.
94
115
  # But, we always say that they are present.
95
- def gettext(msg: str, /) -> str: ...
96
- def dgettext(domain: str | None, msg: str, /) -> str: ...
97
- def dcgettext(domain: str | None, msg: str, category: int, /) -> str: ...
98
- def textdomain(domain: str | None, /) -> str: ...
99
- def bindtextdomain(domain: str, dir: StrPath | None, /) -> str: ...
100
- def bind_textdomain_codeset(domain: str, codeset: str | None, /) -> str | None: ...
116
+ def gettext(msg: str, /) -> str:
117
+ """
118
+ gettext(msg) -> string
119
+ Return translation of msg.
120
+ """
121
+ ...
122
+ def dgettext(domain: str | None, msg: str, /) -> str:
123
+ """
124
+ dgettext(domain, msg) -> string
125
+ Return translation of msg in domain.
126
+ """
127
+ ...
128
+ def dcgettext(domain: str | None, msg: str, category: int, /) -> str:
129
+ """
130
+ dcgettext(domain, msg, category) -> string
131
+ Return translation of msg in domain and category.
132
+ """
133
+ ...
134
+ def textdomain(domain: str | None, /) -> str:
135
+ """
136
+ textdomain(domain) -> string
137
+ Set the C library's textdmain to domain, returning the new domain.
138
+ """
139
+ ...
140
+ def bindtextdomain(domain: str, dir: StrPath | None, /) -> str:
141
+ """
142
+ bindtextdomain(domain, dir) -> string
143
+ Bind the C library's domain to dir.
144
+ """
145
+ ...
146
+ def bind_textdomain_codeset(domain: str, codeset: str | None, /) -> str | None:
147
+ """
148
+ bind_textdomain_codeset(domain, codeset) -> string
149
+ Bind the C library's domain to codeset.
150
+ """
151
+ ...
@@ -1,3 +1,5 @@
1
+ """Fast profiler"""
2
+
1
3
  import sys
2
4
  from _typeshed import structseq
3
5
  from collections.abc import Callable
@@ -5,13 +7,68 @@ from types import CodeType
5
7
  from typing import Any, Final, final
6
8
 
7
9
  class Profiler:
10
+ """
11
+ Profiler(timer=None, timeunit=None, subcalls=True, builtins=True)
12
+
13
+ Builds a profiler object using the specified timer function.
14
+ The default timer is a fast built-in one based on real time.
15
+ For custom timer functions returning integers, timeunit can
16
+ be a float specifying a scale (i.e. how long each integer unit
17
+ is, in seconds).
18
+ """
8
19
  def __init__(
9
20
  self, timer: Callable[[], float] | None = None, timeunit: float = 0.0, subcalls: bool = True, builtins: bool = True
10
21
  ) -> None: ...
11
- def getstats(self) -> list[profiler_entry]: ...
12
- def enable(self, subcalls: bool = True, builtins: bool = True) -> None: ...
13
- def disable(self) -> None: ...
14
- def clear(self) -> None: ...
22
+ def getstats(self) -> list[profiler_entry]:
23
+ """
24
+ getstats() -> list of profiler_entry objects
25
+
26
+ Return all information collected by the profiler.
27
+ Each profiler_entry is a tuple-like object with the
28
+ following attributes:
29
+
30
+ code code object
31
+ callcount how many times this was called
32
+ reccallcount how many times called recursively
33
+ totaltime total time in this entry
34
+ inlinetime inline time in this entry (not in subcalls)
35
+ calls details of the calls
36
+
37
+ The calls attribute is either None or a list of
38
+ profiler_subentry objects:
39
+
40
+ code called code object
41
+ callcount how many times this is called
42
+ reccallcount how many times this is called recursively
43
+ totaltime total time spent in this call
44
+ inlinetime inline time (not in further subcalls)
45
+ """
46
+ ...
47
+ def enable(self, subcalls: bool = True, builtins: bool = True) -> None:
48
+ """
49
+ enable(subcalls=True, builtins=True)
50
+
51
+ Start collecting profiling information.
52
+ If 'subcalls' is True, also records for each function
53
+ statistics separated according to its current caller.
54
+ If 'builtins' is True, records the time spent in
55
+ built-in functions separately from their caller.
56
+ """
57
+ ...
58
+ def disable(self) -> None:
59
+ """
60
+ disable()
61
+
62
+ Stop collecting profiling information.
63
+ """
64
+ ...
65
+ def clear(self) -> None:
66
+ """
67
+ clear()
68
+
69
+ Clear all profiling information collected so far.
70
+ """
71
+ ...
15
72
 
16
73
  @final
17
74
  class profiler_entry(structseq[Any], tuple[CodeType | str, int, int, float, float, list[profiler_subentry]]):