Debian Codegraph @

jedi/third_party/typeshed/stdlib/copy.pyi

raw symbols SCIP
1 import sys
2 from typing import Any, Protocol, TypeVar, type_check_only
3
4 __all__ = ["Error", "copy", "deepcopy"]
5
6 _T = TypeVar("_T")
7 _RT_co = TypeVar("_RT_co", covariant=True)
8
9 @type_check_only
10 class _SupportsReplace(Protocol[_RT_co]):
11 # In reality doesn't support args, but there's no great way to express this.
12 def __replace__(self, /, *_: Any, **changes: Any) -> _RT_co: ...
13
14 # None in CPython but non-None in Jython
15 PyStringMap: Any
16
17 # Note: memo and _nil are internal kwargs.
18 def deepcopy(x: _T, memo: dict[int, Any] | None = None, _nil: Any = []) -> _T: ...
19 def copy(x: _T) -> _T: ...
20
21 if sys.version_info >= (3, 13):
22 __all__ += ["replace"]
23 # The types accepted by `**changes` match those of `obj.__replace__`.
24 def replace(obj: _SupportsReplace[_RT_co], /, **changes: Any) -> _RT_co: ...
25
26 class Error(Exception): ...
27
28 error = Error