-
BaseRenderModule — Base Render Module.
-
BaseSubSchema — Base schema.
-
BaseSchema — Top level base schema that traps errors and records path.
comicbox.schemas.base¶
source module comicbox.schemas.base
Skip keys instead of throwing errors.
Classes
source class BaseRenderModule()
source staticmethod BaseRenderModule.clean_string(s: str | bytes | bytearray) → str | None
Clean a string.
source class BaseSubSchema(*args: Any, exclude: StrSequenceOrSet = (), **kwargs: Any)
Bases : ClearingErrorStoreSchema, ABC
Base schema.
Initialize with exclude keys.
Methods
-
pre_load_validate — Validate schema type first thing to fail as early as possible.
-
pre_load — Singular pre_load hook.
-
clean_empties — Clean empties from loaded data.
-
post_load — Singular post_load hook.
-
pre_dump — Singular pre_dump hook.
-
sort_dump — Sort dump by key.
-
post_dump — Singular post_dump hook.
-
loadf — Read the string from the designated file.
-
dumpf — Write the string in the designated file.
source classmethod BaseSubSchema.pre_load_validate(data: dict[str, Any] | None) → dict[str, Any] | None
Validate schema type first thing to fail as early as possible.
source method BaseSubSchema.pre_load(data: dict[str, Any] | None, **_kwargs: Any) → dict[str, Any] | None
Singular pre_load hook.
source classmethod BaseSubSchema.clean_empties(data: dict) → dict
Clean empties from loaded data.
source method BaseSubSchema.post_load(data: dict[str, Any], **_kwargs: Any) → dict[str, Any]
Singular post_load hook.
source method BaseSubSchema.pre_dump(data: dict[str, Any] | MappingProxyType[str, Any], **_kwargs: Any) → dict[str, Any] | MappingProxyType[str, Any]
Singular pre_dump hook.
source classmethod BaseSubSchema.sort_dump(data: dict) → dict
Sort dump by key.
source method BaseSubSchema.post_dump(data: dict, **_kwargs: Any) → dict
Singular post_dump hook.
source method BaseSubSchema.loadf(path) → list | None | dict
Read the string from the designated file.
source method BaseSubSchema.dumpf(data: MappingProxyType[str, Any], path: Path, **kwargs: Any) → None
Write the string in the designated file.
source class BaseSubSchema.Meta()
Bases : ClearingErrorStoreSchema.Meta
Schema options.
source class BaseSchema()
Bases : BaseSubSchema, ABC
Top level base schema that traps errors and records path.
Methods
-
pre_load_validate — Validate the root tag so we don’t confuse it with other JSON.
source classmethod BaseSchema.pre_load_validate(data: dict[str, Any] | None) → dict
Validate the root tag so we don’t confuse it with other JSON.