fix(): Ajuste na função que retorna o hash para visualização do arquivo
This commit is contained in:
parent
f0dfec03dd
commit
d35d102bd1
1 changed files with 7 additions and 9 deletions
|
|
@ -17,17 +17,15 @@ def get_last_part(text: str) -> str:
|
|||
Returns:
|
||||
str: Última parte da string (após a última "/")
|
||||
"""
|
||||
# Divide a string em partes
|
||||
partes = text.split("/")
|
||||
# Se for set, converte o primeiro elemento para string
|
||||
if isinstance(text, set):
|
||||
text = next(iter(text)) # pega o primeiro valor do set
|
||||
|
||||
# Verifica se há pelo menos 3 partes
|
||||
if len(partes) < 3:
|
||||
raise ValueError(
|
||||
"A string deve conter pelo menos três partes separadas por '/'."
|
||||
)
|
||||
# Se ainda não for string, força conversão
|
||||
text = str(text)
|
||||
|
||||
# Retorna a última parte
|
||||
return partes[-1]
|
||||
# Retorna a última parte da string separada por "/"
|
||||
return text.split("/")[-1]
|
||||
|
||||
|
||||
# Função que gera o hash baseado na data atual
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue