mirror of
https://github.com/drewcassidy/quicktex.git
synced 2024-09-13 06:37:34 +00:00
document some things
This commit is contained in:
parent
76da50d003
commit
1f0a577d7f
@ -1,17 +1,19 @@
|
|||||||
from PIL import Image
|
from PIL import Image
|
||||||
from typing import List
|
from typing import List
|
||||||
import pathlib
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
|
|
||||||
def get_decoded_extensions(feature: str = 'open') -> List[str]:
|
def get_decoded_extensions(feature: str = 'open') -> List[str]:
|
||||||
|
"""Gets a list of extensions for Pillow formats supporting a supplied feature"""
|
||||||
extensions = Image.registered_extensions() # using registered_extensions() triggers lazy loading of format data
|
extensions = Image.registered_extensions() # using registered_extensions() triggers lazy loading of format data
|
||||||
formats = getattr(Image, feature.upper()).keys()
|
formats = getattr(Image, feature.upper()).keys()
|
||||||
|
|
||||||
return [ext for ext, fmt in extensions.items() if fmt in formats]
|
return [ext for ext, fmt in extensions.items() if fmt in formats]
|
||||||
|
|
||||||
|
|
||||||
|
# noinspection PyUnusedLocal
|
||||||
def validate_decoded_extension(ctx, param, value):
|
def validate_decoded_extension(ctx, param, value):
|
||||||
|
"""Check if an extension for a decoded image is valid"""
|
||||||
if value[0] != '.':
|
if value[0] != '.':
|
||||||
value = '.' + value
|
value = '.' + value
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user