From bcc0e9be40ac8800136b063be24d943c33c7ac8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Bournhonesque?= Date: Thu, 14 Nov 2024 16:21:14 +0100 Subject: [PATCH] fix: fix ignore_extra_sizes method --- openfoodfacts_exports/exports/parquet.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openfoodfacts_exports/exports/parquet.py b/openfoodfacts_exports/exports/parquet.py index 46e3582..fdcc928 100644 --- a/openfoodfacts_exports/exports/parquet.py +++ b/openfoodfacts_exports/exports/parquet.py @@ -235,9 +235,10 @@ def ignore_extra_sizes(self): """Literal doesn't accept extra values, returning an error in case of additional keys. """ - self.sizes = { - k: v for k, v in self.sizes.items() if k in ALLOWED_IMAGE_SIZE_KEYS - } + if self.sizes: + self.sizes = { + k: v for k, v in self.sizes.items() if k in ALLOWED_IMAGE_SIZE_KEYS + } return self @model_validator(mode="before")