{ "info": { "author": "Legisign.org", "author_email": "software@legisign.org", "bugtrack_url": null, "classifiers": [], "description": "# bibparse -- read and write BibTeX files\n\n## Description\n\n`bibparse` reads and writes BibTeX files.\n\nThe main class, `Biblio`, is a `dict` with methods for parsing, reading, writing and searching for BibTeX data. Each entry in the `Biblio` is another kind of special dict, `BibItem`. The user usually only needs to access `Biblio`.\n\n## Version\n\nVersion 1.0.0 -- 18 July 2019.\n\n## Copyrights\n\nCopyright \u00a9 2019 Legisign.org, Tommi Nieminen \n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with this program. If not, see .\n\n## Module contents\n\n### 1. Helper functions\n\nThe values in some fields (namely author, editor, translator, publisher, address, and pages, all of which may have several names, locations, or other data in their values) of `BibItem` are stored internally as `list`s.\n\n* `to_bibtex(key, val)` -- convert an internal Python value into a BibTeX string\n* `to_python(key, val)` -- convert a BibTeX string into an internal Python value\n\nBoth functions take a BibTeX field name (key) in order to decide how to handle the value. Except for \"pages\" where the separator is a single dash \"-\", the separator is the string \" and \", the leading and trailing whitespace included.\n\nExamples:\n\n* `to_bibtex('pages', [100, 110])` \u2192 '100-110'\n* `to_python('address', 'London and New York')` \u2192 ['London', 'New York']\n\n### 2. Exceptions\n\n* `BibError` -- the base exception\n * `DuplicateError` -- duplicate ID\u2019s\n * `NoIDError` -- missing ID in an entry\n * `PreambleError` -- invalid preamble\n\n### 3. BibItem class\n\nA `dict`-derived object representing a single BibTeX entry.\n\n#### 3.1 Methods\n\n##### 3.1.1 Derived methods\n\nThese are derived from `dict` but modified to ensure lower-case keys, reasonable ordering of keys in a printout, and sort ordering.\n\n* `__lt__()`\n* `__repr__()`\n* `__setitem__()`\n* `update()`\n\n`update()` has an additional optional `overwrite=bool` parameter. If `True` (the default), `update()` functions exactly like `dict.update()`, updating BibItem contents from data in the supplied `dict`. If `False`, only new keys in supplied data is added but existing values are not overwritten.\n\n##### 3.1.2 New method\n\n* `parse(data)` -- parse string data into a BibTeX entry\n\n### 4. Biblio class\n\nThe main class. The constructor can be given an optional filename argument; the file is opened and parsed automatically.\n\n#### 4.1 Methods\n\n##### 4.1.1 Derived methods\n\n* `__repr__()`\n\n`__repr__()` produces BibTeX-compatible representation of the data so that conversion to string is easily done with `str()`.\n\n##### 4.1.2 New methods\n\n* `by_regex(field, regex)` -- search in field by regex\n* `by_types(bibtypes, complement=False)` -- search by BibTeX type\n* `parse(data)` -- parse string as BibTeX data\n* `read(filename)` -- read and parse file as BibTeX data\n* `write(filename)` -- write file in BibTeX format\n\n`by_regex(field, regex)` searches the database by field values and returns the matches in a new `Biblio` object. E.g., `by_regex('author', '.*Smith.*')` returns all entries where the \"author\" field contains \"Smith\".\n\n`by_types(bibtypes, complement=False)` searches the database by BibTeX types (given without the initial `\"@\"`) and returns the matches in a new `Biblio` object. `bibtypes` can be a string specifying a single type (e.g., `\"article\"`) or a list of strings specifying several types (e.g., `[\"article\", \"book\"]`). If the optional `complement` parameter is set to True, the function returns the complement, i.e., all entries **not** matching the criteria.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/Legisign/bibparse", "keywords": "", "license": "GPLv3", "maintainer": "", "maintainer_email": "", "name": "bibparse", "package_url": "https://pypi.org/project/bibparse/", "platform": "", "project_url": "https://pypi.org/project/bibparse/", "project_urls": { "Homepage": "http://github.com/Legisign/bibparse" }, "release_url": "https://pypi.org/project/bibparse/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "Read and write BibTeX files", "version": "1.0.0" }, "last_serial": 5551276, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "2829f642ae219accd762050ac36f8308", "sha256": "7c742ee5ee11967e899cfbef7e22377a54f506d99953960912e6564c0aadf951" }, "downloads": -1, "filename": "bibparse-1.0.0-py2.7.egg", "has_sig": false, "md5_digest": "2829f642ae219accd762050ac36f8308", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 11390, "upload_time": "2019-07-18T13:40:22", "url": "https://files.pythonhosted.org/packages/b7/8f/726fde85f8a3f2d7d92adcfaaaeb654893eabdc00e6917d72806cba9fac8/bibparse-1.0.0-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "b1cd5177f9b9f25eedff6b9aac284c7b", "sha256": "68eb68e37a461b73000b07c173929cdd99c0669c11d88973c2f9f87ca44be9b5" }, "downloads": -1, "filename": "bibparse-1.0.0.tar.gz", "has_sig": false, "md5_digest": "b1cd5177f9b9f25eedff6b9aac284c7b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6193, "upload_time": "2019-07-18T13:40:24", "url": "https://files.pythonhosted.org/packages/64/b6/6b2797a231bffe0db4e2ac1d92911e9b2087b232baa68a9380519704363d/bibparse-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2829f642ae219accd762050ac36f8308", "sha256": "7c742ee5ee11967e899cfbef7e22377a54f506d99953960912e6564c0aadf951" }, "downloads": -1, "filename": "bibparse-1.0.0-py2.7.egg", "has_sig": false, "md5_digest": "2829f642ae219accd762050ac36f8308", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 11390, "upload_time": "2019-07-18T13:40:22", "url": "https://files.pythonhosted.org/packages/b7/8f/726fde85f8a3f2d7d92adcfaaaeb654893eabdc00e6917d72806cba9fac8/bibparse-1.0.0-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "b1cd5177f9b9f25eedff6b9aac284c7b", "sha256": "68eb68e37a461b73000b07c173929cdd99c0669c11d88973c2f9f87ca44be9b5" }, "downloads": -1, "filename": "bibparse-1.0.0.tar.gz", "has_sig": false, "md5_digest": "b1cd5177f9b9f25eedff6b9aac284c7b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6193, "upload_time": "2019-07-18T13:40:24", "url": "https://files.pythonhosted.org/packages/64/b6/6b2797a231bffe0db4e2ac1d92911e9b2087b232baa68a9380519704363d/bibparse-1.0.0.tar.gz" } ] }