From c44d1f3accd3c91041d39b1921a7f988d664deb4 Mon Sep 17 00:00:00 2001 From: Isaac To Date: Sun, 2 Feb 2025 20:03:34 -0800 Subject: [PATCH] fix: remove multiple assignments of constant `ALLOWED_INPUT_SCHEMAS` This also improves readability --- dandischema/consts.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dandischema/consts.py b/dandischema/consts.py index 9d9a9883..595e5789 100644 --- a/dandischema/consts.py +++ b/dandischema/consts.py @@ -12,15 +12,16 @@ "0.6.6", "0.6.7", "0.6.8", + DANDI_SCHEMA_VERSION, ] # ATM we allow only for a single target version which is current # migrate has a guard now for this since it cannot migrate to anything but current # version ALLOWED_TARGET_SCHEMAS = [DANDI_SCHEMA_VERSION] + # This allows multiple schemas for validation, whereas target schemas focus on # migration. -ALLOWED_VALIDATION_SCHEMAS = ALLOWED_TARGET_SCHEMAS + ALLOWED_INPUT_SCHEMAS - -if DANDI_SCHEMA_VERSION not in ALLOWED_INPUT_SCHEMAS: - ALLOWED_INPUT_SCHEMAS.append(DANDI_SCHEMA_VERSION) +ALLOWED_VALIDATION_SCHEMAS = sorted( + set(ALLOWED_INPUT_SCHEMAS).union(ALLOWED_TARGET_SCHEMAS) +)