Skip to content

files

Classes for representing and resolving file references.

AttachmentReference

Bases: FileReference

Reference to an attachment.

EventFileReference

Bases: FileReference

Reference to an event-related file.

FileReference

Base class for all references to local or remote files in the XML data.

Do not instantiate directly; use the sub-classes instead.

Attributes:

Name Type Description
template_field str

The URL formatting template to use. Set by the sub-classes.

name str

The file reference (as found in the XML), typically a URL or an internal filename.

checksum Optional[str]

The CRC32 checksum for the file. Only specified for internal filenames.

is_local property

is_local

Whether this is a local filename.

url property

url

The URL at which this file can be accessed.

from_xml classmethod

from_xml(elem)

Instantiates a new file reference from a corresponding XML element.

to_xml

to_xml(tag='url')

Parameters:

Name Type Description Default
tag str

Name of outer tag in which this file reference should be wrapped. Defaults to "url".

'url'

Returns:

Type Description
_Element

A serialization of this file reference in Anthology XML format.

PDFReference

Bases: FileReference

Reference to a PDF file.

PDFThumbnailReference

Bases: FileReference

Reference to a PDF thumbnail image.

PapersWithCodeReference

Class aggregating Papers with Code (PwC) links in a paper.

Attributes:

Name Type Description
code Optional[tuple[str | None, str]]

An official code repository, given as a tuple of the form (name, url).

community_code bool

Whether the PwC page of the paper has additional, community-provided code links.

datasets list[tuple[str | None, str]]

A list of datasets on PwC, given as tuples of the form (name, url).

append_from_xml

append_from_xml(elem)

Appends information from a <pwccode> or <pwcdataset> block to this reference.

to_xml_list

to_xml_list()

Returns:

Type Description
list[_Element]

A serialization of all PapersWithCode information as a list of corresponding XML tags in the Anthology XML format.

VideoReference

Bases: FileReference

Reference to a video.