From 28fef342b9e6bb197a3a34311c4bd56882825f52 Mon Sep 17 00:00:00 2001 From: Maximilian Moser Date: Mon, 23 Sep 2024 16:01:57 +0200 Subject: [PATCH] config: use raw strings for regular expressions --- flask_iiif/config.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/flask_iiif/config.py b/flask_iiif/config.py index 30e1793..7c91cec 100644 --- a/flask_iiif/config.py +++ b/flask_iiif/config.py @@ -107,32 +107,35 @@ "v1": { "region": { "ignore": "full", - "validate": "(^full|(pct:)?([\d.]+,){3}([\d.]+))", + "validate": r"(^full|(pct:)?([\d.]+,){3}([\d.]+))", }, "size": { "ignore": "full", "validate": ( - "(^full|[\d.]+,|,[\d.]+|pct:[\d.]+|[\d.]+," "[\d.]+|![\d.]+,[\d.]+)" + r"(^full|[\d.]+,|,[\d.]+|pct:[\d.]+|[\d.]+,[\d.]+|![\d.]+,[\d.]+)" ), }, - "rotation": {"ignore": "0", "validate": "^[\d.]+$"}, - "quality": {"ignore": "default", "validate": "(native|color|gr[ae]y|bitonal)"}, - "image_format": {"ignore": "", "validate": "(gif|jp2|jpe?g|pdf|png|tiff?)"}, + "rotation": {"ignore": "0", "validate": r"^[\d.]+$"}, + "quality": {"ignore": "default", "validate": r"(native|color|gr[ae]y|bitonal)"}, + "image_format": {"ignore": "", "validate": r"(gif|jp2|jpe?g|pdf|png|tiff?)"}, }, "v2": { "region": { "ignore": "full", - "validate": "(^full|(pct:)?([\d.]+,){3}([\d.]+))", + "validate": r"(^full|(pct:)?([\d.]+,){3}([\d.]+))", }, "size": { "ignore": "full", "validate": ( - "(^full|[\d.]+,|,[\d.]+|pct:[\d.]+|[\d.]+," "[\d.]+|![\d.]+,[\d.]+)" + r"(^full|[\d.]+,|,[\d.]+|pct:[\d.]+|[\d.]+,[\d.]+|![\d.]+,[\d.]+)" ), }, - "rotation": {"ignore": "0", "validate": "^!?[\d.]+$"}, - "quality": {"ignore": "default", "validate": "(default|color|gr[ae]y|bitonal)"}, - "image_format": {"ignore": "", "validate": "(gif|jp2|jpe?g|pdf|png|tiff?)"}, + "rotation": {"ignore": "0", "validate": r"^!?[\d.]+$"}, + "quality": { + "ignore": "default", + "validate": r"(default|color|gr[ae]y|bitonal)", + }, + "image_format": {"ignore": "", "validate": r"(gif|jp2|jpe?g|pdf|png|tiff?)"}, }, }