Skip to content

Commit 325f096

Browse files
committed
fix: typing
1 parent ea38cc8 commit 325f096

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

python/rustac/__init__.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,74 @@
11
from __future__ import annotations
22

33
from .rustac import *
4-
from typing import TypedDict
4+
from typing import TypedDict, Required, Any, Literal
55

66

7-
class Catalog(TypedDict):
7+
class Catalog(TypedDict, total=False):
88
"""A STAC Catalog object represents a logical group of other Catalog, Collection, and Item objects."""
99

10-
type: str
10+
type: Required[str]
1111
"""Set to Catalog if this Catalog only implements the Catalog spec."""
1212

13-
stac_version: str
13+
stac_version: Required[str]
1414
"""The STAC version the Catalog implements."""
1515

1616
stac_extensions: list[str] | None
1717
"""A list of extension identifiers the Catalog implements."""
1818

19-
id: str
19+
id: Required[str]
2020
"""Identifier for the Catalog."""
2121

2222
title: str | None
2323
"""A short descriptive one-line title for the Catalog."""
2424

25-
description: str
25+
description: Required[str]
2626
"""Detailed multi-line description to fully explain the Catalog.
2727
2828
CommonMark 0.29 syntax MAY be used for rich text representation."""
2929

30-
links: list[Link]
30+
links: Required[list[Link]]
3131
"""A list of references to other documents."""
3232

33-
class Collection(TypedDict):
33+
class Collection(TypedDict, total=False):
3434
"""The STAC Collection Specification defines a set of common fields to describe a group of Items that share properties and metadata."""
3535

36-
type: str
36+
type: Required[str]
3737
"""Must be set to Collection to be a valid Collection."""
3838

39-
stac_version: str
39+
stac_version: Required[str]
4040
"""The STAC version the Collection implements."""
4141

4242
stac_extensions: list[str] | None
4343
"""A list of extension identifiers the Collection implements."""
4444

45-
id: str
45+
id: Required[str]
4646
"""Identifier for the Collection that is unique across all collections in the root catalog."""
4747

4848
title: str | None
4949
"""A short descriptive one-line title for the Collection."""
5050

51-
description: str
51+
description: Required[str]
5252
"""Detailed multi-line description to fully explain the Collection.
5353
5454
CommonMark 0.29 syntax MAY be used for rich text representation."""
5555

5656
keywords: list[str] | None
5757
"""List of keywords describing the Collection."""
5858

59-
license: str
59+
license: Required[str]
6060
"""License(s) of the data collection as SPDX License identifier, SPDX License expression, or `other`."""
6161

6262
providers: list[Provider] | None
6363
"""A list of providers, which may include all organizations capturing or processing the data or the hosting provider."""
6464

65-
extent: Extent
65+
extent: Required[Extent]
6666
"""Spatial and temporal extents."""
6767

68-
summaries: dict[str, Any]
68+
summaries: dict[str, Any] | None
6969
"""A map of property summaries, either a set of values, a range of values or a JSON Schema."""
7070

71-
links: list[Link]
71+
links: Required[list[Link]]
7272
"""A list of references to other documents."""
7373

7474
assets: dict[str, Asset] | None
@@ -77,10 +77,10 @@ class Collection(TypedDict):
7777
item_assets: dict[str, ItemAsset] | None
7878
"""A dictionary of assets that can be found in member Items."""
7979

80-
class Provider(TypedDict):
80+
class Provider(TypedDict, total=False):
8181
"""A provider is any of the organizations that captures or processes the content of the Collection and therefore influences the data offered by this Collection."""
8282

83-
name: str
83+
name: Required[str]
8484
"""The name of the organization or the individual."""
8585

8686
description: str | None
@@ -93,7 +93,7 @@ class Provider(TypedDict):
9393
| Literal["producer"]
9494
| Literal["processor"]
9595
| Literal["host"]
96-
]
96+
] | None
9797
"""Roles of the provider."""
9898

9999
url: str | None
@@ -120,7 +120,7 @@ class TemporalExtent(TypedDict):
120120
bbox: list[list[str | None]]
121121
"""Potential temporal extents covered by the Collection."""
122122

123-
class ItemAsset(TypedDict):
123+
class ItemAsset(TypedDict, total=False):
124124
"""An Item Asset Object defined at the Collection level is nearly the same as the Asset Object in Items, except for two differences.
125125
126126
The href field is not required, because Item Asset Definitions don't point to any data by themselves, but at least two other fields must be present."""
@@ -139,19 +139,19 @@ class ItemAsset(TypedDict):
139139
roles: list[str] | None
140140
"""The semantic roles of the asset, similar to the use of rel in links."""
141141

142-
class Item(TypedDict):
142+
class Item(TypedDict, total=False):
143143
"""An Item is a GeoJSON Feature augmented with foreign members relevant to a STAC object."""
144144

145-
type: str
145+
type: Required[str]
146146
"""Type of the GeoJSON Object. MUST be set to Feature."""
147147

148-
stac_version: str
148+
stac_version: Required[str]
149149
"""The STAC version the Item implements."""
150150

151151
stac_extensions: list[str] | None
152152
"""A list of extensions the Item implements."""
153153

154-
id: str
154+
id: Required[str]
155155
"""Provider identifier. The ID should be unique within the Collection that contains the Item."""
156156

157157
geometry: dict[str, Any] | None
@@ -162,15 +162,15 @@ class Item(TypedDict):
162162
163163
Bounding Box of the asset represented by this Item, formatted according to RFC 7946, section 5."""
164164

165-
properties: Properties
165+
properties: Required[Properties]
166166
"""A dictionary of additional metadata for the Item."""
167167

168-
links: list[Link]
168+
links: Required[list[Link]]
169169
"""List of link objects to resources and related URLs.
170170
171171
See the best practices for details on when the use self links is strongly recommended."""
172172

173-
assets: dict[str, Asset]
173+
assets: Required[dict[str, Asset]]
174174
"""Dictionary of asset objects that can be downloaded, each with a unique key."""
175175

176176
collection: str | None
@@ -186,19 +186,19 @@ class Properties(TypedDict):
186186
187187
It is formatted according to RFC 3339, section 5.6. null is allowed, but requires start_datetime and end_datetime from common metadata to be set."""
188188

189-
class Link(TypedDict):
189+
class Link(TypedDict, total=False):
190190
"""This object describes a relationship with another entity.
191191
192192
Data providers are advised to be liberal with the links section, to describe
193193
things like the Catalog an Item is in, related Items, parent or child Items
194194
(modeled in different ways, like an 'acquisition' or derived data)."""
195195

196-
href: str
196+
href: Required[str]
197197
"""The actual link in the format of an URL.
198198
199199
Relative and absolute links are both allowed. Trailing slashes are significant."""
200200

201-
rel: str
201+
rel: Required[str]
202202
"""Relationship between the current document and the linked document."""
203203

204204
type: str | None
@@ -218,12 +218,12 @@ class Link(TypedDict):
218218
body: Any | None
219219
"""The HTTP body to be sent to the target resource."""
220220

221-
class Asset(TypedDict):
221+
class Asset(TypedDict, total=False):
222222
"""An Asset is an object that contains a URI to data associated with the Item that can be downloaded or streamed.
223223
224224
It is allowed to add additional fields."""
225225

226-
href: str
226+
href: Required[str]
227227
"""URI to the asset object. Relative and absolute URI are both allowed. Trailing slashes are significant."""
228228

229229
title: str | None

0 commit comments

Comments
 (0)