eodag 3.0.0b1__py3-none-any.whl → 3.0.0b2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- eodag/api/core.py +6 -2
- eodag/api/product/_assets.py +50 -0
- eodag/api/product/_product.py +43 -0
- eodag/api/search_result.py +27 -0
- eodag/plugins/manager.py +1 -0
- eodag/resources/ext_product_types.json +1 -1
- eodag/utils/repr.py +113 -0
- {eodag-3.0.0b1.dist-info → eodag-3.0.0b2.dist-info}/METADATA +3 -2
- {eodag-3.0.0b1.dist-info → eodag-3.0.0b2.dist-info}/RECORD +13 -12
- {eodag-3.0.0b1.dist-info → eodag-3.0.0b2.dist-info}/WHEEL +1 -1
- {eodag-3.0.0b1.dist-info → eodag-3.0.0b2.dist-info}/LICENSE +0 -0
- {eodag-3.0.0b1.dist-info → eodag-3.0.0b2.dist-info}/entry_points.txt +0 -0
- {eodag-3.0.0b1.dist-info → eodag-3.0.0b2.dist-info}/top_level.txt +0 -0
eodag/api/core.py
CHANGED
|
@@ -1445,8 +1445,12 @@ class EODataAccessGateway:
|
|
|
1445
1445
|
start=start, end=end, geom=geom, locations=locations, **kwargs
|
|
1446
1446
|
)
|
|
1447
1447
|
for i, search_plugin in enumerate(search_plugins):
|
|
1448
|
-
itp =
|
|
1449
|
-
|
|
1448
|
+
itp = (
|
|
1449
|
+
items_per_page
|
|
1450
|
+
or getattr(search_plugin.config, "pagination", {}).get(
|
|
1451
|
+
"max_items_per_page"
|
|
1452
|
+
)
|
|
1453
|
+
or DEFAULT_MAX_ITEMS_PER_PAGE
|
|
1450
1454
|
)
|
|
1451
1455
|
logger.debug(
|
|
1452
1456
|
"Searching for all the products with provider %s and a maximum of %s "
|
eodag/api/product/_assets.py
CHANGED
|
@@ -22,6 +22,7 @@ from collections import UserDict
|
|
|
22
22
|
from typing import TYPE_CHECKING, Any, Dict, List, Optional
|
|
23
23
|
|
|
24
24
|
from eodag.utils.exceptions import NotAvailableError
|
|
25
|
+
from eodag.utils.repr import dict_to_html_table
|
|
25
26
|
|
|
26
27
|
if TYPE_CHECKING:
|
|
27
28
|
from eodag.api.product import EOProduct
|
|
@@ -84,6 +85,43 @@ class AssetsDict(UserDict):
|
|
|
84
85
|
else:
|
|
85
86
|
return [a for a in self.values() if "href" in a]
|
|
86
87
|
|
|
88
|
+
def _repr_html_(self, embeded=False):
|
|
89
|
+
thead = (
|
|
90
|
+
f"""<thead><tr><td style='text-align: left; color: grey;'>
|
|
91
|
+
{type(self).__name__} ({len(self)})
|
|
92
|
+
</td></tr></thead>
|
|
93
|
+
"""
|
|
94
|
+
if not embeded
|
|
95
|
+
else ""
|
|
96
|
+
)
|
|
97
|
+
tr_style = "style='background-color: transparent;'" if embeded else ""
|
|
98
|
+
return (
|
|
99
|
+
f"<table>{thead}"
|
|
100
|
+
+ "".join(
|
|
101
|
+
[
|
|
102
|
+
f"""<tr {tr_style}><td style='text-align: left;'>
|
|
103
|
+
<details><summary style='color: grey;'>
|
|
104
|
+
<span style='color: black'>'{k}'</span>: 
|
|
105
|
+
{{
|
|
106
|
+
{"'roles': '<span style='color: black'>"+str(v['roles'])+"</span>', "
|
|
107
|
+
if v.get("roles") else ""}
|
|
108
|
+
{"'type': '"+str(v['type'])+"', "
|
|
109
|
+
if v.get("type") else ""}
|
|
110
|
+
{"'title': '<span style='color: black'>"+str(v['title'])+"</span>', "
|
|
111
|
+
if v.get("title") else ""}
|
|
112
|
+
...
|
|
113
|
+
}}
|
|
114
|
+
</summary>
|
|
115
|
+
{dict_to_html_table(v, depth=1)}
|
|
116
|
+
</details>
|
|
117
|
+
</td></tr>
|
|
118
|
+
"""
|
|
119
|
+
for k, v in self.items()
|
|
120
|
+
]
|
|
121
|
+
)
|
|
122
|
+
+ "</table>"
|
|
123
|
+
)
|
|
124
|
+
|
|
87
125
|
|
|
88
126
|
class Asset(UserDict):
|
|
89
127
|
"""A UserDict object containg one of the assets of a
|
|
@@ -127,3 +165,15 @@ class Asset(UserDict):
|
|
|
127
165
|
:rtype: str
|
|
128
166
|
"""
|
|
129
167
|
return self.product.download(asset=self.key, **kwargs)
|
|
168
|
+
|
|
169
|
+
def _repr_html_(self):
|
|
170
|
+
thead = f"""<thead><tr><td style='text-align: left; color: grey;'>
|
|
171
|
+
{type(self).__name__} - {self.key}
|
|
172
|
+
</td></tr></thead>
|
|
173
|
+
"""
|
|
174
|
+
return f"""<table>{thead}
|
|
175
|
+
<tr><td style='text-align: left;'>
|
|
176
|
+
{dict_to_html_table(self)}
|
|
177
|
+
</details>
|
|
178
|
+
</td></tr>
|
|
179
|
+
</table>"""
|
eodag/api/product/_product.py
CHANGED
|
@@ -51,6 +51,7 @@ from eodag.utils import (
|
|
|
51
51
|
get_geometry_from_various,
|
|
52
52
|
)
|
|
53
53
|
from eodag.utils.exceptions import DownloadError, MisconfiguredError
|
|
54
|
+
from eodag.utils.repr import dict_to_html_table
|
|
54
55
|
|
|
55
56
|
if TYPE_CHECKING:
|
|
56
57
|
from shapely.geometry.base import BaseGeometry
|
|
@@ -517,3 +518,45 @@ class EOProduct:
|
|
|
517
518
|
)
|
|
518
519
|
pass
|
|
519
520
|
return NoDriver()
|
|
521
|
+
|
|
522
|
+
def _repr_html_(self):
|
|
523
|
+
thumbnail = self.properties.get("thumbnail", None)
|
|
524
|
+
thumbnail_html = (
|
|
525
|
+
f"<img src='{thumbnail}' width=100 alt='thumbnail'/>"
|
|
526
|
+
if thumbnail and not thumbnail.startswith("s3")
|
|
527
|
+
else ""
|
|
528
|
+
)
|
|
529
|
+
geom_style = "style='color: grey; text-align: center; min-width:100px; vertical-align: top;'"
|
|
530
|
+
thumbnail_style = (
|
|
531
|
+
"style='padding-top: 1.5em; min-width:100px; vertical-align: top;'"
|
|
532
|
+
)
|
|
533
|
+
|
|
534
|
+
return f"""<table>
|
|
535
|
+
<thead><tr style='background-color: transparent;'><td style='text-align: left; color: grey;'>
|
|
536
|
+
{type(self).__name__}
|
|
537
|
+
</td></tr></thead>
|
|
538
|
+
|
|
539
|
+
<tr style='background-color: transparent;'>
|
|
540
|
+
<td style='text-align: left; vertical-align: top;'>
|
|
541
|
+
{dict_to_html_table({
|
|
542
|
+
"provider": self.provider,
|
|
543
|
+
"product_type": self.product_type,
|
|
544
|
+
"properties["id"]": self.properties.get('id', None),
|
|
545
|
+
"properties["startTimeFromAscendingNode"]": self.properties.get(
|
|
546
|
+
'startTimeFromAscendingNode', None
|
|
547
|
+
),
|
|
548
|
+
"properties["completionTimeFromAscendingNode"]": self.properties.get(
|
|
549
|
+
'completionTimeFromAscendingNode', None
|
|
550
|
+
),
|
|
551
|
+
}, brackets=False)}
|
|
552
|
+
<details><summary style='color: grey; margin-top: 10px;'>properties: ({
|
|
553
|
+
len(self.properties)
|
|
554
|
+
})</summary>{dict_to_html_table(self.properties, depth=1)}</details>
|
|
555
|
+
<details><summary style='color: grey; margin-top: 10px;'>assets: ({
|
|
556
|
+
len(self.assets)
|
|
557
|
+
})</summary>{self.assets._repr_html_(embeded=True)}</details>
|
|
558
|
+
</td>
|
|
559
|
+
<td {geom_style} title='geometry'>geometry<br />{self.geometry._repr_svg_()}</td>
|
|
560
|
+
<td {thumbnail_style} title='properties["thumbnail"]'>{thumbnail_html}</td>
|
|
561
|
+
</tr>
|
|
562
|
+
</table>"""
|
eodag/api/search_result.py
CHANGED
|
@@ -174,6 +174,33 @@ class SearchResult(UserList):
|
|
|
174
174
|
"""
|
|
175
175
|
return self.as_geojson_object()
|
|
176
176
|
|
|
177
|
+
def _repr_html_(self):
|
|
178
|
+
total_count = f"/{self.number_matched}" if self.number_matched else ""
|
|
179
|
+
return (
|
|
180
|
+
f"""<table>
|
|
181
|
+
<thead><tr><td style='text-align: left; color: grey;'>
|
|
182
|
+
{type(self).__name__} ({len(self)}{total_count})
|
|
183
|
+
</td></tr></thead>
|
|
184
|
+
"""
|
|
185
|
+
+ "".join(
|
|
186
|
+
[
|
|
187
|
+
f"""<tr><td style='text-align: left;'>
|
|
188
|
+
<details><summary style='color: grey; font-family: monospace;'>
|
|
189
|
+
{i} 
|
|
190
|
+
{type(p).__name__}(id=<span style='color: black;'>{
|
|
191
|
+
p.properties['id']
|
|
192
|
+
}</span>, provider={p.provider})
|
|
193
|
+
</summary>
|
|
194
|
+
{p._repr_html_()}
|
|
195
|
+
</details>
|
|
196
|
+
</td></tr>
|
|
197
|
+
"""
|
|
198
|
+
for i, p in enumerate(self)
|
|
199
|
+
]
|
|
200
|
+
)
|
|
201
|
+
+ "</table>"
|
|
202
|
+
)
|
|
203
|
+
|
|
177
204
|
|
|
178
205
|
class RawSearchResult(UserList):
|
|
179
206
|
"""An object representing a collection of raw/unparsed search results obtained from a provider.
|
eodag/plugins/manager.py
CHANGED
|
@@ -242,6 +242,7 @@ class PluginManager:
|
|
|
242
242
|
self._build_plugin(product.provider, download, Download),
|
|
243
243
|
)
|
|
244
244
|
elif api := getattr(plugin_conf, "api", None):
|
|
245
|
+
plugin_conf.api.products = plugin_conf.products
|
|
245
246
|
plugin_conf.api.priority = plugin_conf.priority
|
|
246
247
|
plugin = cast(Api, self._build_plugin(product.provider, api, Api))
|
|
247
248
|
else:
|