commit 16741c6c6206b0e5673076896c38258bc6232983
parent 4494bf978f1abe4ce996a72c79aed4a04fbfd57a
Author: nolash <dev@holbrook.no>
Date: Fri, 26 Mar 2021 13:07:24 +0100
Allow empty string to strip_0x when allow empty
Diffstat:
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/hexathon/parse.py b/hexathon/parse.py
@@ -24,7 +24,9 @@ def uniform(hx):
def strip_0x(hx, allow_empty=False):
- if len(hx) < 2:
+ if len(hx) == 0 and not allow_empty:
+ raise ValueError('invalid hex')
+ elif len(hx) < 2:
raise ValueError('invalid hex')
if hx[:2] == '0x':
hx = hx[2:]
diff --git a/setup.cfg b/setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = hexathon
-version = 0.0.1a5
+version = 0.0.1a6
description = Common and uncommon hex string operations
author = Louis Holbrook
author_email = dev@holbrook.no