basedpyright 1.31.6 → 1.31.7-8064362195d32e67ab0ff5fd0052429de44e1f90

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 (65) hide show
  1. package/README.md +1 -1
  2. package/dist/pyright-langserver.js +1 -1
  3. package/dist/pyright-langserver.js.map +1 -1
  4. package/dist/pyright.js +1 -1
  5. package/dist/pyright.js.map +1 -1
  6. package/dist/typeshed-fallback/stdlib/_asyncio.pyi +6 -2
  7. package/dist/typeshed-fallback/stdlib/_compression.pyi +28 -28
  8. package/dist/typeshed-fallback/stdlib/_contextvars.pyi +6 -2
  9. package/dist/typeshed-fallback/stdlib/_ctypes.pyi +10 -51
  10. package/dist/typeshed-fallback/stdlib/_curses.pyi +187 -17
  11. package/dist/typeshed-fallback/stdlib/_decimal.pyi +7 -1
  12. package/dist/typeshed-fallback/stdlib/_heapq.pyi +20 -5
  13. package/dist/typeshed-fallback/stdlib/_interpqueues.pyi +6 -6
  14. package/dist/typeshed-fallback/stdlib/_interpreters.pyi +1 -7
  15. package/dist/typeshed-fallback/stdlib/_io.pyi +9 -5
  16. package/dist/typeshed-fallback/stdlib/_lsprof.pyi +12 -20
  17. package/dist/typeshed-fallback/stdlib/_operator.pyi +6 -2
  18. package/dist/typeshed-fallback/stdlib/_pickle.pyi +3 -3
  19. package/dist/typeshed-fallback/stdlib/_posixsubprocess.pyi +26 -26
  20. package/dist/typeshed-fallback/stdlib/_socket.pyi +6 -18
  21. package/dist/typeshed-fallback/stdlib/_stat.pyi +1 -1
  22. package/dist/typeshed-fallback/stdlib/_thread.pyi +10 -2
  23. package/dist/typeshed-fallback/stdlib/_zstd.pyi +300 -97
  24. package/dist/typeshed-fallback/stdlib/annotationlib.pyi +146 -146
  25. package/dist/typeshed-fallback/stdlib/ast.pyi +256 -96
  26. package/dist/typeshed-fallback/stdlib/asyncio/graph.pyi +28 -28
  27. package/dist/typeshed-fallback/stdlib/asyncio/tasks.pyi +3 -1
  28. package/dist/typeshed-fallback/stdlib/asyncio/tools.pyi +46 -46
  29. package/dist/typeshed-fallback/stdlib/builtins.pyi +46 -36
  30. package/dist/typeshed-fallback/stdlib/compression/_common/_streams.pyi +26 -26
  31. package/dist/typeshed-fallback/stdlib/compression/bz2.pyi +1 -1
  32. package/dist/typeshed-fallback/stdlib/compression/gzip.pyi +1 -1
  33. package/dist/typeshed-fallback/stdlib/compression/lzma.pyi +1 -1
  34. package/dist/typeshed-fallback/stdlib/compression/zlib.pyi +1 -1
  35. package/dist/typeshed-fallback/stdlib/compression/zstd/__init__.pyi +88 -88
  36. package/dist/typeshed-fallback/stdlib/compression/zstd/_zstdfile.pyi +117 -117
  37. package/dist/typeshed-fallback/stdlib/concurrent/futures/interpreter.pyi +79 -79
  38. package/dist/typeshed-fallback/stdlib/concurrent/futures/thread.pyi +8 -8
  39. package/dist/typeshed-fallback/stdlib/concurrent/interpreters/__init__.pyi +68 -68
  40. package/dist/typeshed-fallback/stdlib/concurrent/interpreters/_crossinterp.pyi +30 -30
  41. package/dist/typeshed-fallback/stdlib/concurrent/interpreters/_queues.pyi +74 -74
  42. package/dist/typeshed-fallback/stdlib/ctypes/__init__.pyi +7 -1
  43. package/dist/typeshed-fallback/stdlib/datetime.pyi +6 -2
  44. package/dist/typeshed-fallback/stdlib/decimal.pyi +12 -1
  45. package/dist/typeshed-fallback/stdlib/faulthandler.pyi +7 -5
  46. package/dist/typeshed-fallback/stdlib/functools.pyi +5 -9
  47. package/dist/typeshed-fallback/stdlib/gc.pyi +1 -1
  48. package/dist/typeshed-fallback/stdlib/marshal.pyi +6 -6
  49. package/dist/typeshed-fallback/stdlib/math.pyi +1 -3
  50. package/dist/typeshed-fallback/stdlib/multiprocessing/managers.pyi +3 -1
  51. package/dist/typeshed-fallback/stdlib/numbers.pyi +2 -10
  52. package/dist/typeshed-fallback/stdlib/os/__init__.pyi +15 -1
  53. package/dist/typeshed-fallback/stdlib/pathlib/__init__.pyi +6 -1
  54. package/dist/typeshed-fallback/stdlib/pathlib/types.pyi +8 -8
  55. package/dist/typeshed-fallback/stdlib/pyexpat/__init__.pyi +1 -1
  56. package/dist/typeshed-fallback/stdlib/string/templatelib.pyi +46 -36
  57. package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +25 -2
  58. package/dist/typeshed-fallback/stdlib/tkinter/__init__.pyi +7 -1
  59. package/dist/typeshed-fallback/stdlib/types.pyi +22 -8
  60. package/dist/typeshed-fallback/stdlib/typing.pyi +1 -0
  61. package/dist/typeshed-fallback/stdlib/typing_extensions.pyi +1 -0
  62. package/dist/typeshed-fallback/stdlib/unicodedata.pyi +2 -2
  63. package/dist/typeshed-fallback/stdlib/winsound.pyi +4 -0
  64. package/dist/typeshed-fallback/stdlib/xxlimited.pyi +3 -16
  65. package/package.json +1 -1
