-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
108 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
from zope.interface.declarations import Declaration as Declaration, alsoProvides as alsoProvides, classImplements as classImplements, classImplementsFirst as classImplementsFirst, classImplementsOnly as classImplementsOnly, directlyProvidedBy as directlyProvidedBy, directlyProvides as directlyProvides, implementedBy as implementedBy, implementer as implementer, implementer_only as implementer_only, moduleProvides as moduleProvides, noLongerProvides as noLongerProvides, providedBy as providedBy, provider as provider | ||
from zope.interface.interface import Attribute as Attribute, Interface as Interface, interfacemethod as interfacemethod, invariant as invariant, taggedValue as taggedValue | ||
from zope.interface.exceptions import Invalid as Invalid, DoesNotImplement as DoesNotImplement, BrokenImplementation as BrokenImplementation, Inval | ||
from zope.interface import adapter as adapter | ||
from zope.interface import advice as advice | ||
from zope.interface import interfaces as interfaces | ||
from zope.interface import declarations as declarations | ||
from zope.interface import document as document | ||
from zope.interface import exceptions as exceptions | ||
from zope.interface import verify as verify | ||
from zope.interface import ro as ro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,54 @@ | ||
from _typeshed import Incomplete | ||
from zope.interface import Interface as Interface | ||
from zope.interface.common import collections as collections | ||
|
||
class IItemMapping(Interface): | ||
def __getitem__(key) -> None: ... | ||
|
||
class IReadMapping(collections.IContainer, IItemMapping): | ||
def get(key, default: Incomplete | None = ...) -> None: ... | ||
def __contains__(key) -> bool: ... | ||
|
||
class IWriteMapping(Interface): | ||
def __delitem__(key) -> None: ... | ||
def __setitem__(key, value) -> None: ... | ||
|
||
class IEnumerableMapping(collections.ISized, IReadMapping): | ||
def keys() -> None: ... | ||
def __iter__(): ... | ||
def values() -> None: ... | ||
def items() -> None: ... | ||
|
||
class IMapping(IWriteMapping, IEnumerableMapping): ... | ||
class IIterableMapping(IEnumerableMapping): ... | ||
# Stubs for zope.interface.common.mapping (Python 3.6) | ||
# | ||
# NOTE: This dynamically typed stub was automatically generated by stubgen. | ||
|
||
from typing import Any, Optional, Union, TypeVar, Generic, Iterable, Iterator, overload | ||
from zope.interface import Interface | ||
|
||
T = TypeVar('T') | ||
KT = TypeVar('KT') | ||
VT = TypeVar('VT') | ||
|
||
class IItemMapping(Interface, Generic[KT, VT]): | ||
def __getitem__(key: KT) -> VT: ... | ||
|
||
class IReadMapping(IItemMapping[KT, VT]): | ||
@overload | ||
def get(self, k: KT) -> Optional[VT]: ... | ||
@overload | ||
def get(self, k: KT, default: Union[VT, T]) -> Union[VT, T]: ... | ||
# def get(key: KT, default: Optional[VT] = ...) -> VT: ... | ||
def __contains__(key: KT) -> bool: ... | ||
|
||
class IWriteMapping(Interface, Generic[KT, VT]): | ||
def __delitem__(key: KT) -> None: ... | ||
def __setitem__(key: KT, value: VT) -> None: ... | ||
|
||
class IEnumerableMapping(IReadMapping[KT, VT]): | ||
def keys() -> Iterable[KT]: ... | ||
def __iter__() -> Iterator[VT]: ... | ||
def values() -> Iterable[VT]: ... | ||
def items() -> Iterable[tuple[KT, VT]]: ... | ||
def __len__() -> int: ... | ||
|
||
class IMapping(IWriteMapping[KT, VT], IEnumerableMapping[KT, VT]): ... | ||
|
||
class IIterableMapping(IEnumerableMapping[KT, VT]): | ||
def iterkeys() -> Iterable[KT]: ... | ||
def itervalues() -> Iterable[VT]: ... | ||
def iteritems() -> Iterable[tuple[KT, VT]]: ... | ||
|
||
class IClonableMapping(Interface): | ||
def copy() -> None: ... | ||
def copy() -> IClonableMapping: ... | ||
|
||
class IExtendedReadMapping(IIterableMapping): ... | ||
class IExtendedReadMapping(IIterableMapping[KT, VT]): | ||
def has_key(key: KT) -> bool: ... | ||
|
||
class IExtendedWriteMapping(IWriteMapping): | ||
class IExtendedWriteMapping(IWriteMapping[KT, VT]): | ||
def clear() -> None: ... | ||
def update(d) -> None: ... | ||
def setdefault(key, default: Incomplete | None = ...) -> None: ... | ||
def pop(k, default: Incomplete | None = ...) -> None: ... | ||
def popitem() -> None: ... | ||
def update(d: Any) -> None: ... | ||
def setdefault(key: KT, default: Optional[VT] = ...) -> None: ... | ||
def pop(k: KT, *args: Any) -> None: ... | ||
def popitem() -> VT: ... | ||
|
||
class IFullMapping(collections.IMutableMapping, IExtendedReadMapping, IExtendedWriteMapping, IClonableMapping, IMapping): ... | ||
class IFullMapping(IExtendedReadMapping[KT, VT], IExtendedWriteMapping[KT, VT], IClonableMapping[KT, VT], IMapping[KT, VT]): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"""Override a sequence interface""" | ||
|
||
from zope.interface.common import sequence | ||
|
||
class ICustomSequence(sequence.IFiniteSequence): | ||
def iterator(first, count): | ||
pass | ||
|
||
def size() -> int: | ||
pass | ||
|
||
seq = object() | ||
assert ICustomSequence.providedBy(seq) | ||
reveal_type(seq.size()) | ||
|
||
""" | ||
<output> | ||
custom_sequence.py:14: note: Revealed type is "builtins.int" | ||
</output> | ||
""" |