File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 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 )
You can’t perform that action at this time.
0 commit comments