@@ -1,28 +1,28 @@
1
- import sys
2
- from _typeshed import SupportsWrite
3
- from asyncio import Future
4
- from dataclasses import dataclass
5
- from types import FrameType
6
- from typing import Any, overload
7
-
8
- if sys.version_info >= (3, 14):
9
- __all__ = ("capture_call_graph", "format_call_graph", "print_call_graph", "FrameCallGraphEntry", "FutureCallGraph")
10
-
11
- @dataclass(frozen=True, slots=True)
12
- class FrameCallGraphEntry:
13
- frame: FrameType
14
-
15
- @dataclass(frozen=True, slots=True)
16
- class FutureCallGraph:
17
- future: Future[Any]
18
- call_stack: tuple[FrameCallGraphEntry, ...]
19
- awaited_by: tuple[FutureCallGraph, ...]
20
-
21
- @overload
22
- def capture_call_graph(future: None = None, /, *, depth: int = 1, limit: int | None = None) -> FutureCallGraph | None: ...
23
- @overload
24
- def capture_call_graph(future: Future[Any], /, *, depth: int = 1, limit: int | None = None) -> FutureCallGraph | None: ...
25
- def format_call_graph(future: Future[Any] | None = None, /, *, depth: int = 1, limit: int | None = None) -> str: ...
26
- def print_call_graph(
27
- future: Future[Any] | None = None, /, *, file: SupportsWrite[str] | None = None, depth: int = 1, limit: int | None = None
28
- ) -> None: ...
1
+ import sys
2
+ from _typeshed import SupportsWrite
3
+ from asyncio import Future
4
+ from dataclasses import dataclass
5
+ from types import FrameType
6
+ from typing import Any, overload
7
+
8
+ if sys.version_info >= (3, 14):
9
+ __all__ = ("capture_call_graph", "format_call_graph", "print_call_graph", "FrameCallGraphEntry", "FutureCallGraph")
10
+
11
+ @dataclass(frozen=True, slots=True)
12
+ class FrameCallGraphEntry:
13
+ frame: FrameType
14
+
15
+ @dataclass(frozen=True, slots=True)
16
+ class FutureCallGraph:
17
+ future: Future[Any]
18
+ call_stack: tuple[FrameCallGraphEntry, ...]
19
+ awaited_by: tuple[FutureCallGraph, ...]
20
+
21
+ @overload
22
+ def capture_call_graph(future: None = None, /, *, depth: int = 1, limit: int | None = None) -> FutureCallGraph | None: ...
23
+ @overload
24
+ def capture_call_graph(future: Future[Any], /, *, depth: int = 1, limit: int | None = None) -> FutureCallGraph | None: ...
25
+ def format_call_graph(future: Future[Any] | None = None, /, *, depth: int = 1, limit: int | None = None) -> str: ...
26
+ def print_call_graph(
27
+ future: Future[Any] | None = None, /, *, file: SupportsWrite[str] | None = None, depth: int = 1, limit: int | None = None
28
+ ) -> None: ...
@@ -411,7 +411,9 @@ if sys.version_info >= (3, 12):
411
411
  else:
