mirror of
https://github.com/enpaul/kodak.git
synced 2025-09-18 21:21:59 +00:00
Fix typing and linting errors
Fix typing error in checksum path factory Fix immediate reraise in manip resource handler Fix unsilenced warning in manip protocol function
This commit is contained in:
@@ -47,7 +47,7 @@ class Checksum(NamedTuple):
|
|||||||
|
|
||||||
hasher = constructor()
|
hasher = constructor()
|
||||||
view = memoryview(bytearray(1024 * 1024))
|
view = memoryview(bytearray(1024 * 1024))
|
||||||
with path.open("rb", buffering=0) as infile:
|
with Path(path).open("rb", buffering=0) as infile:
|
||||||
for chunk in iter(lambda: infile.readinto(view), 0): # type: ignore
|
for chunk in iter(lambda: infile.readinto(view), 0): # type: ignore
|
||||||
hasher.update(view[:chunk])
|
hasher.update(view[:chunk])
|
||||||
|
|
||||||
|
@@ -98,7 +98,8 @@ def crop(image: Image.Image, config: configuration.ManipConfig) -> Image.Image:
|
|||||||
|
|
||||||
|
|
||||||
def black_and_white(
|
def black_and_white(
|
||||||
image: Image.Image, config: configuration.ManipConfig
|
image: Image.Image,
|
||||||
|
config: configuration.ManipConfig, # pylint: disable=unused-argument
|
||||||
) -> Image.Image:
|
) -> Image.Image:
|
||||||
"""Convert an image to full-depth black and white"""
|
"""Convert an image to full-depth black and white"""
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@@ -24,7 +24,7 @@ class ImageManip(KodakResource):
|
|||||||
manip_config = flask.current_app.appconfig.manips[manip_name]
|
manip_config = flask.current_app.appconfig.manips[manip_name]
|
||||||
format_ = constants.ImageFormat[format_name.upper()]
|
format_ = constants.ImageFormat[format_name.upper()]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise
|
raise RuntimeError("Manip or format doesn't exist") from None
|
||||||
|
|
||||||
with database.interface.atomic():
|
with database.interface.atomic():
|
||||||
parent = database.ImageRecord.get(database.ImageRecord.name == image_name)
|
parent = database.ImageRecord.get(database.ImageRecord.name == image_name)
|
||||||
|
Reference in New Issue
Block a user