Skip to content

Commit

Permalink
mypy_stubs WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
hwwhww committed Apr 23, 2020
1 parent 5bbbf4f commit d6aba34
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 20 deletions.
Empty file added mypy_stubs/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions mypy_stubs/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Stubs for remerkleable (Python 3)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

8 changes: 4 additions & 4 deletions mypy_stubs/remerkleable/basic.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ V = TypeVar('V', bound=View)
class boolean(int, BasicView):
def encode_bytes(self) -> bytes: ...
def __new__(cls: Any, value: int) -> Any: ...
def __bool__(self): ...
def __bool__(self) -> None: ...
@classmethod
def coerce_view(cls: Type[V], v: Any) -> V: ...
@classmethod
Expand All @@ -17,9 +17,9 @@ class boolean(int, BasicView):
def type_repr(cls: Any) -> str: ...

class uint(int, BasicView):
def __new__(cls: Any, value: int) -> Any: ...
def __add__(self, other: Any): ...
def __sub__(self, other: Any): ...
def __new__(cls: Any, value: int) -> Type[V]: ...
def __add__(self, other: Any) -> "uint": ...
def __sub__(self, other: Any) -> "uint": ...
@classmethod
def coerce_view(cls: Type[V], v: Any) -> V: ...
@classmethod
Expand Down
8 changes: 4 additions & 4 deletions mypy_stubs/remerkleable/bitfields.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ class BitsView(BackedView, ColSequence):
def length(self) -> int: ...
def get(self, i: int) -> boolean: ...
def set(self, i: int, v: boolean) -> None: ...
def __len__(self): ...
def __len__(self) -> int: ...
def __iter__(self) -> Any: ...
def __getitem__(self, k: Any): ...
def __getitem__(self, k: Any) -> Any: ...
def __setitem__(self, k: Any, v: Any) -> None: ...
def encode_bytes(self) -> bytes: ...
@classmethod
def decode_bytes(cls: Type[V], bytez: bytes) -> V: ...
def navigate_view(self, key: Any) -> View: ...

class Bitlist(BitsView):
def __new__(cls, *args: Any, **kwargs: Any): ...
def __new__(cls, *args: Any, **kwargs: Any) -> "Bitlist": ...
def __class_getitem__(cls: Any, limit: Any) -> Type[Bitlist]: ...
@classmethod
def contents_depth(cls: Any) -> int: ...
Expand Down Expand Up @@ -59,7 +59,7 @@ class Bitlist(BitsView):
def key_to_static_gindex(cls: Any, key: Any) -> Gindex: ...

class Bitvector(BitsView, FixedByteLengthViewHelper):
def __new__(cls, *args: Any, **kwargs: Any): ...
def __new__(cls, *args: Any, **kwargs: Any) -> "Bitvector": ...
def __class_getitem__(cls: Any, length: Any) -> Type[Bitvector]: ...
@classmethod
def tree_depth(cls: Any) -> int: ...
Expand Down
8 changes: 4 additions & 4 deletions mypy_stubs/remerkleable/byte_arrays.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from typing import Any, BinaryIO, Optional, Type, TypeVar
V = TypeVar('V', bound=View)

class RawBytesView(bytes, View):
def __new__(cls, *args: Any, **kwargs: Any): ...
def __new__(cls, *args: Any, **kwargs: Any) -> "RawBytesView": ...
@classmethod
def default_bytes(cls: Any) -> bytes: ...
@classmethod
Expand All @@ -20,10 +20,10 @@ class RawBytesView(bytes, View):
def navigate_view(self, key: Any) -> View: ...

class ByteVector(RawBytesView, FixedByteLengthViewHelper, View):
def __new__(cls, *args: Any, **kwargs: Any): ...
def __new__(cls, *args: Any, **kwargs: Any) -> "ByteVector": ...
def __class_getitem__(cls: Any, length: Any) -> Type[ByteVector]: ...
@classmethod
def vector_length(cls): ...
def vector_length(cls) -> int: ...
@classmethod
def default_bytes(cls: Any) -> bytes: ...
@classmethod
Expand All @@ -44,7 +44,7 @@ Bytes48: Any
Bytes96: Any

