Skip to content

Commit cd59507

Browse files
camilotmundimcamilomundimniltonpimentel02
authored
docs: migração de type hints para anotações modernas (#637)
* migração de type hints para anotações modernas * Update CHANGELOG.md Atualizando mudanças no CHANGELOG --------- Co-authored-by: camilomundim <camilomundim@tjro.jus.br> Co-authored-by: Nilton Pimentel <63605485+niltonpimentel02@users.noreply.github.com>
1 parent b5eda0c commit cd59507

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- Utilitário `convert_name_to_uf`
1313

14+
### Fixed
15+
16+
- Suporte a anotações modernas no `brutils/cep.py` [#637](https://github.com/brazilian-utils/python/pull/637)
17+
1418
## [2.3.0] - 2025-10-07
1519

1620
### Added

brutils/cep.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
############
1212

1313

14-
def remove_symbols(dirty): # type: (str) -> str
14+
def remove_symbols(dirty: str) -> str:
1515
"""
1616
Removes specific symbols from a given CEP (Postal Code).
1717
@@ -34,7 +34,7 @@ def remove_symbols(dirty): # type: (str) -> str
3434
return "".join(filter(lambda char: char not in ".-", dirty))
3535

3636

37-
def format_cep(cep): # type: (str) -> str | None
37+
def format_cep(cep: str) -> str | None:
3838
"""
3939
Formats a Brazilian CEP (Postal Code) into a standard format.
4040
@@ -62,7 +62,7 @@ def format_cep(cep): # type: (str) -> str | None
6262
############
6363

6464

65-
def is_valid(cep): # type: (str) -> bool
65+
def is_valid(cep: str) -> bool:
6666
"""
6767
Checks if a CEP (Postal Code) is valid.
6868
@@ -92,7 +92,7 @@ def is_valid(cep): # type: (str) -> bool
9292
return isinstance(cep, str) and len(cep) == 8 and cep.isdigit()
9393

9494

95-
def generate(): # type: () -> str
95+
def generate() -> str:
9696
"""
9797
Generates a random 8-digit CEP (Postal Code) number as a string.
9898
@@ -113,7 +113,9 @@ def generate(): # type: () -> str
113113

114114

115115
# Reference: https://viacep.com.br/
116-
def get_address_from_cep(cep, raise_exceptions=False): # type: (str, bool) -> Address | None
116+
def get_address_from_cep(
117+
cep: str, raise_exceptions: bool = False
118+
) -> Address | None:
117119
"""
118120
Fetches address information from a given CEP (Postal Code) using the ViaCEP API.
119121
@@ -181,8 +183,8 @@ def get_address_from_cep(cep, raise_exceptions=False): # type: (str, bool) -> A
181183

182184

183185
def get_cep_information_from_address(
184-
federal_unit, city, street, raise_exceptions=False
185-
): # type: (str, str, str, bool) -> list[Address] | None
186+
federal_unit: str, city: str, street: str, raise_exceptions: bool = False
187+
) -> list[Address] | None:
186188
"""
187189
Fetches CEP (Postal Code) options from a given address using the ViaCEP API.
188190

0 commit comments

Comments
 (0)