@@ -123,16 +123,14 @@ def emitter_converter(size_par, data):
123123 # Bit counter one for a given parity
124124 cont_bo = 0
125125 # counter to control the loop reading
126- cont_loop = 0
127- for x in data_ord :
126+ for cont_loop , x in enumerate (data_ord ):
128127 if x is not None :
129128 try :
130129 aux = (bin_pos [cont_loop ])[- 1 * (bp )]
131130 except IndexError :
132131 aux = "0"
133132 if aux == "1" and x == "1" :
134133 cont_bo += 1
135- cont_loop += 1
136134 parity .append (cont_bo % 2 )
137135
138136 qtd_bp += 1
@@ -164,21 +162,20 @@ def receptor_converter(size_par, data):
164162 parity_received = []
165163 data_output = []
166164
167- for x in range ( 1 , len ( data ) + 1 ):
165+ for i , item in enumerate ( data , 1 ):
168166 # Performs a template of bit positions - who should be given,
169167 # and who should be parity
170- if qtd_bp < size_par and (np .log (x ) / np .log (2 )).is_integer ():
168+ if qtd_bp < size_par and (np .log (i ) / np .log (2 )).is_integer ():
171169 data_out_gab .append ("P" )
172170 qtd_bp = qtd_bp + 1
173171 else :
174172 data_out_gab .append ("D" )
175173
176174 # Sorts the data to the new output size
177175 if data_out_gab [- 1 ] == "D" :
178- data_output .append (data [ cont_data ] )
176+ data_output .append (item )
179177 else :
180- parity_received .append (data [cont_data ])
181- cont_data += 1
178+ parity_received .append (item )
182179
183180 # -----------calculates the parity with the data
184181 data_out = []
@@ -215,17 +212,14 @@ def receptor_converter(size_par, data):
215212 for bp in range (1 , size_par + 1 ):
216213 # Bit counter one for a certain parity
217214 cont_bo = 0
218- # Counter to control loop reading
219- cont_loop = 0
220- for x in data_ord :
215+ for cont_loop , x in enumerate (data_ord ):
221216 if x is not None :
222217 try :
223218 aux = (bin_pos [cont_loop ])[- 1 * (bp )]
224219 except IndexError :
225220 aux = "0"
226221 if aux == "1" and x == "1" :
227222 cont_bo += 1
228- cont_loop += 1
229223 parity .append (str (cont_bo % 2 ))
230224
231225 qtd_bp += 1
0 commit comments