arxiv.canonical.record package

Defines how the canonical record is represented in a key-binary system.

The bulk of this module is concerned with how keys for records and record manifests are generated.

Classes in this module are largely isomorphic to those in domain. RecordEntry represents content at the bitstream level, e.g. a file containing a listings document or a render PDF. Collections of entries are based on RecordBase, and are composed hierarchically with the apex at Record.

class arxiv.canonical.record.Record(name, members, domain)[source]

Bases: arxiv.canonical.record.core.RecordBase

The apex container for the canonical record.

property eprints

RecordEPrints

Type

rtype

property listings

RecordListings

Type

rtype

classmethod make_manifest_key(_)[source]

Make a key for global manifest.

Returns

Return type

str

Return type

Key

class arxiv.canonical.record.RecordBase(name, members, domain)[source]

Bases: typing.Generic

Generic base class for record collections in this module.

This produces a uniform protocol for record collections, while allowing name, member, and member name types to vary across collection subclasses.

classmethod make_manifest_key(name)[source]

Generate a full key that can be used to store a manifest.

Return type

Key

class arxiv.canonical.record.RecordDay(name, members, domain)[source]

Bases: arxiv.canonical.record.core.RecordBase

classmethod make_manifest_key(date)[source]

Make a key for a daily e-print manifest.

Returns

Return type

str

Return type

Key

class arxiv.canonical.record.RecordEntry(key, stream, domain)[source]

Bases: typing.Generic

An entry in the canonical record.

Comprised of a RecordStream and a domain representation of the entry (i.e. the application-level interpretation of the stream).

classmethod from_domain(d)[source]
Return type

~_Self

key = None

Full key (path) at which the entry is stored.

property name

str

Type

rtype

classmethod to_domain(stream)[source]
Return type

~_EDomain

class arxiv.canonical.record.RecordEPrint(name, members, domain)[source]

Bases: arxiv.canonical.record.core.RecordBase

classmethod make_key(idn)[source]

Make a key prefix for an e-print record.

Parameters

idn (str) – arXiv identifier

Returns

Return type

str

Return type

Key

classmethod make_manifest_key(ident)[source]

Make a key for an e-print manifest.

Returns

Return type

str

Return type

Key

class arxiv.canonical.record.RecordEPrints(name, members, domain)[source]

Bases: arxiv.canonical.record.core.RecordBase

classmethod make_manifest_key(_)[source]

Make a key for all e-print manifest.

Returns

Return type

str

Return type

Key

class arxiv.canonical.record.RecordFile(key, stream, domain)[source]

Bases: arxiv.canonical.record.core.RecordEntry

An entry that is handled as an otherwise-uninterpreted file.

class arxiv.canonical.record.RecordListing(key, stream, domain)[source]

Bases: arxiv.canonical.record.core.RecordEntry

A listing entry.

property created

datetime

Type

rtype

classmethod from_domain(listing)[source]

Serialize a Listing.

Return type

~_Self

classmethod from_stream(key, stream)[source]
Return type

RecordListing

classmethod make_key(identifier)[source]
Return type

Key

classmethod make_prefix(date)[source]
Return type

str

property name

str

Type

rtype

classmethod to_domain(stream)[source]
Return type

Listing

class arxiv.canonical.record.RecordListingDay(name, members, domain)[source]

Bases: arxiv.canonical.record.core.RecordBase

classmethod make_manifest_key(date)[source]

Generate a full key that can be used to store a manifest.

Return type

Key

class arxiv.canonical.record.RecordListingMonth(name, members, domain)[source]

Bases: arxiv.canonical.record.core.RecordBase

classmethod make_manifest_key(year_and_month)[source]

Make a key for a monthly listing manifest.

Returns

Return type

str

Return type

Key

class arxiv.canonical.record.RecordListingYear(name, members, domain)[source]

Bases: arxiv.canonical.record.core.RecordBase

classmethod make_manifest_key(year)[source]

Make a key for a yearly listing manifest.

Returns

Return type

str

Return type

Key

class arxiv.canonical.record.RecordListings(name, members, domain)[source]

Bases: arxiv.canonical.record.core.RecordBase

classmethod make_manifest_key(_)[source]

Make a key for a root listing manifest.

Returns

Return type

str

Return type

Key

class arxiv.canonical.record.RecordMetadata(key, stream, domain)[source]

Bases: arxiv.canonical.record.core.RecordEntry

An entry for version metadata.

classmethod from_domain(version)[source]
Return type

~_Self

classmethod from_stream(key, stream)[source]
Return type

RecordMetadata

classmethod make_key(identifier)[source]
Return type

Key

classmethod make_prefix(ident)[source]

Make a key prefix for an e-print record.

Parameters
  • date (datetime.date) – The day on which the first version of the e-print was announced.

  • ident (str) – arXiv identifier

Returns

Return type

str

Return type

str

classmethod to_domain(stream)[source]
Return type

Version

class arxiv.canonical.record.RecordMonth(name, members, domain)[source]

Bases: arxiv.canonical.record.core.RecordBase

classmethod make_manifest_key(year_and_month)[source]

Make a key for a monthly e-print manifest.

Returns

Return type

str

Return type

Key

class arxiv.canonical.record.RecordStream[source]

Bases: tuple

A single bitstream in the record.

property content

Raw content of the entry.

property content_type

MIME-type of the content.

property domain

Alias for field number 0

property size_bytes

Size of content in bytes.

class arxiv.canonical.record.RecordVersion(name, members, domain)[source]

Bases: arxiv.canonical.record.core.RecordBase

A collection of serialized components that make up a version record.

A version record is comprised of (1) a metadata record, (2) a source package, containing the original content provided by the submitter, and (3) a canonical rendering of the version (e.g. in PDF format).

The key prefix structure for an version record is:

` e-prints/<YYYY>/<MM>/<arXiv ID>/v<version>/ `

Where YYYY is the year and MM the month during which the first version of the e-print was announced.

Sub-keys are:

  • Metadata record: <arXiv ID>v<version>.json

  • Source package: <arXiv ID>v<version>.tar

  • PDF: <arXiv ID>v<version>.render

  • Manifest: <arXiv ID>v<version>.manifest.json

property formats

Dict[ContentType, RecordEntry[~_EDomain]]

Type

rtype

classmethod from_domain(version, dereferencer, metadata=None)[source]

Serialize an Version to an RecordVersion.

Return type

RecordVersion

property identifier

VersionedIdentifier

Type

rtype

instance_to_domain()[source]

Deserialize an RecordVersion to an Version.

Return type

Version

classmethod make_key(identifier, filename=None)[source]
Return type

Key

classmethod make_manifest_key(ident)[source]

Generate a full key that can be used to store a manifest.

Return type

Key

classmethod make_prefix(ident)[source]

Make a key prefix for an e-print record.

Parameters
  • date (datetime.date) – The day on which the first version of the e-print was announced.

  • ident (str) – arXiv identifier

Returns

Return type

str

Return type

str

property metadata

JSON document containing canonical e-print metadata.

Return type

RecordMetadata

property render

Canonical PDF for the e-print.

Return type

Optional[RecordEntry[~_EDomain]]

property source

Gzipped tarball containing the e-print source.

Return type

RecordEntry[~_EDomain]

class arxiv.canonical.record.RecordYear(name, members, domain)[source]

Bases: arxiv.canonical.record.core.RecordBase

classmethod make_manifest_key(year)[source]

Make a key for a yearly e-print manifest.

Returns

Return type

str

Return type

Key