Skip to content
Snippets Groups Projects
Commit 9f38419f authored by Erwan Rouchet's avatar Erwan Rouchet
Browse files

Merge branch 'update-flake8' into 'master'

Update flake8

See merge request !798
parents 26b3a289 f9fba1e1
No related branches found
No related tags found
1 merge request!798Update flake8
......@@ -43,7 +43,7 @@ class ActsImporter(object):
self.folder = self.corpus.elements.get(type=self.folder_type, name__iexact=self.csvpath.stem)
logger.debug('Matched folder "{}" for folder name "{}"'.format(self.folder.name, self.csvpath.stem))
except Element.DoesNotExist:
raise ValueError('Volume "" not found'.format(self.csvpath.stem))
raise ValueError('Volume "{}" not found'.format(self.csvpath.stem))
# Allows finding an image in the corpus by its IIIF ID,
# by concatenating the server's base URL and the image path
......
......@@ -12,7 +12,6 @@ from arkindex.project.aws import S3FileMixin, S3FileStatus
from arkindex.project.fields import StripSlashURLField, LStripTextField, MD5HashField
from arkindex.project.models import IndexableModel
from arkindex.project.polygon import PolygonField
from arkindex.project.triggers import resize_image
import logging
import os
import requests
......@@ -244,6 +243,8 @@ class Image(S3FileMixin, IndexableModel):
Check and update the image's properties from an IIIF Image Information response
This does not save in the DB nor handles any exceptions.
"""
from arkindex.project.triggers import resize_image
assert isinstance(data, dict), 'Payload should be a dict'
assert all(item in data for item in ('@id', 'width', 'height', 'profile')), 'Missing required properties'
assert isinstance(data['profile'], (str, list)), 'Profile is not a list or URI'
......
......@@ -7,6 +7,7 @@ from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
from django.conf import settings
from arkindex.documents.models import Element, Corpus, Entity
from arkindex.images.models import Image
REINDEX_CHANNEL = 'reindex'
ML_RESULTS_CHANNEL = 'ml_results'
......@@ -122,13 +123,12 @@ def corpus_delete(corpus: Union[Corpus, UUID, str],
})
def resize_image(image: Union['Image', UUID, str],
def resize_image(image: Union[Image, UUID, str],
ratio: float = 1.0) -> None:
"""
Handle image resizing: when an ImageServer's maximum allowed size changes,
rescale all of its zones.
"""
from arkindex.images.models import Image
if isinstance(image, Image):
image_id = str(image.id)
else:
......
[flake8]
max-line-length = 120
exclude=build,.eggs,.git,src,arkindex/*/migrations/0001_initial.py
exclude=build,.eggs,.git,src,arkindex/*/migrations/0001_initial.py,.cache
# Flake8 ignores multiple errors by default;
# the only interesting ignore is W503, which goes against PEP8.
# See https://lintlyci.github.io/Flake8Rules/rules/W503.html
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment