Skip to content

Instantly share code, notes, and snippets.

@wiml
Created August 7, 2019 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wiml/610be1d9d507143b6fc796b4e8fdf889 to your computer and use it in GitHub Desktop.
Save wiml/610be1d9d507143b6fc796b4e8fdf889 to your computer and use it in GitHub Desktop.
A proposed type stub file for twisted/constantly
import typing, typing_extensions
from typing import Any, Container, Iterable, Iterator
__version__ : str
__author__ : str
__license__ : str
__copyright__ : str
Tv = typing.TypeVar('Tv')
class NamedConstant:
name: str
def __lt__(self, other: NamedConstant) -> bool: ...
def __le__(self, other: NamedConstant) -> bool: ...
def __gt__(self, other: NamedConstant) -> bool: ...
def __ge__(self, other: NamedConstant) -> bool: ...
class ValueConstant (typing.Generic[Tv]):
name: str
value: Tv
def __lt__(self, other: ValueConstant[Tv]) -> bool: ...
def __le__(self, other: ValueConstant[Tv]) -> bool: ...
def __gt__(self, other: ValueConstant[Tv]) -> bool: ...
def __ge__(self, other: ValueConstant[Tv]) -> bool: ...
class FlagConstant (Container[FlagConstant], Iterable[FlagConstant]):
name: str
value: int
def __lt__(self, other: FlagConstant) -> bool: ...
def __le__(self, other: FlagConstant) -> bool: ...
def __gt__(self, other: FlagConstant) -> bool: ...
def __ge__(self, other: FlagConstant) -> bool: ...
def __or__(self, other: FlagConstant) -> FlagConstant: ...
def __and__(self, other: FlagConstant) -> FlagConstant: ...
def __xor__(self, other: FlagConstant) -> FlagConstant: ...
def __invert__(self) -> FlagConstant: ...
def __contains__(self, other: Any) -> bool: ...
def __iter__(self) -> Iterator[FlagConstant]: ...
def __nonzero__(self) -> bool: ...
def __bool__(self) -> bool: ...
Tnc = typing.TypeVar('Tnc', bound=NamedConstant)
class Names (typing.Generic[Tnc]):
@classmethod
def lookupByName(cls, name: str) -> Tnc: ...
@classmethod
def iterconstants(cls) -> Iterator[Tnc]: ...
def __contains__(self, other: Tnc) -> bool: ...
Tvc = typing.TypeVar('Tvc', bound=ValueConstant[Any])
class Values (typing.Generic[Tvc]):
@classmethod
def lookupByName(cls, name: str) -> Tvc: ...
@classmethod
def lookupByValue(cls, value: Tv) -> Tvc: ...
@classmethod
def iterconstants(cls) -> Iterator[Tvc]: ...
def __contains__(self, other: Tvc) -> bool: ...
Tfc = typing.TypeVar('Tfc', bound=FlagConstant)
class Flags (typing.Generic[Tfc]):
@classmethod
def lookupByName(cls, name: str) -> Tfc: ...
@classmethod
def iterconstants(cls) -> Iterator[Tfc]: ...
def __contains__(self, other: Tfc) -> bool: ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment