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
¶ -
- Type
rtype
-
property
listings
¶ -
- Type
rtype
-
property
-
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.
-
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).-
key
= None¶ Full key (path) at which the entry is stored.
-
-
class
arxiv.canonical.record.
RecordEPrint
(name, members, domain)[source]¶
-
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.
-
class
arxiv.canonical.record.
RecordMetadata
(key, stream, domain)[source]¶ Bases:
arxiv.canonical.record.core.RecordEntry
An entry for version metadata.
-
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
- Return type
-
classmethod
-
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.
-
property
-
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 andMM
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 anRecordVersion
.- Return type
-
property
identifier
¶ -
- Type
rtype
-
instance_to_domain
()[source]¶ Deserialize an
RecordVersion
to anVersion
.- Return type
-
classmethod
make_manifest_key
(ident)[source]¶ Generate a full key that can be used to store a manifest.
- Return type
-
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
- Return type
-
property
metadata
¶ JSON document containing canonical e-print metadata.
- Return type
-
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]