Loading src/jama/__init__.py +1 −1 Original line number Diff line number Diff line __version__ = "0.1.47" __version__ = "0.1.48" src/resources/models.py +13 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ from subprocess import call from django.utils.timezone import now from resources import tasks import pytesseract import logging from PIL import Image, UnidentifiedImageError from functools import cache from django.db.models.query import QuerySet Loading @@ -19,6 +20,8 @@ Image.MAX_IMAGE_PIXELS = None XLSX_MULTIPLE_VALUES_SEPARATOR = "\n--\n" logger = logging.getLogger(__name__) def _flatten_resource( resource: "Resource", known_metadatas: dict, metadatas_labels: List Loading Loading @@ -342,8 +345,13 @@ class File(Resource): except ValueError: pass else: try: image = Image.open(self.local_path()) val, _ = image.size except UnidentifiedImageError: logger.warning( f"Could not get width for file({self.pk}) using PIL. Possible image corruption." ) return val def image_height_from_metas(self) -> Union[int, None]: Loading @@ -360,8 +368,13 @@ class File(Resource): except ValueError: pass else: try: image = Image.open(self.local_path()) _, val = image.size except UnidentifiedImageError: logger.warning( f"Could not get height for file({self.pk}) using PIL. Possible image corruption." ) return val class Meta: Loading Loading
src/jama/__init__.py +1 −1 Original line number Diff line number Diff line __version__ = "0.1.47" __version__ = "0.1.48"
src/resources/models.py +13 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ from subprocess import call from django.utils.timezone import now from resources import tasks import pytesseract import logging from PIL import Image, UnidentifiedImageError from functools import cache from django.db.models.query import QuerySet Loading @@ -19,6 +20,8 @@ Image.MAX_IMAGE_PIXELS = None XLSX_MULTIPLE_VALUES_SEPARATOR = "\n--\n" logger = logging.getLogger(__name__) def _flatten_resource( resource: "Resource", known_metadatas: dict, metadatas_labels: List Loading Loading @@ -342,8 +345,13 @@ class File(Resource): except ValueError: pass else: try: image = Image.open(self.local_path()) val, _ = image.size except UnidentifiedImageError: logger.warning( f"Could not get width for file({self.pk}) using PIL. Possible image corruption." ) return val def image_height_from_metas(self) -> Union[int, None]: Loading @@ -360,8 +368,13 @@ class File(Resource): except ValueError: pass else: try: image = Image.open(self.local_path()) _, val = image.size except UnidentifiedImageError: logger.warning( f"Could not get height for file({self.pk}) using PIL. Possible image corruption." ) return val class Meta: Loading