Skip to content

Commit

Permalink
Tipagem nos parâmetros de alguns métodos
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarofpp committed Mar 27, 2019
1 parent 8702f92 commit cd0771c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions validate_docbr/CNPJ.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self):
self.weights_first = list(range(5, 1, -1)) + list(range(9, 1, -1))
self.weights_second = list(range(6, 1, -1)) + list(range(9, 1, -1))

def validate(self, doc: str) -> bool:
def validate(self, doc: str = '') -> bool:
"""Validar CNPJ."""
doc = self._only_digits(doc)

Expand All @@ -38,7 +38,7 @@ def generate(self, mask: bool = False) -> str:

return self.mask(cnpj) if mask else cnpj

def mask(self, doc: str) -> str:
def mask(self, doc: str = '') -> str:
"""Coloca a máscara de CNPJ na variável doc."""
return "{}.{}.{}/{}-{}".format(doc[:2], doc[2:5], doc[5:8], doc[8:12], doc[-2:])

Expand Down
4 changes: 2 additions & 2 deletions validate_docbr/CNS.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __init__(self):
self.digits = list(range(10))
self.first_digit = [1, 2, 7, 8, 9]

def validate(self, doc: str) -> bool:
def validate(self, doc: str = '') -> bool:
"""Validar CNS."""
doc = list(self._only_digits(doc))

Expand Down Expand Up @@ -45,7 +45,7 @@ def generate(self, mask: bool = False) -> str:

return self.mask(cns) if mask else cns

def mask(self, doc: str) -> str:
def mask(self, doc: str = '') -> str:
"""Coloca a máscara de CPF na variável doc."""
return "{} {} {} {}".format(doc[:3], doc[3:7], doc[7:11], doc[-4:])

Expand Down
4 changes: 2 additions & 2 deletions validate_docbr/CPF.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CPF(BaseDoc):
def __init__(self):
self.digits = list(range(10))

def validate(self, doc: str) -> bool:
def validate(self, doc: str = '') -> bool:
"""Validar CPF."""
doc = list(self._only_digits(doc))

Expand All @@ -31,7 +31,7 @@ def generate(self, mask: bool = False) -> str:

return self.mask(cpf) if mask else cpf

def mask(self, doc: str) -> str:
def mask(self, doc: str = '') -> str:
"""Coloca a máscara de CPF na variável doc."""
return "{}.{}.{}-{}".format(doc[:3], doc[3:6], doc[6:9], doc[-2:])

Expand Down

0 comments on commit cd0771c

Please sign in to comment.