Skip to content

Commit 8b16800

Browse files
authored
Merge pull request primal100#43 from primal100/support_bytes_in_is_hex
Support bytes in is_hex
2 parents c86372a + 31cf350 commit 8b16800

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cryptos/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,7 @@ async def alist(generator: AsyncGenerator[Any, None]) -> List[Any]:
4343

4444

4545
def is_hex(text: str) -> Optional[Match[AnyStr]]:
46-
return re.match('^[0-9a-fA-F]*$', text)
46+
regex = '^[0-9a-fA-F]*$'
47+
if isinstance(text, bytes):
48+
regex = regex.encode()
49+
return re.match(regex, text)

0 commit comments

Comments
 (0)