Skip to content

Instantly share code, notes, and snippets.

View pythrick's full-sized avatar

Patrick Rodrigues pythrick

View GitHub Profile
from unicodedata import normalize
'''
Método para verificar se uma sequencia de valores é um palindromo
'''
def converter_ascii(chars: str) -> str:
return normalize('NFKD', chars).encode('ASCII', 'ignore').decode('ASCII')
from datetime import timedelta
def converter_em_segundos(hora: int = 0, minutos: int = 0, segundos: int = 0) -> float:
"""Função para converter hora, minutos e segundos em segundos."""
return timedelta(hours=hora, minutes=minutos, seconds=segundos).total_seconds()
if __name__ == "__main__":
assert converter_em_segundos(hora=1) == 3600.0
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def _log_execution( # type: ignore[override]
self,
func: Callable[
[PropanMessage[MsgType]],
Awaitable[T_HandlerReturn],
],
**broker_args: AnyDict,
) -> Callable[[PropanMessage[MsgType]], Awaitable[T_HandlerReturn]]:
@wraps(func)
async def log_wrapper(message: PropanMessage[MsgType]) -> T_HandlerReturn: