arxiv.canonical.domain.file module

Provides bitstream-related concepts and logic.

class arxiv.canonical.domain.file.CanonicalFile(modified, size_bytes, content_type, ref, filename=None, is_gzipped=False)[source]

Bases: arxiv.canonical.domain.base.CanonicalBase

Represents a file in the canonical record, e.g. a source package.

content_type = None

The content type of the file.

exclude_from_comparison = {'is_gzipped', 'ref'}
filename = None

Filename in the canonical record.

classmethod from_dict(data)[source]

Reconstitute a CanonicalFile from a native dict.

Return type

CanonicalFile

is_gzipped = None

Whether or not the content at ref is served in gzipped form.

property mime_type

Convenience accessor for the MIME type of the file.

Return type

str

modified = None

Last time the file was modified.

ref = None

A reference to the location of the content of the file.

size_bytes = None

Size of the file in bytes.

to_dict()[source]

Generate a native dict from this CanonicalFile.

Return type

Dict[str, Any]

class arxiv.canonical.domain.file.Key(value)[source]

Bases: arxiv.canonical.domain.file.URI

The unique identifier for a bitstream in the canonical record.

class arxiv.canonical.domain.file.URI(value)[source]

Bases: str

A unique identifier for bitstream content.

Bitstream content may be located in a variety of places prior to canonicalization. For example, it may be located on a local filesystem, or at a remote location accessible via HTTP.

property is_canonical

Indicate whether the URI is a key in the canonical record.

Return type

bool

property is_file

Indicate whether the URI is a path to a local file.

Return type

bool

property is_http_url

Indicate whether the URI is an HTTP URL.

Return type

bool