bibble.util.middlecore
Refactored core middleware classes from bibtexparser
Type Aliases
Classes
The base middleware. |
|
Identity Block Middleware, does nothing |
|
Identity Library Middleware, does nothing |
|
The base middleware. |
Module Contents
- bibble.util.middlecore.Logger: TypeAlias = logmod.Logger
- class bibble.util.middlecore.IdenBidiMiddleware(*args, **kwargs)[source]
Bases:
_BaseMiddlewareThe 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,
Get all transforms of the form {direction}_transform_{Type}, by mro, from most -> least specific
- Parameters:
block (Block)
direction (jgdv.Maybe[str])
- Return type:
- 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:
_BaseMiddlewareIdentity Block Middleware, does nothing If passed ‘tqdm’=True uses tqdm around the block level loop
- get_transforms_for(
- block,
- *,
- direction=None,
Get all transforms of the form transform_{Type}, by mro, from most -> least specific
- Parameters:
block (Block)
direction (jgdv.Maybe[str])
- Return type:
- 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:
_BaseMiddlewareIdentity Library Middleware, does nothing
- 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
- classmethod metadata_key() <Unknown>[source]
Identifier of the middleware. This key is used to identify the middleware in a blocks metadata.
- Return type:
- _extra
- _logger