adsfolio.bibtex.io

File I/O utilities for bibcode and BibTeX files.

adsfolio.bibtex.io.read_bibcodes_file(file_path, sort=False)[source]

Read bibcodes from a text file.

Handles: - Comments (# or %) - Comma-separated bibcodes - Whitespace and empty lines

Parameters:
  • file_path (str or Path) – Path to the bibcode file.

  • sort (bool, optional) – Whether to sort the bibcodes. Default: False.

Returns:

List of bibcodes.

Return type:

list[str]

Examples

File format: ` 2020ApJ...900..100S  # A comment 2021MNRAS.501..123A, 2021AJ....161..147B `

adsfolio.bibtex.io.read_bibtex_file(file_path)[source]

Read a BibTeX file and extract citation keys.

Parameters:

file_path (str or Path) – Path to the BibTeX file.

Returns:

  • Raw file content

  • List of citation keys

Return type:

tuple[str, list[str]]