Best Python code snippet using stestr_python
shutil.pyi
Source:shutil.pyi
1import os2import sys3# 'bytes' paths are not properly supported: they don't work with all functions,4# sometimes they only work partially (broken exception messages), and the test5# cases don't use them.6from typing import (7 List, Iterable, Callable, Any, Tuple, Sequence, NamedTuple, IO,8 AnyStr, Optional, Union, Set, TypeVar, overload, Type, Protocol, Text9)10if sys.version_info >= (3, 6):11 _Path = Union[str, os.PathLike[str]]12 _AnyStr = str13 _AnyPath = TypeVar("_AnyPath", str, os.PathLike[str])14 # Return value of some functions that may either return a path-like object that was passed in or15 # a string16 _PathReturn = Any17elif sys.version_info >= (3,):18 _Path = str19 _AnyStr = str20 _AnyPath = str21 _PathReturn = str22else:23 _Path = Text24 _AnyStr = TypeVar("_AnyStr", str, unicode)25 _AnyPath = TypeVar("_AnyPath", str, unicode)26 _PathReturn = Type[None]27if sys.version_info >= (3,):28 class Error(OSError): ...29 class SameFileError(Error): ...30 class SpecialFileError(OSError): ...31 class ExecError(OSError): ...32 class ReadError(OSError): ...33 class RegistryError(Exception): ...34else:35 class Error(EnvironmentError): ...36 class SpecialFileError(EnvironmentError): ...37 class ExecError(EnvironmentError): ...38_S_co = TypeVar("_S_co", covariant=True)39_S_contra = TypeVar("_S_contra", contravariant=True)40class _Reader(Protocol[_S_co]):41 def read(self, length: int) -> _S_co: ...42class _Writer(Protocol[_S_contra]):43 def write(self, data: _S_contra) -> Any: ...44def copyfileobj(fsrc: _Reader[AnyStr], fdst: _Writer[AnyStr],45 length: int = ...) -> None: ...46if sys.version_info >= (3,):47 def copyfile(src: _Path, dst: _AnyPath, *,48 follow_symlinks: bool = ...) -> _AnyPath: ...49 def copymode(src: _Path, dst: _Path, *,50 follow_symlinks: bool = ...) -> None: ...51 def copystat(src: _Path, dst: _Path, *,52 follow_symlinks: bool = ...) -> None: ...53 def copy(src: _Path, dst: _Path, *,54 follow_symlinks: bool = ...) -> _PathReturn: ...55 def copy2(src: _Path, dst: _Path, *,56 follow_symlinks: bool = ...) -> _PathReturn: ...57else:58 def copyfile(src: _Path, dst: _Path) -> None: ...59 def copymode(src: _Path, dst: _Path) -> None: ...60 def copystat(src: _Path, dst: _Path) -> None: ...61 def copy(src: _Path, dst: _Path) -> _PathReturn: ...62 def copy2(src: _Path, dst: _Path) -> _PathReturn: ...63def ignore_patterns(*patterns: _Path) -> Callable[[Any, List[_AnyStr]], Set[_AnyStr]]: ...64if sys.version_info >= (3, 8):65 def copytree(66 src: _Path,67 dst: _Path,68 symlinks: bool = ...,69 ignore: Union[None, Callable[[str, List[str]], Iterable[str]], Callable[[_Path, List[str]], Iterable[str]]] = ...,70 copy_function: Callable[[str, str], None] = ...,71 ignore_dangling_symlinks: bool = ...,72 dirs_exist_ok: bool = ...,73 ) -> _PathReturn: ...74elif sys.version_info >= (3,):75 def copytree(src: _Path, dst: _Path, symlinks: bool = ...,76 ignore: Union[None,77 Callable[[str, List[str]], Iterable[str]],78 Callable[[_Path, List[str]], Iterable[str]]] = ...,79 copy_function: Callable[[str, str], None] = ...,80 ignore_dangling_symlinks: bool = ...) -> _PathReturn: ...81else:82 def copytree(src: AnyStr, dst: AnyStr, symlinks: bool = ...,83 ignore: Union[None,84 Callable[[AnyStr, List[AnyStr]],85 Iterable[AnyStr]]] = ...) -> _PathReturn: ...86if sys.version_info >= (3,):87 @overload88 def rmtree(path: bytes, ignore_errors: bool = ...,89 onerror: Optional[Callable[[Any, str, Any], Any]] = ...) -> None: ...90 @overload91 def rmtree(path: _AnyPath, ignore_errors: bool = ...,92 onerror: Optional[Callable[[Any, _AnyPath, Any], Any]] = ...) -> None: ...93else:94 def rmtree(path: _AnyPath, ignore_errors: bool = ...,95 onerror: Optional[Callable[[Any, _AnyPath, Any], Any]] = ...) -> None: ...96if sys.version_info >= (3, 5):97 _CopyFn = Union[Callable[[str, str], None], Callable[[_Path, _Path], None]]98 def move(src: _Path, dst: _Path,99 copy_function: _CopyFn = ...) -> _PathReturn: ...100else:101 def move(src: _Path, dst: _Path) -> _PathReturn: ...102if sys.version_info >= (3,):103 class _ntuple_diskusage(NamedTuple):104 total: int105 used: int106 free: int107 def disk_usage(path: _Path) -> _ntuple_diskusage: ...108 def chown(path: _Path, user: Optional[str] = ...,109 group: Optional[str] = ...) -> None: ...110 def which(cmd: _Path, mode: int = ...,111 path: Optional[_Path] = ...) -> Optional[str]: ...112def make_archive(base_name: _AnyStr, format: str, root_dir: Optional[_Path] = ...,113 base_dir: Optional[_Path] = ..., verbose: bool = ...,114 dry_run: bool = ..., owner: Optional[str] = ..., group: Optional[str] = ...,115 logger: Optional[Any] = ...) -> _AnyStr: ...116def get_archive_formats() -> List[Tuple[str, str]]: ...117def register_archive_format(name: str, function: Callable[..., Any],118 extra_args: Optional[Sequence[Union[Tuple[str, Any], List[Any]]]] = ...,119 description: str = ...) -> None: ...120def unregister_archive_format(name: str) -> None: ...121if sys.version_info >= (3,):122 # Should be _Path once http://bugs.python.org/issue30218 is fixed123 def unpack_archive(filename: str, extract_dir: Optional[_Path] = ...,124 format: Optional[str] = ...) -> None: ...125 def register_unpack_format(name: str, extensions: List[str], function: Any,126 extra_args: Sequence[Tuple[str, Any]] = ...,127 description: str = ...) -> None: ...128 def unregister_unpack_format(name: str) -> None: ...129 def get_unpack_formats() -> List[Tuple[str, List[str], str]]: ......
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!