Skip to content

Commit c300776

Browse files
authored
Merge pull request #280 from candleindark/enh-consts
Avoid multiple assignments of constant `ALLOWED_INPUT_SCHEMAS`
2 parents 6fd04fb + c44d1f3 commit c300776

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

dandischema/consts.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@
1212
"0.6.6",
1313
"0.6.7",
1414
"0.6.8",
15+
DANDI_SCHEMA_VERSION,
1516
]
1617

1718
# ATM we allow only for a single target version which is current
1819
# migrate has a guard now for this since it cannot migrate to anything but current
1920
# version
2021
ALLOWED_TARGET_SCHEMAS = [DANDI_SCHEMA_VERSION]
22+
2123
# This allows multiple schemas for validation, whereas target schemas focus on
2224
# migration.
23-
ALLOWED_VALIDATION_SCHEMAS = ALLOWED_TARGET_SCHEMAS + ALLOWED_INPUT_SCHEMAS
24-
25-
if DANDI_SCHEMA_VERSION not in ALLOWED_INPUT_SCHEMAS:
26-
ALLOWED_INPUT_SCHEMAS.append(DANDI_SCHEMA_VERSION)
25+
ALLOWED_VALIDATION_SCHEMAS = sorted(
26+
set(ALLOWED_INPUT_SCHEMAS).union(ALLOWED_TARGET_SCHEMAS)
27+
)

0 commit comments

Comments
 (0)