mirror of
https://github.com/imarkoff/Marble-shell-theme.git
synced 2025-09-24 20:26:35 -07:00
21
scripts/utils/is_photo.py
Normal file
21
scripts/utils/is_photo.py
Normal file
@@ -0,0 +1,21 @@
|
||||
image_extensions = [
|
||||
'jpg', 'jpeg', 'png', 'gif', 'bmp',
|
||||
'webp', 'tiff', 'tif', 'svg', 'heic', 'heif'
|
||||
]
|
||||
|
||||
def is_photo(extension: str):
|
||||
"""
|
||||
Check if extension is supported photo format
|
||||
"""
|
||||
|
||||
return extension.lower() in image_extensions
|
||||
|
||||
class NotSupportedPhotoExtension(Exception):
|
||||
"""
|
||||
Exception for not supported photo extension
|
||||
"""
|
||||
|
||||
def __init__(self, extension):
|
||||
self.message = (f"Photo extension {extension} is not supported. "
|
||||
f"Supported formats: {", ".join(image_extensions)}.")
|
||||
super().__init__(self.message)
|
Reference in New Issue
Block a user