Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup docstring #462

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions bibtexparser/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,19 @@ def parse_string(
):
"""Parse a BibTeX string.

Args:
bibtex_str (str): BibTeX string to parse
parse_stack (Optional[Iterable[Middleware]], optional): List of middleware to apply to the database after splitting. If None (default), a default stack will be used providing simple standard functionality will be used.
append_middleware (Optional[Iterable[Middleware]], optional): List of middleware to append to the default stack (ignored if a not-None parse_stack is passed).
library (Optional[Library], optional): Library to add entries to. If None (default), a new library will be created.

Returns:
Library: Parsed BibTeX database
:param bibtex_str: BibTeX string to parse
:param parse_stack:
List of middleware to apply to the database after splitting.
If ``None`` (default), a default stack will be used providing simple standard functionality.

:param append_middleware:
List of middleware to append to the default stack
(ignored if a not-``None`` parse_stack is passed).

:param library:
Library to add entries to. If ``None`` (default), a new library will be created.

:return: Library: Parsed BibTeX database
"""
splitter = Splitter(bibstr=bibtex_str)
library = splitter.split(library=library)
Expand All @@ -103,14 +108,17 @@ def parse_file(
) -> Library:
"""Parse a BibTeX file

Args:
path (str): Path to BibTeX file
parse_stack (Optional[Iterable[Middleware]], optional): List of middleware to apply to the database after splitting. If None (default), a default stack will be used providing simple standard functionality will be used.
append_middleware (Optional[Iterable[Middleware]], optional): List of middleware to append to the default stack (ignored if a not-None parse_stack is passed).
encoding: Encoding of the .bib file. Default encoding is "UTF-8".
:param path: Path to BibTeX file
:param parse_stack:
List of middleware to apply to the database after splitting.
If ``None`` (default), a default stack will be used providing simple standard functionality.

:param append_middleware:
List of middleware to append to the default stack
(ignored if a not-``None`` parse_stack is passed).

Returns:
Library: Parsed BibTeX library
:param encoding: Encoding of the .bib file. Default encoding is ``"UTF-8"``.
:return: Library: Parsed BibTeX library
"""
with open(path, encoding=encoding) as f:
bibtex_str = f.read()
Expand Down
Loading