.. _bibble.util.mixins: ================== bibble.util.mixins ================== .. py:module:: bibble.util.mixins Type Aliases ------------ .. autoapisummary:: bibble.util.mixins.Middleware Classes ------- .. autoapisummary:: bibble.util.mixins.EntrySkipper_m bibble.util.mixins.ErrorRaiser_m bibble.util.mixins.FieldMatcher_m bibble.util.mixins.MiddlewareValidator_m Module Contents =============== .. py:data:: Middleware :type: TypeAlias :value: API.Middleware_p | API.BidirectionalMiddleware_p .. _bibble.util.mixins.EntrySkipper_m: .. py:class:: EntrySkipper_m Be able to skip entries by their type .. py:method:: set_entry_skiplists(*, white = None, black = None) -> .. py:method:: should_skip_entry(entry, library) -> .. _bibble.util.mixins.ErrorRaiser_m: .. py:class:: ErrorRaiser_m Mixin for easily combining middleware errors into a block .. py:method:: make_error_block(entry, err) -> .. _bibble.util.mixins.FieldMatcher_m: .. py:class:: FieldMatcher_m Mixin to process fields if their key matchs a regex defaults are in the attrs _field_blacklist and _field_whitelist, _entry_whitelist Call set_field_matchers to extend. Call match_on_fields to start. Call maybe_skip_entry to compare the lowercase entry type to a whitelist Implement field_handler to use. match_on_fields calls entry.set_field on the field_handlers result .. py:method:: field_h(field, entry) -> :abstractmethod: .. py:method:: match_on_fields(entry, library) -> .. py:method:: set_field_matchers(*, white, black) -> sets the blacklist and whitelist regex's returns self to help in building parse stacks .. _bibble.util.mixins.MiddlewareValidator_m: .. py:class:: MiddlewareValidator_m For ensuring the middlewares of a reader/writer are appropriate, by excluding certain middlewares. .. py:method:: exclude_middlewares(proto) -> .. py:attribute:: _middlewares :type: list[Middleware]