Changeset View
Changeset View
Standalone View
Standalone View
swh/model/model.py
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | |||||
@attr.s | @attr.s | ||||
class Origin(BaseModel): | class Origin(BaseModel): | ||||
"""Represents a software source: a VCS and an URL.""" | """Represents a software source: a VCS and an URL.""" | ||||
url = attr.ib(type=str) | url = attr.ib(type=str) | ||||
type = attr.ib(type=Optional[str], default=None) | type = attr.ib(type=Optional[str], default=None) | ||||
def to_dict(self): | |||||
r = super().to_dict() | |||||
r.pop('type', None) | |||||
return r | |||||
@attr.s | @attr.s | ||||
class OriginVisit(BaseModel): | 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=Origin) | origin = attr.ib(type=Origin) | ||||
date = attr.ib(type=datetime.datetime) | date = attr.ib(type=datetime.datetime) | ||||
status = attr.ib( | status = attr.ib( | ||||
▲ Show 20 Lines • Show All 266 Lines • Show Last 20 Lines |