core.util.webpub_manifest_parser package

Subpackages

Submodules

core.util.webpub_manifest_parser.errors module

exception core.util.webpub_manifest_parser.errors.BaseError(message=None, inner_exception=None)[source]

Bases: Exception

Base class for all errors.

property inner_exception

Return the inner exception.

Returns:

Inner exception

Return type:

Exception

core.util.webpub_manifest_parser.utils module

core.util.webpub_manifest_parser.utils.all_unique(_list)[source]

Return a boolean value indicating whether the list contains only unique items.

Returns:

Boolean value indicating whether the list contains only unique items

Return type:

bool

core.util.webpub_manifest_parser.utils.cast(value, klass)[source]

Casts the value to the specified class.

Parameters:
  • value (object) – Value to be casted

  • klass (Type) – Target class

Returns:

Value casted to the specified class

Return type:

object

core.util.webpub_manifest_parser.utils.encode(value)[source]

Encode the string value using UTF-8 encoding.

Parameters:

value (Any) – Value to be encoded

Returns:

Encoded string value or the initial value if it has a non-string type

Return type:

Any

core.util.webpub_manifest_parser.utils.first_or_default(collection, default=None)[source]

Return first element of the specified collection or the default value if the collection is empty.

Parameters:
  • collection (Iterable) – Collection

  • default (Any) – Default value

core.util.webpub_manifest_parser.utils.is_string(value)[source]

Return a boolean value indicating whether the value is a string or not.

Returns:

Boolean value indicating whether the value is a string or not

Return type:

bool

Module contents