adsfolio.gui.library

Qt-free data definitions for the PDF library table.

class adsfolio.gui.library.Column(key, header, width, getter, sortable=True)[source]

Bases: object

Definition of one table column.

Parameters:
getter: collections.abc.Callable[[dict[str, Any]], str]
header: str
key: str
sortable: bool = True
width: int
class adsfolio.gui.library.FileQuery(view=LibraryView.ALL, search='', search_exact=False, search_wildcards=False, search_fields=(), order_by='first_seen_at', descending=True, secondary_order_by=None, tertiary_order_by=None)[source]

Bases: object

Current view, search, and sort settings for a library table.

Parameters:
descending: bool = True
order_by: str = 'first_seen_at'
search: str = ''
search_exact: bool = False
search_fields: tuple[str, ...] = ()
search_wildcards: bool = False
secondary_order_by: str | None = None
tertiary_order_by: str | None = None
to_filters()[source]

Translate this query into PdfRegistry filter arguments.

Returns:

Keyword arguments accepted by PdfRegistry.query_files.

Return type:

dict

view: adsfolio.gui.library.LibraryView = 'all'
class adsfolio.gui.library.LibraryView(*values)[source]

Bases: str, enum.Enum

A virtual view over records in one PDF library.

ALL = 'all'
ARXIV_ONLY = 'arxiv_only'
DUPLICATES = 'duplicates'
IDENTIFIED_WITHOUT_ADS = 'identified_without_ads'
RESOLVED = 'resolved'
UNRESOLVED = 'unresolved'
property description: str[source]

Explain identification evidence and the action for each view.

property label: str[source]

Name each catalog view without claiming current PDF verification.

class adsfolio.gui.library.ResolutionState(*values)

Bases: str, enum.Enum

Describe the current identification evidence for a PDF.

ADS_LINKED = 'ads_linked'
CHANGED = 'changed'
IDENTIFIED_EXTERNAL = 'identified_external'
LOCAL_METADATA = 'local_metadata'
UNRESOLVED = 'unresolved'
adsfolio.gui.library.ads_url(bibcode)[source]

Return the ADS abstract URL for bibcode.

Parameters:

bibcode (str)

Return type:

str

adsfolio.gui.library.arxiv_id(record)

Return the arXiv identifier of a file record, or an empty string.

Checks the arxiv, arxiv_id, identifier and doi fields, then the bibcode, then the file path. Any value that contains a DOI is used only if it is an arXiv DOI (10.48550/arXiv.<id>); other DOIs are skipped wherever they appear. New (2401.12345v2) and old-style (astro-ph/0601001) identifiers are recognized, as are legacy bibcodes such as 2024arXiv240112345B.

The file path is scanned for identifier-like text only, so a file name that looks like an arXiv identifier is reported as one.

Parameters:

record (collections.abc.Mapping[str, Any]) – File record with optional top-level fields and a metadata mapping.

Returns:

Identifier as found, including any version suffix.

Return type:

str

adsfolio.gui.library.arxiv_url(identifier)[source]

Return the arXiv abstract URL for a normalized identifier.

Parameters:

identifier (str)

Return type:

str

adsfolio.gui.library.build_columns(styles=())[source]

Construct the active table column definitions including custom citation columns.

Parameters:

styles (Sequence[CitationStyle], optional) – Custom citation styles to insert as runtime columns, by default ().

Returns:

Immutable column sequence with generated citation columns inserted directly after Bibcode.

Return type:

tuple[Column, …]

adsfolio.gui.library.format_count(record, key)[source]

Return a saved count as text, or an empty string when it is unknown.

Zero is shown as “0”. The same value drives numeric sorting in PdfRegistry.query_files().

Parameters:
Return type:

str

adsfolio.gui.library.format_first_seen(record, timestamp_format)[source]

Format a location’s ISO first-seen timestamp.

Parameters:
  • record (dict[str, Any]) – File record containing first_seen_at.

  • timestamp_format (str) – iso8601 or a strftime pattern.

Returns:

Formatted local timestamp, or an empty string for missing or malformed values.

Return type:

str

adsfolio.gui.library.format_mtime(record, timestamp_format)[source]

Format a record timestamp using ISO 8601 or a strftime pattern.

Parameters:
Return type:

str

adsfolio.gui.library.resolution_state(record)

Classify current evidence without changing metadata or mutation permissions.

A changed file takes priority over saved ADS links and external evidence. Usable metadata without identity evidence remains distinct from identification.

Parameters:

record (collections.abc.Mapping[str, Any])

Return type:

adsfolio.pdf.classification.ResolutionState

adsfolio.gui.library.verification_stale(record)

Return whether saved metadata refers to an earlier PDF revision.

Parameters:

record (collections.abc.Mapping[str, Any])

Return type:

bool