412
412
  _TaskCompatibleCoro: TypeAlias = Generator[_TaskYieldType, None, _T_co] | Coroutine[Any, Any, _T_co]
413
413
 
414
- def all_tasks(loop: AbstractEventLoop | None = None) -> set[Task[Any]]: ...
414
+ def all_tasks(loop: AbstractEventLoop | None = None) -> set[Task[Any]]:
415
+ """Return a set of all tasks for the loop."""
416
+ ...
415
417
 
416
418
  if sys.version_info >= (3, 11):
417
419
  def create_task(coro: _CoroutineLike[_T], *, name: str | None = None, context: Context | None = None) -> Task[_T]: ...
@@ -1,46 +1,46 @@
1
- import sys
2
- from collections.abc import Iterable
3
- from enum import Enum
4
- from typing import NamedTuple, SupportsIndex, type_check_only
5
-
6
- @type_check_only
7
- class _AwaitedInfo(NamedTuple): # AwaitedInfo_Type from _remote_debugging
8
- thread_id: int
9
- awaited_by: list[_TaskInfo]
10
-
11
- @type_check_only
12
- class _TaskInfo(NamedTuple): # TaskInfo_Type from _remote_debugging
13
- task_id: int
14
- task_name: str
15
- coroutine_stack: list[_CoroInfo]
16
- awaited_by: list[_CoroInfo]
17
-
18
- @type_check_only
19
- class _CoroInfo(NamedTuple): # CoroInfo_Type from _remote_debugging
20
- call_stack: list[_FrameInfo]
21
- task_name: int | str
22
-
23
- @type_check_only
24
- class _FrameInfo(NamedTuple): # FrameInfo_Type from _remote_debugging
25
- filename: str
26
- lineno: int
27
- funcname: str
28
-
29
- class NodeType(Enum):
30
- COROUTINE = 1
31
- TASK = 2
32
-
33
- class CycleFoundException(Exception):
34
- cycles: list[list[int]]
35
- id2name: dict[int, str]
36
- def __init__(self, cycles: list[list[int]], id2name: dict[int, str]) -> None: ...
37
-
38
- def get_all_awaited_by(pid: SupportsIndex) -> list[_AwaitedInfo]: ...
39
- def build_async_tree(result: Iterable[_AwaitedInfo], task_emoji: str = "(T)", cor_emoji: str = "") -> list[list[str]]: ...
40
- def build_task_table(result: Iterable[_AwaitedInfo]) -> list[list[int | str]]: ...
41
-
42
- if sys.version_info >= (3, 14):
43
- def exit_with_permission_help_text() -> None: ...
44
-
45
- def display_awaited_by_tasks_table(pid: SupportsIndex) -> None: ...
46
- def display_awaited_by_tasks_tree(pid: SupportsIndex) -> None: ...
1
+ import sys
2
+ from collections.abc import Iterable
3
+ from enum import Enum
4
+ from typing import NamedTuple, SupportsIndex, type_check_only
5
+
6
+ @type_check_only
7
+ class _AwaitedInfo(NamedTuple): # AwaitedInfo_Type from _remote_debugging
8
+ thread_id: int
9
+ awaited_by: list[_TaskInfo]
10
+
11
+ @type_check_only
12
+ class _TaskInfo(NamedTuple): # TaskInfo_Type from _remote_debugging
13
+ task_id: int
14
+ task_name: str
15
+ coroutine_stack: list[_CoroInfo]
16
+ awaited_by: list[_CoroInfo]
17
+
18
+ @type_check_only
19
+ class _CoroInfo(NamedTuple): # CoroInfo_Type from _remote_debugging
20
+ call_stack: list[_FrameInfo]
21
+ task_name: int | str
22
+
23
+ @type_check_only
24
+ class _FrameInfo(NamedTuple): # FrameInfo_Type from _remote_debugging
25
+ filename: str
26
+ lineno: int
27
+ funcname: str
28
+
29
+ class NodeType(Enum):
30
+ COROUTINE = 1
31
+ TASK = 2
32
+
33
+ class CycleFoundException(Exception):
34
+ cycles: list[list[int]]
35
+ id2name: dict[int, str]
36
+ def __init__(self, cycles: list[list[int]], id2name: dict[int, str]) -> None: ...
37
+
38
+ def get_all_awaited_by(pid: SupportsIndex) -> list[_AwaitedInfo]: ...
39
+ def build_async_tree(result: Iterable[_AwaitedInfo], task_emoji: str = "(T)", cor_emoji: str = "") -> list[list[str]]: ...
40
+ def build_task_table(result: Iterable[_AwaitedInfo]) -> list[list[int | str]]: ...
41
+
42
+ if sys.version_info >= (3, 14):
43
+ def exit_with_permission_help_text() -> None: ...
44
+
45
+ def display_awaited_by_tasks_table(pid: SupportsIndex) -> None: ...
46
+ def display_awaited_by_tasks_tree(pid: SupportsIndex) -> None: ...
@@ -669,15 +669,15 @@ class int:
669
669
  """Flooring an Integral returns itself."""
