-
FuzzyEnumMixin — Fuzzy lookup get_enum() method that allows caseless enum lookups with variations.
-
EnumField — Fuzzy lookup Enum field that allows caseless enum lookups with variations.
-
PageTypeField — ComicPageInfo Page Type Field.
-
ReadingDirectionField — Reading direction enum.
-
EnumBooleanField — An Enum Field that also accepts boolean values.
-
ComicInfoMangaEnum — Manga enum for ComicInfo.
-
ComicInfoMangaField — Manga field from ComicInfo.
-
MangaField — Comicbox manga field: says only whether the book is manga.
-
YesNoEnum — Yes No Enum.
-
YesNoField — A yes no kind of boolean field.
-
PrettifiedStringField — A string fields that tries to match to an enum and falls back to just titlecasing.
-
OriginalFormatField — Prettify Original Format.
-
AgeRatingField — Prettified Age Rating.
comicbox.formats.base.fields.enum_fields¶
source module comicbox.formats.base.fields.enum_fields
Marshmallow Enum Fields.
Classes
source class FuzzyEnumMixin()
Fuzzy lookup get_enum() method that allows caseless enum lookups with variations.
Methods
-
get_ordered_key_variations — Get fuzzy lookup key variations, most literal first.
-
get_key_variations — Get enum caseless slightly fuzzy lookup key variations for a key.
-
add_enum_map_item — Add an enum or string to the lookup table with lowercase spaceless and spaced variations.
-
get_enum_alias_map — Transform the ENUM_ALIAS_MAP into the enum lookup map.
-
get_enum — Get an enum from the fuzzy lookup map.
source staticmethod FuzzyEnumMixin.get_ordered_key_variations(key: str | Enum) → tuple[str, …]
Get fuzzy lookup key variations, most literal first.
Lookups try these in order, so the exact spelling always beats a variation that only matches after punctuation is collapsed.
source classmethod FuzzyEnumMixin.get_key_variations(key: str | Enum) → set[str]
Get enum caseless slightly fuzzy lookup key variations for a key.
source classmethod FuzzyEnumMixin.add_enum_map_item(key: str | Enum, enum: Enum, enum_map: dict) → None
Add an enum or string to the lookup table with lowercase spaceless and spaced variations.
source method FuzzyEnumMixin.get_enum_alias_map() → dict
Transform the ENUM_ALIAS_MAP into the enum lookup map.
source method FuzzyEnumMixin.get_enum(value: str | Enum) → Enum | None
Get an enum from the fuzzy lookup map.
The map is keyed by every variation of every known spelling, so the lookup must generate the same variations of the value. Lowercasing alone matched “Cover Artist” and “CoverArtist” to different entries and missed snake_case input entirely.
source class EnumField(*args: Any, **kwargs: Any)
Bases : FuzzyEnumMixin, fields.Enum
Fuzzy lookup Enum field that allows caseless enum lookups with variations.
Use the enum.
Methods
-
get_enum_map — Transform the ENUM_ALIAS_MAP into the enum lookup map and add the field enum to it as well.
source method EnumField.get_enum_map() → dict
Transform the ENUM_ALIAS_MAP into the enum lookup map and add the field enum to it as well.
source class PageTypeField()
Bases : EnumField
ComicPageInfo Page Type Field.
source class ReadingDirectionField()
Bases : EnumField
Reading direction enum.
source class EnumBooleanField()
Bases : EnumField
An Enum Field that also accepts boolean values.
source class ComicInfoMangaEnum()
Bases : Enum
Manga enum for ComicInfo.
source class ComicInfoMangaField()
Bases : EnumBooleanField
Manga field from ComicInfo.
Keeps ComicInfo’s compound vocabulary, YesAndRightToLeft included. The ComicInfo transform splits that value across comicbox’s manga and reading_direction fields and recomposes it on write.
source class MangaField()
Bases : EnumBooleanField
Comicbox manga field: says only whether the book is manga.
Bases : Enum
Yes No Enum.
source class YesNoField()
Bases : EnumBooleanField
A yes no kind of boolean field.
Comicbox models these tags as plain booleans, so deserialize to bool. The schema’s Unknown means “not recorded”, which is no value at all.
source class PrettifiedStringField(*args: Any, **kwargs: Any)
Bases : FuzzyEnumMixin, StringField
A string fields that tries to match to an enum and falls back to just titlecasing.
Use the enum.
source class OriginalFormatField()
Bases : PrettifiedStringField
Prettify Original Format.
source class AgeRatingField()
Bases : PrettifiedStringField
Prettified Age Rating.