Skip to content

Commit 0c36f5d

Browse files
committed
avoided unnecessary type casting
1 parent d535741 commit 0c36f5d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

string_utils/generation.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from uuid import uuid4
1717

1818
from .manipulation import roman_encode
19-
from .validation import is_integer
2019

2120

2221
def uuid(as_hex: bool = False) -> str:
@@ -51,7 +50,7 @@ def random_string(size: int) -> str:
5150
:type size: int
5251
:return: Random string
5352
"""
54-
if not is_integer(str(size)) or size < 1:
53+
if not isinstance(size, int) or size < 1:
5554
raise ValueError('size must be >= 1')
5655

5756
chars = string.ascii_letters + string.digits
@@ -76,7 +75,7 @@ def secure_random_hex(byte_count: int) -> str:
7675
:type byte_count: int
7776
:return: Hexadecimal string representation of generated random bytes
7877
"""
79-
if not is_integer(str(byte_count)) or byte_count < 1:
78+
if not isinstance(byte_count, int) or byte_count < 1:
8079
raise ValueError('byte_count must be >= 1')
8180

8281
random_bytes = os.urandom(byte_count)

0 commit comments

Comments
 (0)