bibble.util.middlecore

Refactored core middleware classes from bibtexparser

Type Aliases

Logger

Classes

IdenBidiMiddleware

The base middleware.

IdenBlockMiddleware

Identity Block Middleware, does nothing

IdenLibraryMiddleware

Identity Library Middleware, does nothing

_BaseMiddleware

The base middleware.

Module Contents

bibble.util.middlecore.Logger: TypeAlias = logmod.Logger
class bibble.util.middlecore.IdenBidiMiddleware(*args, **kwargs)[source]

Bases: _BaseMiddleware

The base middleware. has a metadata key, stores allow_inplace and allow_parallel and can have an injected logger.

Any extra init kwargs are stored in _extra

get_transforms_for(
block,
*,
direction=None,
) <Unknown>[source]

Get all transforms of the form {direction}_transform_{Type}, by mro, from most -> least specific

Parameters:
  • block (Block)

  • direction (jgdv.Maybe[str])

Return type:

list[collections.abc.Callable]

handle_meta_entry(library) <Unknown>[source]

An optional entry hook for middlewares, which is given the library’s metablock before transform is called.

Use case: conditionally setting PathWriter suppress paths

Parameters:

library (bibtexparser.library.Library)

Return type:

None

read_transform(library) <Unknown>[source]
Parameters:

library (bibtexparser.library.Library)

Return type:

bibtexparser.library.Library

write_transform(library) <Unknown>[source]
Parameters:

library (bibtexparser.library.Library)

Return type:

bibtexparser.library.Library

_reader: jgdv.Maybe[bibble._interface.Middleware]
_transform_cache: dict[str, list[collections.abc.Callable]]
_writer: jgdv.Maybe[bibble._interface.Middleware]
class bibble.util.middlecore.IdenBlockMiddleware(*args, **kwargs)[source]

Bases: _BaseMiddleware

Identity Block Middleware, does nothing If passed ‘tqdm’=True uses tqdm around the block level loop

get_transforms_for(
block,
*,
direction=None,
) <Unknown>[source]

Get all transforms of the form transform_{Type}, by mro, from most -> least specific

Parameters:
  • block (Block)

  • direction (jgdv.Maybe[str])

Return type:

list[collections.abc.Callable]

transform(library) <Unknown>[source]
Parameters:

library (bibtexparser.library.Library)

Return type:

bibtexparser.library.Library

_transform_cache: dict[type, list[collections.abc.Callable]]
class bibble.util.middlecore.IdenLibraryMiddleware(**kwargs)[source]

Bases: _BaseMiddleware

Identity Library Middleware, does nothing

transform(library) <Unknown>[source]
Parameters:

library (bibtexparser.library.Library)

Return type:

bibtexparser.library.Library

class bibble.util.middlecore._BaseMiddleware(**kwargs)[source]

The base middleware. has a metadata key, stores allow_inplace and allow_parallel and can have an injected logger.

Any extra init kwargs are stored in _extra

_get_lib_iterator(library) <Unknown>[source]
Parameters:

library (bibtexparser.library.Library)

Return type:

tuple[bibtexparser.library.Library, collections.abc.Iterator[Block]]

handle_meta_entry(library) <Unknown>[source]

An optional entry hook for middlewares, which is given the library’s metablock before transform is called.

Use case: conditionally setting PathWriter suppress paths

Parameters:

library (bibtexparser.library.Library)

Return type:

None

logger() <Unknown>[source]
Return type:

Logger

classmethod metadata_key() <Unknown>[source]

Identifier of the middleware. This key is used to identify the middleware in a blocks metadata.

Return type:

str

_extra
_logger
allow_inplace: bool
allow_parallel: bool