class ByteList(RawBytesView, FixedByteLengthViewHelper, View):
def __new__(cls, *args: Any, **kwargs: Any): ...
def __new__(cls, *args: Any, **kwargs: Any) -> "ByteList": ...
def __class_getitem__(cls: Any, limit: Any) -> Type[ByteList]: ...
@classmethod
def limit(cls: Any) -> int: ...
Expand Down
12 changes: 6 additions & 6 deletions mypy_stubs/remerkleable/complex.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MonoSubtreeView(ColSequence, ComplexView):
@classmethod
def is_valid_count(cls: Any, count: int) -> bool: ...
def __iter__(self) -> Any: ...
def readonly_iter(self): ...
def readonly_iter(self) -> Any: ...
@classmethod
def deserialize(cls: Type[V], stream: BinaryIO, scope: int) -> V: ...
def serialize(self, stream: BinaryIO) -> int: ...
Expand All @@ -39,9 +39,9 @@ class MonoSubtreeView(ColSequence, ComplexView):
@classmethod
def key_to_static_gindex(cls: Any, key: Any) -> Gindex: ...
def navigate_view(self, key: Any) -> View: ...
def __len__(self): ...
def __add__(self, other: Any): ...
def __getitem__(self, k: Any): ...
def __len__(self) -> int: ...
def __add__(self, other: Any) -> Any: ...
def __getitem__(self, k: Any) -> Any: ...
def __setitem__(self, k: Any, v: Any) -> None: ...

class List(MonoSubtreeView):
Expand Down Expand Up @@ -117,7 +117,7 @@ class _ContainerLike:
def fields(cls: Any) -> Fields: ...

class Container(ComplexView):
def __new__(cls: Any, *args: Any, backing: Optional[Node]=..., hook: Optional[ViewHook]=..., **kwargs: Any) -> Any: ...
def __new__(cls: Any, *args: Any, backing: Optional[Node]=..., hook: Optional[ViewHook]=..., **kwargs: Any) -> "Container": ...
@classmethod
def coerce_view(cls: Type[V], v: Any) -> V: ...
@classmethod
Expand All @@ -139,7 +139,7 @@ class Container(ComplexView):
@classmethod
def default_node(cls: Any) -> Node: ...
def value_byte_length(self) -> int: ...
def __getattr__(self, item: Any): ...
def __getattr__(self, item: Any) -> Any: ...
def __setattr__(self, key: Any, value: Any) -> None: ...
@classmethod
def type_repr(cls: Any) -> str: ...
Expand Down
1 change: 1 addition & 0 deletions mypy_stubs/remerkleable/core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class BackedView(View, TypeDef):
def __new__(cls: Any, backing: Optional[Node]=..., hook: Optional[ViewHook[V]]=..., **kwargs: Any) -> Any: ...
def get_backing(self) -> Node: ...
def set_backing(self, value: Any) -> None: ...

BV = TypeVar('BV', bound='BasicView')

class BasicTypeDef(TypeDef):
Expand Down
4 changes: 2 additions & 2 deletions mypy_stubs/remerkleable/tree.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class RebindableNode(Node):
class PairNode(RebindableNode, Node):
left: Node
right: Node
def __init__(self, left: Node, right: Node) -> Any: ...
def __init__(self, left: Node, right: Node): ...
def get_left(self) -> Node: ...
def get_right(self) -> Node: ...
def is_leaf(self) -> bool: ...
Expand All @@ -63,7 +63,7 @@ def subtree_fill_to_length(bottom: Node, depth: int, length: int) -> Node: ...
def subtree_fill_to_contents(nodes: List[Node], depth: int) -> Node: ...

class RootNode(Node):
def __init__(self, root: Root) -> Any: ...
def __init__(self, root: Root): ...
def getter(self, target: Gindex) -> Node: ...
def is_leaf(self) -> bool: ...
def setter(self, target: Gindex, expand: bool=...) -> Link: ...
Expand Down

0 comments on commit d6aba34

Please sign in to comment.