Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions hexbytes/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Tuple,
Type,
Union,
cast,
overload,
)

Expand All @@ -31,9 +30,9 @@ class HexBytes(bytes):
3. ``to_0x_hex`` returns a 0x-prefixed hex string
"""

def __new__(cls: Type[bytes], val: BytesLike) -> "HexBytes":
def __new__(cls, val: BytesLike) -> "HexBytes":
bytesval = to_bytes(val)
return cast(HexBytes, super().__new__(cls, bytesval)) # type: ignore # https://github.com/python/typeshed/issues/2630 # noqa: E501
return super().__new__(cls, bytesval)

@overload
def __getitem__(self, key: "SupportsIndex") -> int: # noqa: F811
Expand Down
1 change: 1 addition & 0 deletions newsfragments/55.performance.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
remove redundant cast in __new__