Changeset View
Changeset View
Standalone View
Standalone View
swh/model/model.py
Show First 20 Lines • Show All 188 Lines • ▼ Show 20 Lines | def from_iso8601(cls, s): | ||||
tstz = attr.evolve(tstz, negative_utc=True) | tstz = attr.evolve(tstz, negative_utc=True) | ||||
return tstz | return tstz | ||||
@attr.s(frozen=True) | @attr.s(frozen=True) | ||||
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) | |||||
def to_dict(self): | |||||
r = super().to_dict() | |||||
r.pop('type', None) | |||||
return r | |||||
@attr.s(frozen=True) | @attr.s(frozen=True) | ||||
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=str) | origin = attr.ib(type=str) | ||||
date = attr.ib(type=datetime.datetime) | date = attr.ib(type=datetime.datetime) | ||||
▲ Show 20 Lines • Show All 377 Lines • Show Last 20 Lines |