…
class ShortVideoSegment(BaseModel):
title: str
start: str
end: str
logo: str
class ShortVideo(BaseModel):
url: str
segments: List[ShortVideoSegment]
…
class ShortVideoSegment(BaseModel):
title: str
start: str
end: str
logo: str
class ShortVideo(BaseModel):
url: str
segments: List[ShortVideoSegment]
It looks like a pydantic model.
It defines ShortVideo
to have an attribute url
of type str
and an attribute segments
, which is a list of ShortVideSegment
. In turn, ShortVideoSegment
is defined to have attributes title
, start
, end
, and logo
, all of type str.
Example:
seg1 = ShortVideoSegment(title='aaa1', start="0", end="1", logo="aaaa_logo")
seg2 = ShortVideoSegment(title="aaa2", start="1", end="2", logo="aaaa_logo")
video1 = ShortVideo(url="url.com", segments=[seg1, seg2])
seg_error = ShortVideoSegment(title="bbb", start=33) # Should complain that `start` is not a string, and that `end` and `logo` are required.