Skip to content

Commit

Permalink
Adicionada constante CPF_LENGHT para melhor leitura do código
Browse files Browse the repository at this point in the history
  • Loading branch information
vmagueta committed Oct 29, 2024
1 parent dba3ad4 commit 831aead
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions brutils/cpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,13 @@ def remove_symbols_cpf(cpf: str) -> str:
>>> remove_symbols_cpf('000.111.222-333')
None
"""
CPF_LENGHT = 11

result = None
cpf_no_symbols = ""
if isinstance(cpf, str) and cpf != "":
cpf_no_symbols = "".join([char for char in cpf if char not in ".-"])
if not cpf:
return None

if len(cpf_no_symbols) == 11:
result = cpf_no_symbols
if isinstance(cpf, str) and cpf != "":
cpf_no_symbols = "".join([char for char in cpf if char.isalnum()])

return result
if len(cpf_no_symbols) == CPF_LENGHT:
return cpf_no_symbols

0 comments on commit 831aead

Please sign in to comment.