comicbox.formats.base.fields.enum_fields ¶
Marshmallow Enum Fields.
AgeRatingField ¶
Bases: PrettifiedStringField
Prettified Age Rating.
Source code in comicbox/formats/base/fields/enum_fields.py
271 272 273 274 | |
ComicInfoMangaEnum ¶
Bases: Enum
Manga enum for ComicInfo.
Source code in comicbox/formats/base/fields/enum_fields.py
184 185 186 187 188 189 190 | |
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 code in comicbox/formats/base/fields/enum_fields.py
193 194 195 196 197 198 199 200 201 202 | |
EnumBooleanField ¶
Bases: EnumField
An Enum Field that also accepts boolean values.
Source code in comicbox/formats/base/fields/enum_fields.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
EnumField ¶
Bases: FuzzyEnumMixin, Enum
Fuzzy lookup Enum field that allows caseless enum lookups with variations.
Source code in comicbox/formats/base/fields/enum_fields.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
__init__(*args, **kwargs) ¶
Use the enum.
Source code in comicbox/formats/base/fields/enum_fields.py
95 96 97 98 99 | |
get_enum_map() ¶
Transform the ENUM_ALIAS_MAP into the enum lookup map and add the field enum to it as well.
Source code in comicbox/formats/base/fields/enum_fields.py
88 89 90 91 92 93 | |
FuzzyEnumMixin ¶
Fuzzy lookup get_enum() method that allows caseless enum lookups with variations.
Source code in comicbox/formats/base/fields/enum_fields.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
add_enum_map_item(key, enum, enum_map) classmethod ¶
Add an enum or string to the lookup table with lowercase spaceless and spaced variations.
Source code in comicbox/formats/base/fields/enum_fields.py
52 53 54 55 56 57 | |
get_enum(value) ¶
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 code in comicbox/formats/base/fields/enum_fields.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
get_enum_alias_map() ¶
Transform the ENUM_ALIAS_MAP into the enum lookup map.
Source code in comicbox/formats/base/fields/enum_fields.py
59 60 61 62 63 64 | |
get_key_variations(key) classmethod ¶
Get enum caseless slightly fuzzy lookup key variations for a key.
Source code in comicbox/formats/base/fields/enum_fields.py
47 48 49 50 | |
get_ordered_key_variations(key) staticmethod ¶
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 code in comicbox/formats/base/fields/enum_fields.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
MangaField ¶
Bases: EnumBooleanField
Comicbox manga field: says only whether the book is manga.
Source code in comicbox/formats/base/fields/enum_fields.py
205 206 207 208 | |
OriginalFormatField ¶
Bases: PrettifiedStringField
Prettify Original Format.
Source code in comicbox/formats/base/fields/enum_fields.py
265 266 267 268 | |
PageTypeField ¶
Bases: EnumField
ComicPageInfo Page Type Field.
Source code in comicbox/formats/base/fields/enum_fields.py
125 126 127 128 | |
PrettifiedStringField ¶
Bases: FuzzyEnumMixin, StringField
A string fields that tries to match to an enum and falls back to just titlecasing.
Source code in comicbox/formats/base/fields/enum_fields.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | |
__init__(*args, **kwargs) ¶
Use the enum.
Source code in comicbox/formats/base/fields/enum_fields.py
243 244 245 246 | |
ReadingDirectionField ¶
Bases: EnumField
Reading direction enum.
Source code in comicbox/formats/base/fields/enum_fields.py
131 132 133 134 135 | |
SeriesStatusField ¶
Bases: EnumField
Series publication status enum.
Source code in comicbox/formats/base/fields/enum_fields.py
138 139 140 141 | |
YesNoEnum ¶
Bases: Enum
Yes No Enum.
Source code in comicbox/formats/base/fields/enum_fields.py
211 212 213 214 215 216 | |
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 code in comicbox/formats/base/fields/enum_fields.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |