Changeset View
Changeset View
Standalone View
Standalone View
swh/model/model.py
Show First 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | class OriginVisit(BaseModel): | ||||
"""Represents a visit of an origin at a given point in time, by a | """Represents a visit of an origin at a given point in time, by a | ||||
SWH loader.""" | SWH loader.""" | ||||
origin = attr.ib(type=str) | origin = attr.ib(type=str) | ||||
date = attr.ib(type=datetime.datetime) | date = attr.ib(type=datetime.datetime) | ||||
status = attr.ib( | status = attr.ib( | ||||
type=str, | type=str, | ||||
validator=attr.validators.in_(['ongoing', 'full', 'partial'])) | validator=attr.validators.in_(['ongoing', 'full', 'partial'])) | ||||
type = attr.ib(type=str) | type = attr.ib(type=str) | ||||
snapshot = attr.ib(type=Sha1Git) | snapshot = attr.ib(type=Optional[Sha1Git]) | ||||
metadata = attr.ib(type=Optional[Dict[str, object]], | metadata = attr.ib(type=Optional[Dict[str, object]], | ||||
default=None) | default=None) | ||||
visit = attr.ib(type=Optional[int], | visit = attr.ib(type=Optional[int], | ||||
default=None) | default=None) | ||||
"""Should not be set before calling 'origin_visit_add()'.""" | """Should not be set before calling 'origin_visit_add()'.""" | ||||
def to_dict(self): | def to_dict(self): | ||||
▲ Show 20 Lines • Show All 310 Lines • Show Last 20 Lines |