arun3676
Configure for HuggingFace Spaces Docker deployment - Add Dockerfile, .dockerignore, update README with HF metadata, optimize requirements.txt
b7db63d
raw
history blame
459 Bytes
def get_file_extension(filename: str) -> str:
"""
Returns the extension of a file.
Args:
filename: The name of the file.
Returns:
The file extension (e.g., "txt", "py") or an empty string if
the file has no extension.
"""
if not isinstance(filename, str):
raise TypeError("Filename must be a string.")
parts = filename.split('.')
if len(parts) > 1:
return parts[-1]
return ""