
    Ri                     T    d Z g dZdZddlmZmZmZmZmZm	Z	 d
dZ
d
dZd
dZd
d	Zy)aC  
`BibTeX <http://en.wikipedia.org/wiki/BibTeX>`_ is a bibliographic data file format.

The :mod:`bibtexparser` module can parse BibTeX files and write them. The API is similar to the
:mod:`json` module. The parsed data is returned as a simple :class:`BibDatabase` object with the main attribute being
:attr:`entries` representing bibliographic sources such as books and journal articles.

The following functions provide a quick and basic way to manipulate a BibTeX file.
More advanced features are also available in this module.

Parsing a file is as simple as::

    import bibtexparser
    with open('bibtex.bib') as bibtex_file:
       bibtex_database = bibtexparser.load(bibtex_file)

And writing::

    import bibtexparser
    with open('bibtex.bib', 'w') as bibtex_file:
        bibtexparser.dump(bibtex_database, bibtex_file)

)
loadsloaddumpsdumpbibdatabasebparserbwriterbibtexexpressionlatexenccustomizationz1.4.4   )r   r	   r   r   r
   r   Nc                 P    |t        j                         }|j                  |       S )a,  
    Load :class:`BibDatabase` object from a string

    :param bibtex_str: input BibTeX string to be parsed
    :type bibtex_str: str or unicode
    :param parser: custom parser to use (optional)
    :type parser: BibTexParser
    :returns: bibliographic database object
    :rtype: BibDatabase
    )r   BibTexParserparse)
bibtex_strparsers     M/home/agent/.friday_env/lib/python3.12/site-packages/bibtexparser/__init__.pyr   r   !   s&     ~%%'<<
##    c                 P    |t        j                         }|j                  |       S )a  
    Load :class:`BibDatabase` object from a file

    :param bibtex_file: input file to be parsed
    :type bibtex_file: file
    :param parser: custom parser to use (optional)
    :type parser: BibTexParser
    :returns: bibliographic database object
    :rtype: BibDatabase

    Example::

        import bibtexparser
        with open('bibtex.bib') as bibtex_file:
           bibtex_database = bibtexparser.load(bibtex_file)

    )r   r   
parse_file)bibtex_filer   s     r   r   r   1   s(    $ ~%%'[))r   c                 P    |t        j                         }|j                  |       S )a  
    Dump :class:`BibDatabase` object to a BibTeX string

    :param bib_database: bibliographic database object
    :type bib_database: BibDatabase
    :param writer: custom writer to use (optional)
    :type writer: BibTexWriter
    :returns: BibTeX string
    :rtype: unicode
    r   BibTexWriterwrite)bib_databasewriters     r   r   r   H   s&     ~%%'<<%%r   c                 p    |t        j                         }|j                  |j                  |              y)a  
    Dump :class:`BibDatabase` object as a BibTeX text file

    :param bib_database: bibliographic database object
    :type bib_database: BibDatabase
    :param bibtex_file: file to write to
    :type bibtex_file: file
    :param writer: custom writer to use (optional)
    :type writer: BibTexWriter

    Example::

        import bibtexparser
        with open('bibtex.bib', 'w') as bibtex_file:
            bibtexparser.dump(bibtex_database, bibtex_file)

    Nr   )r   r   r   s      r   r   r   X   s.    $ ~%%'fll<01r   )N)__doc____all____version__ r   r	   r   r   r
   r   r   r   r   r    r   r   <module>r#      s2   .  V V$ *.& 2r   