File: UserDict.pyi

package info (click to toggle)
mypy 0.470-complete-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,864 kB
  • ctags: 3,264
  • sloc: python: 21,838; makefile: 18
file content (38 lines) | stat: -rw-r--r-- 1,442 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from typing import (Any, Container, Dict, Generic, Iterable, Iterator, List,
                    Mapping, Sized, Tuple, TypeVar, overload)

_KT = TypeVar('_KT')
_VT = TypeVar('_VT')

class UserDict(Dict[_KT, _VT], Generic[_KT, _VT]):
    data = ...  # type: Mapping[_KT, _VT]

    def __init__(self, initialdata: Mapping[_KT, _VT] = ...) -> None: ...

    # TODO: __iter__ is not available for UserDict

class IterableUserDict(UserDict[_KT, _VT], Generic[_KT, _VT]):
    ...

class DictMixin(Sized, Iterable[_KT], Container[_KT], Generic[_KT, _VT]):
    def has_key(self, key: _KT) -> bool: ...

    # From  typing.Mapping[_KT, _VT]
    # (can't inherit because of keys())
    def get(self, k: _KT, default: _VT = ...) -> _VT: ...
    def values(self) -> List[_VT]: ...
    def items(self) -> List[Tuple[_KT, _VT]]: ...
    def iterkeys(self) -> Iterator[_KT]: ...
    def itervalues(self) -> Iterator[_VT]: ...
    def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ...
    def __contains__(self, o: Any) -> bool: ...

    # From typing.MutableMapping[_KT, _VT]
    def clear(self) -> None: ...
    def pop(self, k: _KT, default: _VT = ...) -> _VT: ...
    def popitem(self) -> Tuple[_KT, _VT]: ...
    def setdefault(self, k: _KT, default: _VT = ...) -> _VT: ...
    @overload
    def update(self, m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
    @overload
    def update(self, m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...