Skip to content

Commit

Permalink
Update stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
hwwhww committed May 12, 2021
1 parent db139c9 commit e3dbfbc
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 16 deletions.
8 changes: 7 additions & 1 deletion mypy_stubs/eth2spec/utils/ssz/ssz_impl.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
from remerkleable.basic import uint as uint
from remerkleable.byte_arrays import Bytes32
from remerkleable.core import View as View
from remerkleable.core import View
from typing import TypeVar

def serialize(obj: View) -> bytes: ...
def hash_tree_root(obj: View) -> Bytes32: ...
def uint_to_bytes(n: uint) -> bytes: ...
V = TypeVar('V', bound=View)

def copy(obj: V) -> V: ...
7 changes: 5 additions & 2 deletions mypy_stubs/eth2spec/utils/ssz/ssz_typing.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from remerkleable.basic import bit as bit, boolean as boolean, byte as byte, uint as uint, uint128 as uint128, uint16 as uint16, uint256 as uint256, uint32 as uint32, uint64 as uint64, uint8 as uint8
from remerkleable.bitfields import Bitlist as Bitlist, Bitvector as Bitvector
from remerkleable.byte_arrays import ByteList as ByteList, ByteVector as ByteVector, Bytes1 as Bytes1, Bytes32 as Bytes32, Bytes4 as Bytes4, Bytes48 as Bytes48, Bytes8 as Bytes8, Bytes96 as Bytes96
from remerkleable.byte_arrays import ByteList as ByteList, Bytes1 as Bytes1, Bytes32 as Bytes32, Bytes4 as Bytes4, Bytes48 as Bytes48, Bytes8 as Bytes8, Bytes96 as Bytes96
from remerkleable.complex import Container as Container, List as List, Vector as Vector
from remerkleable.core import BasicView as BasicView, TypeDef as TypeDef, View as View
from remerkleable.core import BasicView as BasicView, Path as Path, View as View
from typing import Any

Bytes20: Any
9 changes: 7 additions & 2 deletions mypy_stubs/remerkleable/complex.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,13 @@ class _ContainerLike:
def fields(cls: Any) -> Fields: ...
CV = TypeVar('CV', bound='Container')

class Container(ComplexView):
def __new__(cls: Any, *args: Any, backing: Optional[Node]=..., hook: Optional[ViewHook]=..., **kwargs: Any) -> Any: ...
class _ContainerBase(ComplexView):
def __new__(cls: Any, *args: Any, backing: Optional[Node]=..., hook: Optional[ViewHook]=..., append_nodes: Optional[PyList[Node]]=..., **kwargs: Any) -> Any: ...
@classmethod
def fields(cls: Any) -> Fields: ...

class Container(_ContainerBase):
def __new__(cls: Any, *args: Any, backing: Optional[Node]=..., hook: Optional[ViewHook]=..., append_nodes: Optional[PyList[Node]]=..., **kwargs: Any) -> Any: ...
def __init_subclass__(cls, *args: Any, **kwargs: Any) -> None: ...
@classmethod
def coerce_view(cls: Type[CV], v: Any) -> CV: ...
Expand Down
2 changes: 1 addition & 1 deletion mypy_stubs/remerkleable/core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ObjParseException(Exception): ...
class Path:
anchor: Type[View]
path: PyList[Tuple[Any, Type[View]]]
def __init__(self, anchor: Type[View], path: Optional[PyList[Tuple[Any, Type[View]]]]=...) -> Any: ...
def __init__(self, anchor: Type[View], path: Optional[PyList[Tuple[Any, Type[View]]]]=...) -> None: ...
@staticmethod
def from_raw_path(anchor: Type[View], path: PyList[Any]) -> Path: ...
def __truediv__(self, other: Any) -> Path: ...
Expand Down
12 changes: 6 additions & 6 deletions mypy_stubs/remerkleable/readonly_iters.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class BitfieldIter:
length: int
currentRoot: Root
stack: PyList[Optional[Node]]
def __init__(self, anchor: Node, depth: int, length: int) -> Any: ...
def __init__(self, anchor: Node, depth: int, length: int) -> None: ...
def __iter__(self) -> Any: ...
def __next__(self): ...

Expand All @@ -26,7 +26,7 @@ class PackedIter:
currentRoot: RootNode
elem_type: Type[BasicView]
stack: PyList[Optional[Node]]
def __init__(self, anchor: Node, depth: int, length: int, elem_type: Type[BasicView]) -> Any: ...
def __init__(self, anchor: Node, depth: int, length: int, elem_type: Type[BasicView]) -> None: ...
def __iter__(self) -> Any: ...
def __next__(self): ...

Expand All @@ -38,21 +38,21 @@ class NodeIter:
per_node: int
stack: PyList[Optional[Node]]
currentRoot: Any = ...
def __init__(self, anchor: Node, depth: int, length: int) -> Any: ...
def __init__(self, anchor: Node, depth: int, length: int) -> None: ...
def __iter__(self) -> Any: ...
def __next__(self): ...

class ComplexElemIter(NodeIter):
reused_view: View
def __init__(self, anchor: Node, depth: int, length: int, elem_type: Type[View]) -> Any: ...
def __init__(self, anchor: Node, depth: int, length: int, elem_type: Type[View]) -> None: ...
def __next__(self): ...

class ComplexFreshElemIter(NodeIter):
elem_type: Type[View]
def __init__(self, anchor: Node, depth: int, length: int, elem_type: Type[View]) -> Any: ...
def __init__(self, anchor: Node, depth: int, length: int, elem_type: Type[View]) -> None: ...
def __next__(self): ...

class ContainerElemIter(NodeIter):
elem_types: Sequence[Type[View]]
def __init__(self, anchor: Node, depth: int, elem_types: Sequence[Type[View]]) -> Any: ...
def __init__(self, anchor: Node, depth: int, elem_types: Sequence[Type[View]]) -> None: ...
def __next__(self): ...
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) -> None: ...
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) -> None: ...
def getter(self, target: Gindex) -> Node: ...
def is_leaf(self) -> bool: ...
def setter(self, target: Gindex, expand: bool=...) -> Link: ...
Expand Down
3 changes: 1 addition & 2 deletions mypy_stubs/remerkleable/virtual.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from remerkleable.tree import NavigationError as NavigationError, Node as Node, RebindableNode as RebindableNode, Root as Root
from typing import Any

class VirtualSource:
def get_left(self, key: Root) -> Node: ...
def get_right(self, key: Root) -> Node: ...
def is_leaf(self, key: Root) -> bool: ...

class VirtualNode(RebindableNode, Node):
def __init__(self, root: Root, src: VirtualSource) -> Any: ...
def __init__(self, root: Root, src: VirtualSource) -> None: ...
def get_left(self) -> Node: ...
def get_right(self) -> Node: ...
def is_leaf(self) -> bool: ...
Expand Down

0 comments on commit e3dbfbc

Please sign in to comment.