Skip to content

Commit 2fb24b8

Browse files
committed
Add type annotations for Asset attributes
1 parent 4f31e3b commit 2fb24b8

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

pystac/asset.py

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,35 @@ class Asset:
2727
properties : Optional, additional properties for this asset. This is used
2828
by extensions as a way to serialize and deserialize properties on asset
2929
object JSON.
30-
31-
Attributes:
32-
href : Link to the asset object. Relative and absolute links are both
33-
allowed.
34-
title : Optional displayed title for clients and users.
35-
description : A description of the Asset providing additional details,
36-
such as how it was processed or created. CommonMark 0.29 syntax MAY be
37-
used for rich text representation.
38-
media_type : Optional description of the media type. Registered Media Types
39-
are preferred. See :class:`~pystac.MediaType` for common media types.
40-
properties : Optional, additional properties for this asset. This is used
41-
by extensions as a way to serialize and deserialize properties on asset
42-
object JSON.
43-
owner: The Item or Collection this asset belongs to, or None if it has no owner.
4430
"""
4531

32+
href: str
33+
"""Link to the asset object. Relative and absolute links are both allowed."""
34+
35+
title: Optional[str]
36+
"""Optional displayed title for clients and users."""
37+
38+
description: Optional[str]
39+
"""A description of the Asset providing additional details, such as how it was
40+
processed or created. CommonMark 0.29 syntax MAY be used for rich text
41+
representation."""
42+
43+
media_type: Optional[str]
44+
"""Optional description of the media type. Registered Media Types are preferred.
45+
See :class:`~pystac.MediaType` for common media types."""
46+
47+
roles: Optional[List[str]]
48+
"""Optional, Semantic roles (i.e. thumbnail, overview, data, metadata) of the
49+
asset."""
50+
51+
owner: Optional[Union[pystac.Item, pystac.Collection]]
52+
"""The :class:`~pystac.Item` or :class:`~pystac.Collection` that this asset belongs
53+
to, or ``None`` if it has no owner."""
54+
55+
properties: Optional[Dict[str, Any]]
56+
"""Optional, additional properties for this asset. This is used by extensions as a
57+
way to serialize and deserialize properties on asset object JSON."""
58+
4659
def __init__(
4760
self,
4861
href: str,
@@ -64,7 +77,7 @@ def __init__(
6477
self.properties = {}
6578

6679
# The Item which owns this Asset.
67-
self.owner: Optional[Union[pystac.Item, pystac.Collection]] = None
80+
self.owner = None
6881

6982
def set_owner(self, obj: Union["Collection_Type", "Item_Type"]) -> None:
7083
"""Sets the owning item of this Asset.

0 commit comments

Comments
 (0)