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 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 = items_per_page or search_plugin.config.pagination.get(
1449
- "max_items_per_page", DEFAULT_MAX_ITEMS_PER_PAGE
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 "
@@ -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__}&ensp;({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>:&ensp;
105
+ {{
106
+ {"'roles': '<span style='color: black'>"+str(v['roles'])+"</span>',&ensp;"
107
+ if v.get("roles") else ""}
108
+ {"'type': '"+str(v['type'])+"',&ensp;"
109
+ if v.get("type") else ""}
110
+ {"'title': '<span style='color: black'>"+str(v['title'])+"</span>',&ensp;"
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__}&ensp;-&ensp;{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>"""
@@ -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[&quot;id&quot;]": self.properties.get('id', None),
545
+ "properties[&quot;startTimeFromAscendingNode&quot;]": self.properties.get(
546
+ 'startTimeFromAscendingNode', None
547
+ ),
548
+ "properties[&quot;completionTimeFromAscendingNode&quot;]": self.properties.get(
549
+ 'completionTimeFromAscendingNode', None
550
+ ),
551
+ }, brackets=False)}
552
+ <details><summary style='color: grey; margin-top: 10px;'>properties:&ensp;({
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:&ensp;({
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[&quot;thumbnail&quot;]'>{thumbnail_html}</td>
561
+ </tr>
562
+ </table>"""
@@ -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__}&ensp;({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}&ensp;
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: