How to use the pycldf.sources function in pycldf

To help you get started, we’ve selected a few pycldf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github clld / clld / src / clld / web / adapters / cldf.py View on Github external
def source2source(req, source):
    """Harmonize the different Source implementations in clld and pycldf."""
    bibrecord = source.bibtex()
    fields = OrderedDict({'%s_url' % req.dataset.id: req.resource_url(source)})
    for key, value in bibrecord.items():
        fields[key] = '; '.join(value) if isinstance(value, list) else value
    return sources.Source(
        getattr(bibrecord.genre, 'value', bibrecord.genre) if bibrecord.genre else 'misc',
        source.id,
        **fields)

pycldf

A python library to read and write CLDF datasets

Apache-2.0
Latest version published 10 days ago

Package Health Score

75 / 100
Full package analysis