mardi 6 octobre 2020

flake8 (E902) TokenError in python format

I dont understand why i got a E902 flake8 Error. The code is as follows:

def mi_func(x):

# Asignar los valores a una lista
lista_massn = x['MASSN'].values.tolist()
lista_flag = x['UFLAG'].values.tolist()

# Obtener los valores unicos
unique_list_massn = unique_values(lista_massn)
unique_list_flag = unique_values(lista_flag

# Reglas de negocio para indicar desviaciones
if (
        (len(unique_list_massn) == 1)
        & (unique_list_massn[0] == 'XE')
        & (max(unique_list_flag) == 0)):
    result = True
else:
    result = False

return result

I think the problem is in the "if/else" statement. I put the condition in several lines in order to satisfy the numbre of character <80 (flake8 E501). Is there a way to put this "if/else" statement satifaying the both flake8 rules (flake8 E501 and E902)? Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire