3
3
"""
4
4
5
5
# flake8: noqa
6
- from pystac .errors import (STACError , STACTypeError , RequiredPropertyMissing ) # type:ignore
6
+ from pystac .errors import (
7
+ STACError , # type:ignore
8
+ STACTypeError , # type:ignore
9
+ RequiredPropertyMissing , # type:ignore
10
+ )
7
11
8
12
from typing import Any , Dict , Optional
9
- from pystac .version import (__version__ , get_stac_version , set_stac_version ) # type:ignore
13
+ from pystac .version import (
14
+ __version__ ,
15
+ get_stac_version , # type:ignore
16
+ set_stac_version , # type:ignore
17
+ )
10
18
from pystac .stac_io import StacIO # type:ignore
11
- from pystac .stac_object import ( STACObject , STACObjectType ) # type:ignore
19
+ from pystac .stac_object import STACObject , STACObjectType # type:ignore
12
20
from pystac .media_type import MediaType # type:ignore
13
- from pystac .link import ( Link , HIERARCHICAL_LINKS ) # type:ignore
14
- from pystac .catalog import ( Catalog , CatalogType ) # type:ignore
21
+ from pystac .link import Link , HIERARCHICAL_LINKS # type:ignore
22
+ from pystac .catalog import Catalog , CatalogType # type:ignore
15
23
from pystac .collection import (
16
24
Collection , # type:ignore
17
25
Extent , # type:ignore
18
26
SpatialExtent , # type:ignore
19
27
TemporalExtent , # type:ignore
20
28
Provider , # type:ignore
21
29
Summaries , # type:ignore
22
- RangeSummary ) # type:ignore
23
- from pystac .item import (Item , Asset , CommonMetadata ) # type:ignore
30
+ RangeSummary , # type:ignore
31
+ )
32
+ from pystac .item import Item , Asset , CommonMetadata # type:ignore
24
33
25
34
import pystac .validation
26
35
from pystac .validation import STACValidationError # type:ignore
40
49
import pystac .extensions .version
41
50
import pystac .extensions .view
42
51
43
- EXTENSION_HOOKS = pystac .extensions .hooks .RegisteredExtensionHooks ([
44
- pystac .extensions .datacube .DATACUBE_EXTENSION_HOOKS , pystac .extensions .eo .EO_EXTENSION_HOOKS ,
45
- pystac .extensions .file .FILE_EXTENSION_HOOKS ,
46
- pystac .extensions .item_assets .ITEM_ASSETS_EXTENSION_HOOKS ,
47
- pystac .extensions .label .LABEL_EXTENSION_HOOKS ,
48
- pystac .extensions .pointcloud .POINTCLOUD_EXTENSION_HOOKS ,
49
- pystac .extensions .projection .PROJECTION_EXTENSION_HOOKS ,
50
- pystac .extensions .sar .SAR_EXTENSION_HOOKS , pystac .extensions .sat .SAT_EXTENSION_HOOKS ,
51
- pystac .extensions .scientific .SCIENTIFIC_EXTENSION_HOOKS ,
52
- pystac .extensions .timestamps .TIMESTAMPS_EXTENSION_HOOKS ,
53
- pystac .extensions .version .VERSION_EXTENSION_HOOKS , pystac .extensions .view .VIEW_EXTENSION_HOOKS
54
- ])
52
+ EXTENSION_HOOKS = pystac .extensions .hooks .RegisteredExtensionHooks (
53
+ [
54
+ pystac .extensions .datacube .DATACUBE_EXTENSION_HOOKS ,
55
+ pystac .extensions .eo .EO_EXTENSION_HOOKS ,
56
+ pystac .extensions .file .FILE_EXTENSION_HOOKS ,
57
+ pystac .extensions .item_assets .ITEM_ASSETS_EXTENSION_HOOKS ,
58
+ pystac .extensions .label .LABEL_EXTENSION_HOOKS ,
59
+ pystac .extensions .pointcloud .POINTCLOUD_EXTENSION_HOOKS ,
60
+ pystac .extensions .projection .PROJECTION_EXTENSION_HOOKS ,
61
+ pystac .extensions .sar .SAR_EXTENSION_HOOKS ,
62
+ pystac .extensions .sat .SAT_EXTENSION_HOOKS ,
63
+ pystac .extensions .scientific .SCIENTIFIC_EXTENSION_HOOKS ,
64
+ pystac .extensions .timestamps .TIMESTAMPS_EXTENSION_HOOKS ,
65
+ pystac .extensions .version .VERSION_EXTENSION_HOOKS ,
66
+ pystac .extensions .view .VIEW_EXTENSION_HOOKS ,
67
+ ]
68
+ )
55
69
56
70
57
71
def read_file (href : str ) -> STACObject :
@@ -72,9 +86,9 @@ def read_file(href: str) -> STACObject:
72
86
return STACObject .from_file (href )
73
87
74
88
75
- def write_file (obj : STACObject ,
76
- include_self_link : bool = True ,
77
- dest_href : Optional [ str ] = None ) -> None :
89
+ def write_file (
90
+ obj : STACObject , include_self_link : bool = True , dest_href : Optional [ str ] = None
91
+ ) -> None :
78
92
"""Writes a STACObject to a file.
79
93
80
94
This will write only the Catalog, Collection or Item ``obj``. It will not attempt
@@ -97,10 +111,12 @@ def write_file(obj: STACObject,
97
111
obj .save_object (include_self_link = include_self_link , dest_href = dest_href )
98
112
99
113
100
- def read_dict (d : Dict [str , Any ],
101
- href : Optional [str ] = None ,
102
- root : Optional [Catalog ] = None ,
103
- stac_io : Optional [StacIO ] = None ) -> STACObject :
114
+ def read_dict (
115
+ d : Dict [str , Any ],
116
+ href : Optional [str ] = None ,
117
+ root : Optional [Catalog ] = None ,
118
+ stac_io : Optional [StacIO ] = None ,
119
+ ) -> STACObject :
104
120
"""Reads a STAC object from a dict representing the serialized JSON version of the
105
121
STAC object.
106
122
0 commit comments