670
670
  ...
671
671
  if sys.version_info >= (3, 14):
672
- def __round__(self, ndigits: SupportsIndex | None = None, /) -> int: ...
673
- else:
674
- def __round__(self, ndigits: SupportsIndex = ..., /) -> int:
672
+ def __round__(self, ndigits: SupportsIndex | None = None, /) -> int:
675
673
  """
676
674
  Rounding an Integral returns itself.
677
675
 
678
676
  Rounding with an ndigits argument also returns an integer.
679
677
  """
680
678
  ...
679
+ else:
680
+ def __round__(self, ndigits: SupportsIndex = ..., /) -> int: ...
681
681
 
682
682
  def __getnewargs__(self) -> tuple[int]: ...
683
683
  def __eq__(self, value: object, /) -> bool:
@@ -909,7 +909,9 @@ class float:
909
909
  ...
910
910
  if sys.version_info >= (3, 14):
911
911
  @classmethod
912
- def from_number(cls, number: float | SupportsIndex | SupportsFloat, /) -> Self: ...
912
+ def from_number(cls, number: float | SupportsIndex | SupportsFloat, /) -> Self:
913
+ """Convert real number to a floating-point number."""
914
+ ...
913
915
 
914
916
  @disjoint_base
915
917
  class complex:
@@ -1001,7 +1003,9 @@ class complex:
1001
1003
  ...
1002
1004
  if sys.version_info >= (3, 14):
1003
1005
  @classmethod
1004
- def from_number(cls, number: complex | SupportsComplex | SupportsFloat | SupportsIndex, /) -> Self: ...
1006
+ def from_number(cls, number: complex | SupportsComplex | SupportsFloat | SupportsIndex, /) -> Self:
1007
+ """Convert number to a complex floating-point number."""
1008
+ ...
1005
1009
 
1006
1010
  @type_check_only
1007
1011
  class _FormatMapMapping(Protocol):
@@ -2902,7 +2906,14 @@ class bytearray(MutableSequence[int]):
2902
2906
  """Release the buffer object that exposes the underlying memory of the object."""
2903
2907
  ...
2904
2908
  if sys.version_info >= (3, 14):
2905
- def resize(self, size: int, /) -> None: ...
2909
+ def resize(self, size: int, /) -> None:
2910
+ """
2911
+ Resize the internal buffer of bytearray to len.
2912
+
2913
+ size
2914
+ New size to resize to..
2915
+ """
2916
+ ...
2906
2917
 
