Best Python code snippet using molotov_python
__init__.pyi
Source:__init__.pyi
1import abc2from typing import (Mapping, MutableMapping, List, Union, Iterable,3 Iterator, TypeVar, Generic, Tuple, Dict, Optional,4 overload)5class istr(str):6 pass7upstr = istr8_S = Union[str, istr]9_T = TypeVar('_T')10_T_co = TypeVar('_T_co', covariant=True)11_D = TypeVar('_D')12class MultiMapping(Mapping[_S, _T_co]):13 @overload14 @abc.abstractmethod15 def getall(self, key: _S) -> List[_T_co]: ...16 @overload17 @abc.abstractmethod18 def getall(self, key: _S, default: _D) -> Union[List[_T_co], _D]: ...19 @overload20 @abc.abstractmethod21 def getone(self, key: _S) -> _T_co: ...22 @overload23 @abc.abstractmethod24 def getone(self, key: _S, default: _D) -> Union[_T_co, _D]: ...25_Arg = Union[Mapping[_S, _T],26 Dict[_S, _T],27 MultiMapping[_T],28 Iterable[Tuple[_S, _T]]]29class MutableMultiMapping(MultiMapping[_T],30 MutableMapping[_S, _T],31 Generic[_T]):32 @abc.abstractmethod33 def add(self, key: _S, value: _T) -> None: ...34 @abc.abstractmethod35 def extend(self, arg: _Arg[_T] = ..., **kwargs: _T) -> None: ...36 @overload37 @abc.abstractmethod38 def popone(self, key: _S) -> _T: ...39 @overload40 @abc.abstractmethod41 def popone(self, key: _S, default: _D) -> Union[_T, _D]: ...42 @overload43 @abc.abstractmethod44 def popall(self, key: _S) -> List[_T]: ...45 @overload46 @abc.abstractmethod47 def popall(self, key: _S, default: _D) -> Union[List[_T], _D]: ...48class MultiDict(MutableMultiMapping[_T], Generic[_T]):49 def __init__(self, arg: _Arg[_T] = ..., **kwargs: _T) -> None: ...50 def copy(self) -> MultiDict[_T]: ...51 def __getitem__(self, k: _S) -> _T: ...52 def __setitem__(self, k: _S, v: _T) -> None: ...53 def __delitem__(self, v: _S) -> None: ...54 def __iter__(self) -> Iterator[_S]: ...55 def __len__(self) -> int: ...56 @overload57 def getall(self, key: _S) -> List[_T]: ...58 @overload59 def getall(self, key: _S, default: _D) -> Union[List[_T], _D]: ...60 @overload61 def getone(self, key: _S) -> _T: ...62 @overload63 def getone(self, key: _S, default: _D) -> Union[_T, _D]: ...64 def add(self, key: _S, value: _T) -> None: ...65 def extend(self, arg: _Arg[_T] = ..., **kwargs: _T) -> None: ...66 @overload67 def popone(self, key: _S) -> _T: ...68 @overload69 def popone(self, key: _S, default: _D) -> Union[_T, _D]: ...70 @overload71 def popall(self, key: _S) -> List[_T]: ...72 @overload73 def popall(self, key: _S, default: _D) -> Union[List[_T], _D]: ...74class CIMultiDict(MutableMultiMapping[_T], Generic[_T]):75 def __init__(self, arg: _Arg[_T] = ..., **kwargs: _T) -> None: ...76 def copy(self) -> MultiDict[_T]: ...77 def __getitem__(self, k: _S) -> _T: ...78 def __setitem__(self, k: _S, v: _T) -> None: ...79 def __delitem__(self, v: _S) -> None: ...80 def __iter__(self) -> Iterator[_S]: ...81 def __len__(self) -> int: ...82 @overload83 def getall(self, key: _S) -> List[_T]: ...84 @overload85 def getall(self, key: _S, default: _D) -> Union[List[_T], _D]: ...86 @overload87 def getone(self, key: _S) -> _T: ...88 @overload89 def getone(self, key: _S, default: _D) -> Union[_T, _D]: ...90 def add(self, key: _S, value: _T) -> None: ...91 def extend(self, arg: _Arg[_T] = ..., **kwargs: _T) -> None: ...92 @overload93 def popone(self, key: _S) -> _T: ...94 @overload95 def popone(self, key: _S, default: _D) -> Union[_T, _D]: ...96 @overload97 def popall(self, key: _S) -> List[_T]: ...98 @overload99 def popall(self, key: _S, default: _D) -> Union[List[_T], _D]: ...100class MultiDictProxy(MultiMapping[_T], Generic[_T]):101 def __init__(self, arg: Union[MultiMapping[_T],102 MutableMultiMapping[_T]]) -> None: ...103 def copy(self) -> MultiDict[_T]: ...104 def __getitem__(self, k: _S) -> _T: ...105 def __iter__(self) -> Iterator[_S]: ...106 def __len__(self) -> int: ...107 @overload108 def getall(self, key: _S) -> List[_T]: ...109 @overload110 def getall(self, key: _S, default: _D) -> Union[List[_T], _D]: ...111 @overload112 def getone(self, key: _S) -> _T: ...113 @overload114 def getone(self, key: _S, default: _D) -> Union[_T, _D]: ...115class CIMultiDictProxy(MultiMapping[_T], Generic[_T]):116 def __init__(self, arg: Union[MultiMapping[_T],117 MutableMultiMapping[_T]]) -> None: ...118 def __getitem__(self, k: _S) -> _T: ...119 def __iter__(self) -> Iterator[_S]: ...120 def __len__(self) -> int: ...121 @overload122 def getall(self, key: _S) -> List[_T]: ...123 @overload124 def getall(self, key: _S, default: _D) -> Union[List[_T], _D]: ...125 @overload126 def getone(self, key: _S) -> _T: ...127 @overload128 def getone(self, key: _S, default: _D) -> Union[_T, _D]: ...129 def copy(self) -> CIMultiDict[_T]: ...130def getversion(md: Union[MultiDict[_T],131 CIMultiDict[_T],132 MultiDictProxy[_T],...
functools.pyi
Source:functools.pyi
1import sys2from typing import Any, Callable, Generic, Dict, Iterable, Mapping, Optional, Sequence, Tuple, Type, TypeVar, NamedTuple, Union, overload3_AnyCallable = Callable[..., Any]4_T = TypeVar("_T")5_T2 = TypeVar("_T2")6_T3 = TypeVar("_T3")7_T4 = TypeVar("_T4")8_T5 = TypeVar("_T5")9_S = TypeVar("_S")10@overload11def reduce(function: Callable[[_T, _S], _T],12 sequence: Iterable[_S], initial: _T) -> _T: ...13@overload14def reduce(function: Callable[[_T, _T], _T],15 sequence: Iterable[_T]) -> _T: ...16class _CacheInfo(NamedTuple('CacheInfo', [17 ('hits', int),18 ('misses', int),19 ('maxsize', int),20 ('currsize', int)21])): ...22class _lru_cache_wrapper(Generic[_T]):23 __wrapped__: Callable[..., _T]24 def __call__(self, *args: Any, **kwargs: Any) -> _T: ...25 def cache_info(self) -> _CacheInfo: ...26 def cache_clear(self) -> None: ...27class lru_cache():28 def __init__(self, maxsize: Optional[int] = ..., typed: bool = ...) -> None: ...29 def __call__(self, f: Callable[..., _T]) -> _lru_cache_wrapper[_T]: ...30WRAPPER_ASSIGNMENTS: Sequence[str]31WRAPPER_UPDATES: Sequence[str]32def update_wrapper(wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ...,33 updated: Sequence[str] = ...) -> _AnyCallable: ...34def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_AnyCallable], _AnyCallable]: ...35def total_ordering(cls: type) -> type: ...36def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ...37@overload38def partial(__func: Callable[[_T], _S], __arg: _T) -> Callable[[], _S]: ...39@overload40def partial(__func: Callable[[_T, _T2], _S], __arg: _T) -> Callable[[_T2], _S]: ...41@overload42def partial(__func: Callable[[_T, _T2, _T3], _S], __arg: _T) -> Callable[[_T2, _T3], _S]: ...43@overload44def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg: _T) -> Callable[[_T2, _T3, _T4], _S]: ...45@overload46def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg: _T) -> Callable[[_T2, _T3, _T4, _T5], _S]: ...47@overload48def partial(__func: Callable[[_T, _T2], _S],49 __arg1: _T,50 __arg2: _T2) -> Callable[[], _S]: ...51@overload52def partial(__func: Callable[[_T, _T2, _T3], _S],53 __arg1: _T,54 __arg2: _T2) -> Callable[[_T3], _S]: ...55@overload56def partial(__func: Callable[[_T, _T2, _T3, _T4], _S],57 __arg1: _T,58 __arg2: _T2) -> Callable[[_T3, _T4], _S]: ...59@overload60def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],61 __arg1: _T,62 __arg2: _T2) -> Callable[[_T3, _T4, _T5], _S]: ...63@overload64def partial(__func: Callable[[_T, _T2, _T3], _S],65 __arg1: _T,66 __arg2: _T2,67 __arg3: _T3) -> Callable[[], _S]: ...68@overload69def partial(__func: Callable[[_T, _T2, _T3, _T4], _S],70 __arg1: _T,71 __arg2: _T2,72 __arg3: _T3) -> Callable[[_T4], _S]: ...73@overload74def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],75 __arg1: _T,76 __arg2: _T2,77 __arg3: _T3) -> Callable[[_T4, _T5], _S]: ...78@overload79def partial(__func: Callable[[_T, _T2, _T3, _T4], _S],80 __arg1: _T,81 __arg2: _T2,82 __arg3: _T3,83 __arg4: _T4) -> Callable[[], _S]: ...84@overload85def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],86 __arg1: _T,87 __arg2: _T2,88 __arg3: _T3,89 __arg4: _T4) -> Callable[[_T5], _S]: ...90@overload91def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],92 __arg1: _T,93 __arg2: _T2,94 __arg3: _T3,95 __arg4: _T4,96 __arg5: _T5) -> Callable[[], _S]: ...97@overload98def partial(__func: Callable[..., _S],99 *args: Any,100 **kwargs: Any) -> Callable[..., _S]: ...101# With protocols, this could change into a generic protocol that defines __get__ and returns _T102_Descriptor = Any103class partialmethod(Generic[_T]):104 func: Union[Callable[..., _T], _Descriptor]105 args: Tuple[Any, ...]106 keywords: Dict[str, Any]107 @overload108 def __init__(self, func: Callable[..., _T], *args: Any, **keywords: Any) -> None: ...109 @overload110 def __init__(self, func: _Descriptor, *args: Any, **keywords: Any) -> None: ...111 def __get__(self, obj: Any, cls: Type[Any]) -> Callable[..., _T]: ...112 @property113 def __isabstractmethod__(self) -> bool: ...114class _SingleDispatchCallable(Generic[_T]):115 registry: Mapping[Any, Callable[..., _T]]116 def dispatch(self, cls: Any) -> Callable[..., _T]: ...117 @overload118 def register(self, cls: Any) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...119 @overload120 def register(self, cls: Any, func: Callable[..., _T]) -> Callable[..., _T]: ...121 def _clear_cache(self) -> None: ...122 def __call__(self, *args: Any, **kwargs: Any) -> _T: ......
itertools.pyi
Source:itertools.pyi
1# Stubs for itertools2# Based on http://docs.python.org/3.2/library/itertools.html3from typing import (Iterator, TypeVar, Iterable, overload, Any, Callable, Tuple,4 Generic, Optional)5_T = TypeVar('_T')6_S = TypeVar('_S')7_N = TypeVar('_N', int, float)8Predicate = Callable[[_T], object]9def count(start: _N = ...,10 step: _N = ...) -> Iterator[_N]: ... # more general types?11def cycle(iterable: Iterable[_T]) -> Iterator[_T]: ...12@overload13def repeat(object: _T) -> Iterator[_T]: ...14@overload15def repeat(object: _T, times: int) -> Iterator[_T]: ...16def accumulate(iterable: Iterable[_T], func: Callable[[_T, _T], _T] = ...) -> Iterator[_T]: ...17class chain(Iterator[_T], Generic[_T]):18 def __init__(self, *iterables: Iterable[_T]) -> None: ...19 def __next__(self) -> _T: ...20 def __iter__(self) -> Iterator[_T]: ...21 @staticmethod22 def from_iterable(iterable: Iterable[Iterable[_S]]) -> Iterator[_S]: ...23def compress(data: Iterable[_T], selectors: Iterable[Any]) -> Iterator[_T]: ...24def dropwhile(predicate: Predicate[_T],25 iterable: Iterable[_T]) -> Iterator[_T]: ...26def filterfalse(predicate: Optional[Predicate[_T]],27 iterable: Iterable[_T]) -> Iterator[_T]: ...28@overload29def groupby(iterable: Iterable[_T], key: None = ...) -> Iterator[Tuple[_T, Iterator[_T]]]: ...30@overload31def groupby(iterable: Iterable[_T], key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ...32@overload33def islice(iterable: Iterable[_T], stop: Optional[int]) -> Iterator[_T]: ...34@overload35def islice(iterable: Iterable[_T], start: Optional[int], stop: Optional[int],36 step: Optional[int] = ...) -> Iterator[_T]: ...37def starmap(func: Callable[..., _S], iterable: Iterable[Iterable[Any]]) -> Iterator[_S]: ...38def takewhile(predicate: Predicate[_T],39 iterable: Iterable[_T]) -> Iterator[_T]: ...40def tee(iterable: Iterable[_T], n: int = ...) -> Tuple[Iterator[_T], ...]: ...41def zip_longest(*p: Iterable[Any],42 fillvalue: Any = ...) -> Iterator[Any]: ...43_T1 = TypeVar('_T1')44_T2 = TypeVar('_T2')45_T3 = TypeVar('_T3')46_T4 = TypeVar('_T4')47_T5 = TypeVar('_T5')48_T6 = TypeVar('_T6')49@overload50def product(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ...51@overload52def product(iter1: Iterable[_T1],53 iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ...54@overload55def product(iter1: Iterable[_T1],56 iter2: Iterable[_T2],57 iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ...58@overload59def product(iter1: Iterable[_T1],60 iter2: Iterable[_T2],61 iter3: Iterable[_T3],62 iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ...63@overload64def product(iter1: Iterable[_T1],65 iter2: Iterable[_T2],66 iter3: Iterable[_T3],67 iter4: Iterable[_T4],68 iter5: Iterable[_T5]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...69@overload70def product(iter1: Iterable[_T1],71 iter2: Iterable[_T2],72 iter3: Iterable[_T3],73 iter4: Iterable[_T4],74 iter5: Iterable[_T5],75 iter6: Iterable[_T6]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ...76@overload77def product(iter1: Iterable[Any],78 iter2: Iterable[Any],79 iter3: Iterable[Any],80 iter4: Iterable[Any],81 iter5: Iterable[Any],82 iter6: Iterable[Any],83 iter7: Iterable[Any],84 *iterables: Iterable[Any]) -> Iterator[Tuple[Any, ...]]: ...85@overload86def product(*iterables: Iterable[Any], repeat: int = ...) -> Iterator[Tuple[Any, ...]]: ...87def permutations(iterable: Iterable[_T],88 r: Optional[int] = ...) -> Iterator[Tuple[_T, ...]]: ...89def combinations(iterable: Iterable[_T],90 r: int) -> Iterator[Tuple[_T, ...]]: ...91def combinations_with_replacement(iterable: Iterable[_T],...
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!!