Skip to content

Commit 74a8081

Browse files
committed
Typo fixes
1 parent 1684675 commit 74a8081

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

pygorithm/binary/binary_utils.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,25 @@
44
"""
55

66

7-
def pad(value: str, return_type=str) -> """Pad binary value with zeros""":
7+
def pad(value, return_type):
8+
'''
9+
Pad binary value with zeros
10+
:param value: string
11+
:param return_type: string
12+
'''
13+
if type(value) is not str:
14+
raise TypeError("pad only accepts str, not {}".format(str(type(value))))
815
if len(value) % 4 != 0:
916
pad_amount = 4 - (len(value) % 4)
1017
return return_type(('0' * pad_amount) + value)
1118
else:
1219
return return_type(value)
1320

1421

15-
def to_string(binary_array: list, delimiter=' ') -> """Convert binary array to string""":
16-
return delimiter.join(binary_array)
22+
def to_string(binary_array, delimiter=' '):
23+
"""
24+
Convert binary array to string
25+
"""
26+
if type(binary_array) is not list:
27+
raise TypeError("to_string only accepts lists, not {}".format(str(type(value))))
28+
return delimiter.join(binary_array)

0 commit comments

Comments
 (0)