1
0
mirror of https://github.com/enpaul/kodak.git synced 2024-11-14 10:36:55 +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:
Ethan Paul 2021-11-23 19:49:26 -05:00
parent ade6929dc3
commit 0bf2aba0ba
No known key found for this signature in database
GPG Key ID: D0E2CBF1245E92BF
3 changed files with 4 additions and 3 deletions

View File

@ -47,7 +47,7 @@ class Checksum(NamedTuple):
hasher = constructor()
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
hasher.update(view[:chunk])

View File

@ -98,7 +98,8 @@ def crop(image: Image.Image, config: configuration.ManipConfig) -> Image.Image:
def black_and_white(
image: Image.Image, config: configuration.ManipConfig
image: Image.Image,
config: configuration.ManipConfig, # pylint: disable=unused-argument
) -> Image.Image:
"""Convert an image to full-depth black and white"""
logger = logging.getLogger(__name__)

View File

@ -24,7 +24,7 @@ class ImageManip(KodakResource):
manip_config = flask.current_app.appconfig.manips[manip_name]
format_ = constants.ImageFormat[format_name.upper()]
except KeyError:
raise
raise RuntimeError("Manip or format doesn't exist") from None
with database.interface.atomic():
parent = database.ImageRecord.get(database.ImageRecord.name == image_name)