bibble.fields.field_substitutor

Classes

FieldSubstitutor

For a given field(s), and a given jgdv.SubstitutionFile,

Module Contents

class bibble.fields.field_substitutor.FieldSubstitutor(
*,
fields,
subs,
force_single_value=False,
**kwargs,
)[source]

Bases: bibble.util.middlecore.IdenBlockMiddleware

For a given field(s), and a given jgdv.SubstitutionFile,

replace the field value as necessary in each entry.

If force_single_value is True, only the first replacement will be used, others will be discarded

eg: for target=[‘tags’], and subs({‘AI’: [‘artificial_intelligence’, ‘agents’, ‘machine_learning’]) and entry(fields={‘tags’: ‘ai’}) will give: entry(fields={‘’tags’: [‘artificial_intelligence’, ‘agents’, ‘machine_learning’]})

Parameters:
  • fields (list[str])

  • subs (jgdv.files.tags.SubstitutionFile)

  • force_single_value (bool)

field_h(field, entry) <Unknown>[source]
transform_Entry(entry, library) <Unknown>[source]
_force_single_value = False
_subs