# Path: pubs/bibstruct.py
# TYPE_KEY = 'ENTRYTYPE'


import copy
import logging
import pyparsing
import bibtexparser
    import bibtexparser as bp
import yaml
from .bibstruct import TYPE_KEY
        for f in ignore_fields:
            entry.pop(f, None)
        if 'author' in entry:
            entry['author'] = ' and '.join(
                author for author in entry['author'])
        if 'editor' in entry:
            entry['editor'] = ' and '.join(
                editor for editor in entry['editor'])
        if 'keyword' in entry:
            entry['keyword'] = ', '.join(
                keyword for keyword in entry['keyword'])
        return entry

    def decode_bibdata(self, bibstr):
        """Decodes bibdata from string.

        If the decoding fails, returns a BibDecodingError.
        """
        if len(bibstr) == 0:
            error_msg = 'parsing error: the provided string has length zero.'
            raise self.BibDecodingError(error_msg, bibstr)
        try:
            entries = bp.bparser.BibTexParser(
                bibstr, common_strings=True, customization=customizations,
                homogenize_fields=True, ignore_nonstandard_types=False).get_entry_dict()
            # Remove id from bibtexparser attribute which is stored as citekey
            for e in entries:
                entries[e].pop(BP_ID_KEY)
                # Convert bibtexparser entrytype key to internal 'type'
                t = entries[e].pop(BP_ENTRYTYPE_KEY)

# Path: pubs/bibstruct.py
# TYPE_KEY = 'ENTRYTYPE'


# Path: pubs/endecoder.py
import copy
import logging
import pyparsing
import bibtexparser
    import bibtexparser as bp
import yaml
from .bibstruct import TYPE_KEY

        for f in ignore_fields:
            entry.pop(f, None)
        if 'author' in entry:
            entry['author'] = ' and '.join(
                author for author in entry['author'])
        if 'editor' in entry:
            entry['editor'] = ' and '.join(
                editor for editor in entry['editor'])
        if 'keyword' in entry:
            entry['keyword'] = ', '.join(
                keyword for keyword in entry['keyword'])
        return entry

    def decode_bibdata(self, bibstr):
        """Decodes bibdata from string.

        If the decoding fails, returns a BibDecodingError.
        """
        if len(bibstr) == 0:
            error_msg = 'parsing error: the provided string has length zero.'
            raise self.BibDecodingError(error_msg, bibstr)
        try:
            entries = bp.bparser.BibTexParser(
                bibstr, common_strings=True, customization=customizations,
                homogenize_fields=True, ignore_nonstandard_types=False).get_entry_dict()
            # Remove id from bibtexparser attribute which is stored as citekey
            for e in entries:
                entries[e].pop(BP_ID_KEY)
                # Convert bibtexparser entrytype key to internal 'type'
                t = entries[e].pop(BP_ENTRYTYPE_KEY)

                entries[e][TYPE_KEY] = t