From 929a5a9d66eb8cf025d8d117744689ba9445bb43 Mon Sep 17 00:00:00 2001 From: camilomundim Date: Mon, 27 Oct 2025 10:11:17 -0400 Subject: [PATCH 1/2] =?UTF-8?q?migra=C3=A7=C3=A3o=20=20de=20type=20hints?= =?UTF-8?q?=20para=20anota=C3=A7=C3=B5es=20modernas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- brutils/cep.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/brutils/cep.py b/brutils/cep.py index 89892ec2..6e27ddea 100644 --- a/brutils/cep.py +++ b/brutils/cep.py @@ -11,7 +11,7 @@ ############ -def remove_symbols(dirty): # type: (str) -> str +def remove_symbols(dirty: str) -> str: """ Removes specific symbols from a given CEP (Postal Code). @@ -34,7 +34,7 @@ def remove_symbols(dirty): # type: (str) -> str return "".join(filter(lambda char: char not in ".-", dirty)) -def format_cep(cep): # type: (str) -> str | None +def format_cep(cep: str) -> str | None: """ Formats a Brazilian CEP (Postal Code) into a standard format. @@ -62,7 +62,7 @@ def format_cep(cep): # type: (str) -> str | None ############ -def is_valid(cep): # type: (str) -> bool +def is_valid(cep: str) -> bool: """ Checks if a CEP (Postal Code) is valid. @@ -92,7 +92,7 @@ def is_valid(cep): # type: (str) -> bool return isinstance(cep, str) and len(cep) == 8 and cep.isdigit() -def generate(): # type: () -> str +def generate() -> str: """ Generates a random 8-digit CEP (Postal Code) number as a string. @@ -113,7 +113,9 @@ def generate(): # type: () -> str # Reference: https://viacep.com.br/ -def get_address_from_cep(cep, raise_exceptions=False): # type: (str, bool) -> Address | None +def get_address_from_cep( + cep: str, raise_exceptions: bool = False +) -> Address | None: """ Fetches address information from a given CEP (Postal Code) using the ViaCEP API. @@ -181,8 +183,8 @@ def get_address_from_cep(cep, raise_exceptions=False): # type: (str, bool) -> A def get_cep_information_from_address( - federal_unit, city, street, raise_exceptions=False -): # type: (str, str, str, bool) -> list[Address] | None + federal_unit: str, city: str, street: str, raise_exceptions: bool = False +) -> list[Address] | None: """ Fetches CEP (Postal Code) options from a given address using the ViaCEP API. From b2a7304a4ad7502a702054fde507e6f29d3c9316 Mon Sep 17 00:00:00 2001 From: Camilo Tiago Mundim <40973026+camilotmundim@users.noreply.github.com> Date: Wed, 29 Oct 2025 10:57:58 -0400 Subject: [PATCH 2/2] Update CHANGELOG.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Atualizando mudanças no CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19873512..5e5a7eef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Utilitário `convert_name_to_uf` +### Fixed + +- Suporte a anotações modernas no `brutils/cep.py` [#637](https://github.com/brazilian-utils/python/pull/637) + ## [2.3.0] - 2025-10-07 ### Added