bibble.util.mixins

Type Aliases

Middleware

Classes

EntrySkipper_m

Be able to skip entries by their type

ErrorRaiser_m

Mixin for easily combining middleware errors into a block

FieldMatcher_m

Mixin to process fields if their key matchs a regex

MiddlewareValidator_m

For ensuring the middlewares of a reader/writer are appropriate,

Module Contents

bibble.util.mixins.Middleware: TypeAlias = API.Middleware_p | API.BidirectionalMiddleware_p
class bibble.util.mixins.EntrySkipper_m[source]

Be able to skip entries by their type

set_entry_skiplists(
*,
white=None,
black=None,
) <Unknown>[source]
Parameters:
Return type:

None

should_skip_entry(entry, library) <Unknown>[source]
Parameters:
  • entry (bibble._interface.Entry)

  • library (bibble._interface.Library)

Return type:

bool

class bibble.util.mixins.ErrorRaiser_m[source]

Mixin for easily combining middleware errors into a block

make_error_block(entry, err) <Unknown>[source]
Parameters:
  • entry (bibble._interface.Entry)

  • err (Exception)

Return type:

bibtexparser.model.MiddlewareErrorBlock

class bibble.util.mixins.FieldMatcher_m[source]

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

abstractmethod field_h(field, entry) <Unknown>[source]
Parameters:
  • field (bibble._interface.Field)

  • entry (bibble._interface.Entry)

Return type:

jgdv.Result[list[bibble._interface.Field], Exception]

match_on_fields(entry, library) <Unknown>[source]
Parameters:
  • entry (bibble._interface.Entry)

  • library (bibble._interface.Library)

Return type:

jgdv.Result[bibble._interface.Entry, Exception]

set_field_matchers(*, white, black) <Unknown>[source]

sets the blacklist and whitelist regex’s returns self to help in building parse stacks

Parameters:
Return type:

Self

class bibble.util.mixins.MiddlewareValidator_m[source]

For ensuring the middlewares of a reader/writer are appropriate, by excluding certain middlewares.

exclude_middlewares(proto) <Unknown>[source]
Parameters:

proto (type)

_middlewares: list[Middleware]