From 3b5c7f243a4ec6555ea9f762411c8541f7c20e3a Mon Sep 17 00:00:00 2001 From: protolambda Date: Tue, 25 Jun 2019 19:32:49 +0200 Subject: [PATCH] type hint uint input --- test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py b/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py index 6079f2866..58e66ca68 100644 --- a/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py +++ b/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py @@ -34,7 +34,7 @@ class BasicValue(int, SSZValue, metaclass=BasicType): class Bool(BasicValue): # can't subclass bool. byte_len = 1 - def __new__(cls, value, *args, **kwargs): + def __new__(cls, value: int): # int value, but can be any subclass of int (bool, Bit, Bool, etc...) if value < 0 or value > 1: raise ValueError(f"value {value} out of bounds for bit") return super().__new__(cls, value) @@ -54,7 +54,7 @@ class Bit(Bool): class uint(BasicValue, metaclass=BasicType): - def __new__(cls, value, *args, **kwargs): + def __new__(cls, value: int): if value < 0: raise ValueError("unsigned types must not be negative") if cls.byte_len and value.bit_length() > (cls.byte_len << 3):