|
1 | 1 | import re |
2 | 2 | import sys |
3 | | -from enum import Enum |
4 | 3 | from typing import Any, Mapping, Optional, Union |
5 | 4 |
|
6 | 5 | from marshmallow import Schema, ValidationError, fields, post_load |
@@ -377,35 +376,3 @@ class StorageEntrySchema(Schema): |
377 | 376 | def make_dataclass(self, data, **kwargs): |
378 | 377 | # pylint: disable=no-self-use |
379 | 378 | return StorageEntry(**data) |
380 | | - |
381 | | - |
382 | | -class Revision(Enum): |
383 | | - """ |
384 | | - Enum representing the revision of the specification to be used. |
385 | | - """ |
386 | | - |
387 | | - V0 = 0 |
388 | | - V1 = 1 |
389 | | - |
390 | | - |
391 | | -class RevisionField(fields.Field): |
392 | | - def _serialize(self, value: Any, attr: Optional[str], obj: Any, **kwargs): |
393 | | - if value is None or value == Revision.V0: |
394 | | - return str(Revision.V0.value) |
395 | | - return value.value |
396 | | - |
397 | | - def _deserialize(self, value, attr, data, **kwargs) -> Revision: |
398 | | - if isinstance(value, str): |
399 | | - value = int(value) |
400 | | - |
401 | | - if isinstance(value, Revision): |
402 | | - value = value.value |
403 | | - |
404 | | - revisions = [revision.value for revision in Revision] |
405 | | - if value not in revisions: |
406 | | - allowed_revisions_str = "".join(list(map(str, revisions))) |
407 | | - raise ValidationError( |
408 | | - f"Invalid value provided for Revision: {value}. Allowed values are {allowed_revisions_str}." |
409 | | - ) |
410 | | - |
411 | | - return Revision(value) |
0 commit comments