2907
2918
  _IntegerFormats: TypeAlias = Literal[
2908
2919
  "b", "B", "@b", "@B", "h", "H", "@h", "@H", "i", "I", "@i", "@I", "l", "L", "@l", "@L", "q", "Q", "@q", "@Q", "P", "@P"
@@ -3088,7 +3099,9 @@ class memoryview(Sequence[_I]):
3088
3099
  index: ClassVar[None] # type: ignore[assignment]
3089
3100
  count: ClassVar[None] # type: ignore[assignment]
3090
3101
  if sys.version_info >= (3, 14):
3091
- def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
3102
+ def __class_getitem__(cls, item: Any, /) -> GenericAlias:
3103
+ """See PEP 585"""
3104
+ ...
3092
3105
 
3093
3106
  @final
3094
3107
  class bool(int):
@@ -4550,6 +4563,9 @@ class map(Generic[_S]):
4550
4563
  """
4551
4564
  Make an iterator that computes the function using arguments from
4552
4565
  each of the iterables. Stops when the shortest iterable is exhausted.
4566
+
4567
+ If strict is true and one of the arguments is exhausted before the others,
4568
+ raise a ValueError.
4553
4569
  """
4554
4570
  # 3.14 adds `strict` argument.
4555
4571
  if sys.version_info >= (3, 14):
@@ -4901,9 +4917,9 @@ def open(
4901
4917
  given, the default buffering policy works as follows:
4902
4918
 
4903
4919
  * Binary files are buffered in fixed-size chunks; the size of the buffer
4904
- is chosen using a heuristic trying to determine the underlying device's
4905
- "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
4906
- On many systems, the buffer will typically be 4096 or 8192 bytes long.
4920
+ is max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)
4921
+ when the device block size is available.
4922
+ On most systems, the buffer will typically be 128 kilobytes long.
4907
4923
 
4908
4924
  * "Interactive" text files (files for which isatty() returns True)
4909
4925
  use line buffering. Other text files use the policy described above
@@ -5030,9 +5046,9 @@ def open(
5030
5046
  given, the default buffering policy works as follows:
5031
5047
 
5032
5048
  * Binary files are buffered in fixed-size chunks; the size of the buffer
5033
- is chosen using a heuristic trying to determine the underlying device's
5034
- "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
5035
- On many systems, the buffer will typically be 4096 or 8192 bytes long.
5049
+ is max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)
5050
+ when the device block size is available.
5051
+ On most systems, the buffer will typically be 128 kilobytes long.
5036
5052
 
5037
5053
  * "Interactive" text files (files for which isatty() returns True)
5038
5054
  use line buffering. Other text files use the policy described above
@@ -5159,9 +5175,9 @@ def open(
5159
5175
  given, the default buffering policy works as follows:
5160
5176
 
5161
5177
  * Binary files are buffered in fixed-size chunks; the size of the buffer
5162
- is chosen using a heuristic trying to determine the underlying device's
5163
- "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
5164
- On many systems, the buffer will typically be 4096 or 8192 bytes long.
5178
+ is max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)
5179
+ when the device block size is available.
5180
+ On most systems, the buffer will typically be 128 kilobytes long.
5165
5181
 
5166
5182
  * "Interactive" text files (files for which isatty() returns True)
5167
5183
  use line buffering. Other text files use the policy described above
@@ -5286,9 +5302,9 @@ def open(
5286
5302
  given, the default buffering policy works as follows:
5287
5303
 
5288
5304
  * Binary files are buffered in fixed-size chunks; the size of the buffer
5289
- is chosen using a heuristic trying to determine the underlying device's
5290
- "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
5291
- On many systems, the buffer will typically be 4096 or 8192 bytes long.
5305
+ is max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)
5306
+ when the device block size is available.
5307
+ On most systems, the buffer will typically be 128 kilobytes long.
5292
5308
 
5293
5309
  * "Interactive" text files (files for which isatty() returns True)
5294
5310
  use line buffering. Other text files use the policy described above
@@ -5413,9 +5429,9 @@ def open(
5413
5429
  given, the default buffering policy works as follows:
5414
5430
 
5415
5431
  * Binary files are buffered in fixed-size chunks; the size of the buffer
5416
- is chosen using a heuristic trying to determine the underlying device's
5417
- "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
5418
- On many systems, the buffer will typically be 4096 or 8192 bytes long.
5432
+ is max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)
5433
+ when the device block size is available.
5434
+ On most systems, the buffer will typically be 128 kilobytes long.
5419
5435
 
5420
5436
  * "Interactive" text files (files for which isatty() returns True)
5421
5437
  use line buffering. Other text files use the policy described above
@@ -5542,9 +5558,9 @@ def open(
5542
5558
  given, the default buffering policy works as follows:
5543
5559
 
5544
5560
  * Binary files are buffered in fixed-size chunks; the size of the buffer
5545
- is chosen using a heuristic trying to determine the underlying device's
5546
- "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
5547
- On many systems, the buffer will typically be 4096 or 8192 bytes long.
5561
+ is max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)
5562
+ when the device block size is available.
5563
+ On most systems, the buffer will typically be 128 kilobytes long.
5548
5564
 
5549
5565
  * "Interactive" text files (files for which isatty() returns True)
5550
5566
  use line buffering. Other text files use the policy described above
@@ -5671,9 +5687,9 @@ def open(
5671
5687
  given, the default buffering policy works as follows:
5672
5688
 
5673
5689
  * Binary files are buffered in fixed-size chunks; the size of the buffer
5674
- is chosen using a heuristic trying to determine the underlying device's
5675
- "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
5676
- On many systems, the buffer will typically be 4096 or 8192 bytes long.
5690
+ is max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)
5691
+ when the device block size is available.
5692
+ On most systems, the buffer will typically be 128 kilobytes long.
5677
5693
 
5678
5694
  * "Interactive" text files (files for which isatty() returns True)
5679
5695
  use line buffering. Other text files use the policy described above
@@ -6259,19 +6275,13 @@ class BaseException:
6259
6275
  def __new__(cls, *args: Any, **kwds: Any) -> Self: ...
6260
6276
  def __setstate__(self, state: dict[str, Any] | None, /) -> None: ...
6261
6277
  def with_traceback(self, tb: TracebackType | None, /) -> Self:
6262
- """
6263
- Exception.with_traceback(tb) --
6264
- set self.__traceback__ to tb and return self.
6265
- """
6278
+ """Set self.__traceback__ to tb and return self."""
6266
6279
  ...
6267
6280
  if sys.version_info >= (3, 11):
6268
6281
  # only present after add_note() is called
6269
6282
  __notes__: list[str]
6270
6283
  def add_note(self, note: str, /) -> None:
6271
- """
6272
- Exception.add_note(note) --
6273
- add a note to the exception
6274
- """
6284
+ """Add a note to the exception"""
6275
6285
  ...
6276
6286
 
6277
6287
  class GeneratorExit(BaseException):
@@ -1,26 +1,26 @@
1
- from _typeshed import Incomplete, WriteableBuffer
2
- from collections.abc import Callable
3
- from io import DEFAULT_BUFFER_SIZE, BufferedIOBase, RawIOBase
4
- from typing import Any, Protocol, type_check_only
5
-
6
- BUFFER_SIZE = DEFAULT_BUFFER_SIZE
7
-
8
- @type_check_only
9
- class _Reader(Protocol):
10
- def read(self, n: int, /) -> bytes: ...
11
- def seekable(self) -> bool: ...
12
- def seek(self, n: int, /) -> Any: ...
13
-
14
- class BaseStream(BufferedIOBase): ...
15
-
16
- class DecompressReader(RawIOBase):
17
- def __init__(
18
- self,
19
- fp: _Reader,
20
- decomp_factory: Callable[..., Incomplete], # Consider backporting changes to _compression
21
- trailing_error: type[Exception] | tuple[type[Exception], ...] = (),
22
- **decomp_args: Any, # These are passed to decomp_factory.
23
- ) -> None: ...
24
- def readinto(self, b: WriteableBuffer) -> int: ...
25
- def read(self, size: int = -1) -> bytes: ...
26
- def seek(self, offset: int, whence: int = 0) -> int: ...
1
+ from _typeshed import Incomplete, WriteableBuffer
2
+ from collections.abc import Callable
3
+ from io import DEFAULT_BUFFER_SIZE, BufferedIOBase, RawIOBase
4
+ from typing import Any, Protocol, type_check_only
5
+
6
+ BUFFER_SIZE = DEFAULT_BUFFER_SIZE
7
+
8
+ @type_check_only
9
+ class _Reader(Protocol):
10
+ def read(self, n: int, /) -> bytes: ...
11
+ def seekable(self) -> bool: ...
12
+ def seek(self, n: int, /) -> Any: ...
13
+
14
+ class BaseStream(BufferedIOBase): ...
15
+
16
+ class DecompressReader(RawIOBase):
17
+ def __init__(
18
+ self,
19
+ fp: _Reader,
20
+ decomp_factory: Callable[..., Incomplete], # Consider backporting changes to _compression
21
+ trailing_error: type[Exception] | tuple[type[Exception], ...] = (),
22
+ **decomp_args: Any, # These are passed to decomp_factory.
23
+ ) -> None: ...
24
+ def readinto(self, b: WriteableBuffer) -> int: ...
25
+ def read(self, size: int = -1) -> bytes: ...
26
+ def seek(self, offset: int, whence: int = 0) -> int: ...
@@ -1 +1 @@
1
- from bz2 import *
1
+ from bz2 import *
@@ -1 +1 @@
1
- from gzip import *
1
+ from gzip import *
@@ -1 +1 @@
1
- from lzma import *
1
+ from lzma import *
@@ -1 +1 @@
1
- from zlib import *
1
+ from zlib import *
@@ -1,88 +1,88 @@
1
- import enum
2
- from _typeshed import ReadableBuffer
3
- from collections.abc import Iterable, Mapping
4
- from compression.zstd._zstdfile import ZstdFile, open
5
- from typing import Final, final
6
-
7
- import _zstd
8
- from _zstd import ZstdCompressor, ZstdDecompressor, ZstdDict, ZstdError, get_frame_size, zstd_version
9
-
10
- __all__ = (
11
- # compression.zstd
12
- "COMPRESSION_LEVEL_DEFAULT",
13
- "compress",
14
- "CompressionParameter",
15
- "decompress",
16
- "DecompressionParameter",
17
- "finalize_dict",
18
- "get_frame_info",
19
- "Strategy",
20
- "train_dict",
21
- # compression.zstd._zstdfile
22
- "open",
23
- "ZstdFile",
24
- # _zstd
25
- "get_frame_size",
26
- "zstd_version",
27
- "zstd_version_info",
28
- "ZstdCompressor",
29
- "ZstdDecompressor",
30
- "ZstdDict",
31
- "ZstdError",
32
- )
33
-
34
- zstd_version_info: Final[tuple[int, int, int]]
35
- COMPRESSION_LEVEL_DEFAULT: Final = _zstd.ZSTD_CLEVEL_DEFAULT
36
-
37
- class FrameInfo:
38
- __slots__ = ("decompressed_size", "dictionary_id")
39
- decompressed_size: int
40
- dictionary_id: int
41
- def __init__(self, decompressed_size: int, dictionary_id: int) -> None: ...
42
-
43
- def get_frame_info(frame_buffer: ReadableBuffer) -> FrameInfo: ...
44
- def train_dict(samples: Iterable[ReadableBuffer], dict_size: int) -> ZstdDict: ...
45
- def finalize_dict(zstd_dict: ZstdDict, /, samples: Iterable[ReadableBuffer], dict_size: int, level: int) -> ZstdDict: ...
46
- def compress(
47
- data: ReadableBuffer, level: int | None = None, options: Mapping[int, int] | None = None, zstd_dict: ZstdDict | None = None
48
- ) -> bytes: ...
49
- def decompress(data: ReadableBuffer, zstd_dict: ZstdDict | None = None, options: Mapping[int, int] | None = None) -> bytes: ...
50
- @final
51
- class CompressionParameter(enum.IntEnum):
52
- compression_level = _zstd.ZSTD_c_compressionLevel
53
- window_log = _zstd.ZSTD_c_windowLog
54
- hash_log = _zstd.ZSTD_c_hashLog
55
- chain_log = _zstd.ZSTD_c_chainLog
56
- search_log = _zstd.ZSTD_c_searchLog
57
- min_match = _zstd.ZSTD_c_minMatch
58
- target_length = _zstd.ZSTD_c_targetLength
59
- strategy = _zstd.ZSTD_c_strategy
60
- enable_long_distance_matching = _zstd.ZSTD_c_enableLongDistanceMatching
61
- ldm_hash_log = _zstd.ZSTD_c_ldmHashLog
62
- ldm_min_match = _zstd.ZSTD_c_ldmMinMatch
63
- ldm_bucket_size_log = _zstd.ZSTD_c_ldmBucketSizeLog
64
- ldm_hash_rate_log = _zstd.ZSTD_c_ldmHashRateLog
65
- content_size_flag = _zstd.ZSTD_c_contentSizeFlag
66
- checksum_flag = _zstd.ZSTD_c_checksumFlag
67
- dict_id_flag = _zstd.ZSTD_c_dictIDFlag
68
- nb_workers = _zstd.ZSTD_c_nbWorkers
69
- job_size = _zstd.ZSTD_c_jobSize
70
- overlap_log = _zstd.ZSTD_c_overlapLog
71
- def bounds(self) -> tuple[int, int]: ...
72
-
73
- @final
74
- class DecompressionParameter(enum.IntEnum):
75
- window_log_max = _zstd.ZSTD_d_windowLogMax
76
- def bounds(self) -> tuple[int, int]: ...
77
-
78
- @final
79
- class Strategy(enum.IntEnum):
80
- fast = _zstd.ZSTD_fast
81
- dfast = _zstd.ZSTD_dfast
82
- greedy = _zstd.ZSTD_greedy
83
- lazy = _zstd.ZSTD_lazy
84
- lazy2 = _zstd.ZSTD_lazy2
85
- btlazy2 = _zstd.ZSTD_btlazy2
86
- btopt = _zstd.ZSTD_btopt
87
- btultra = _zstd.ZSTD_btultra
88
- btultra2 = _zstd.ZSTD_btultra2
1
+ import enum
2
+ from _typeshed import ReadableBuffer
3
+ from collections.abc import Iterable, Mapping
4
+ from compression.zstd._zstdfile import ZstdFile, open
5
+ from typing import Final, final
6
+
7
+ import _zstd
8
+ from _zstd import ZstdCompressor, ZstdDecompressor, ZstdDict, ZstdError, get_frame_size, zstd_version
9
+
10
+ __all__ = (
11
+ # compression.zstd
12
+ "COMPRESSION_LEVEL_DEFAULT",
13
+ "compress",
14
+ "CompressionParameter",
15
+ "decompress",
16
+ "DecompressionParameter",
17
+ "finalize_dict",
18
+ "get_frame_info",
19
+ "Strategy",
20
+ "train_dict",
21
+ # compression.zstd._zstdfile
22
+ "open",
23
+ "ZstdFile",
24
+ # _zstd
25
+ "get_frame_size",
26
+ "zstd_version",
27
+ "zstd_version_info",
28
+ "ZstdCompressor",
29
+ "ZstdDecompressor",
30
+ "ZstdDict",
31
+ "ZstdError",
32
+ )
33
+
34
+ zstd_version_info: Final[tuple[int, int, int]]
35
+ COMPRESSION_LEVEL_DEFAULT: Final = _zstd.ZSTD_CLEVEL_DEFAULT
36
+
37
+ class FrameInfo:
38
+ __slots__ = ("decompressed_size", "dictionary_id")
39
+ decompressed_size: int
40
+ dictionary_id: int
41
+ def __init__(self, decompressed_size: int, dictionary_id: int) -> None: ...
42
+
43
+ def get_frame_info(frame_buffer: ReadableBuffer) -> FrameInfo: ...
44
+ def train_dict(samples: Iterable[ReadableBuffer], dict_size: int) -> ZstdDict: ...
45
+ def finalize_dict(zstd_dict: ZstdDict, /, samples: Iterable[ReadableBuffer], dict_size: int, level: int) -> ZstdDict: ...
46
+ def compress(
47
+ data: ReadableBuffer, level: int | None = None, options: Mapping[int, int] | None = None, zstd_dict: ZstdDict | None = None
48
+ ) -> bytes: ...
49
+ def decompress(data: ReadableBuffer, zstd_dict: ZstdDict | None = None, options: Mapping[int, int] | None = None) -> bytes: ...
50
+ @final
51
+ class CompressionParameter(enum.IntEnum):
52
+ compression_level = _zstd.ZSTD_c_compressionLevel
53
+ window_log = _zstd.ZSTD_c_windowLog
54
+ hash_log = _zstd.ZSTD_c_hashLog
55
+ chain_log = _zstd.ZSTD_c_chainLog
56
+ search_log = _zstd.ZSTD_c_searchLog
57
+ min_match = _zstd.ZSTD_c_minMatch
58
+ target_length = _zstd.ZSTD_c_targetLength
59
+ strategy = _zstd.ZSTD_c_strategy
60
+ enable_long_distance_matching = _zstd.ZSTD_c_enableLongDistanceMatching
61
+ ldm_hash_log = _zstd.ZSTD_c_ldmHashLog
62
+ ldm_min_match = _zstd.ZSTD_c_ldmMinMatch
63
+ ldm_bucket_size_log = _zstd.ZSTD_c_ldmBucketSizeLog
64
+ ldm_hash_rate_log = _zstd.ZSTD_c_ldmHashRateLog
65
+ content_size_flag = _zstd.ZSTD_c_contentSizeFlag
66
+ checksum_flag = _zstd.ZSTD_c_checksumFlag
67
+ dict_id_flag = _zstd.ZSTD_c_dictIDFlag
68
+ nb_workers = _zstd.ZSTD_c_nbWorkers
69
+ job_size = _zstd.ZSTD_c_jobSize
70
+ overlap_log = _zstd.ZSTD_c_overlapLog
71
+ def bounds(self) -> tuple[int, int]: ...
72
+
73
+ @final
74
+ class DecompressionParameter(enum.IntEnum):
75
+ window_log_max = _zstd.ZSTD_d_windowLogMax
76
+ def bounds(self) -> tuple[int, int]: ...
77
+
78
+ @final
79
+ class Strategy(enum.IntEnum):
80
+ fast = _zstd.ZSTD_fast
81
+ dfast = _zstd.ZSTD_dfast
82
+ greedy = _zstd.ZSTD_greedy
83
+ lazy = _zstd.ZSTD_lazy
84
+ lazy2 = _zstd.ZSTD_lazy2
85
+ btlazy2 = _zstd.ZSTD_btlazy2
86
+ btopt = _zstd.ZSTD_btopt
87
+ btultra = _zstd.ZSTD_btultra
88
+ btultra2 = _zstd.ZSTD_btultra2