eodag 3.5.0__py3-none-any.whl → 3.6.0__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.
@@ -17,7 +17,6 @@
17
17
  # limitations under the License.
18
18
  from __future__ import annotations
19
19
 
20
- import functools
21
20
  import hashlib
22
21
  import logging
23
22
  import re
@@ -61,6 +60,7 @@ from eodag.utils import (
61
60
  get_geometry_from_various,
62
61
  is_range_in_range,
63
62
  )
63
+ from eodag.utils.cache import instance_cached_method
64
64
  from eodag.utils.exceptions import DownloadError, NotAvailableError, ValidationError
65
65
  from eodag.utils.requests import fetch_json
66
66
 
@@ -317,17 +317,17 @@ def append_time(input_date: date, time: Optional[str]) -> datetime:
317
317
 
318
318
 
319
319
  def parse_date(
320
- date_str: str, time: Optional[Union[str, list[str]]]
320
+ date: str, time: Optional[Union[str, list[str]]]
321
321
  ) -> tuple[datetime, datetime]:
322
322
  """Parses a date string in formats YYYY-MM-DD, YYYMMDD, solo or in start/end or start/to/end intervals."""
323
- if "to" in date_str:
324
- start_date_str, end_date_str = date_str.split("/to/")
325
- elif "/" in date_str:
326
- dates = date_str.split("/")
323
+ if "to" in date:
324
+ start_date_str, end_date_str = date.split("/to/")
325
+ elif "/" in date:
326
+ dates = date.split("/")
327
327
  start_date_str = dates[0]
328
328
  end_date_str = dates[-1]
329
329
  else:
330
- start_date_str = end_date_str = date_str
330
+ start_date_str = end_date_str = date
331
331
 
332
332
  # Update YYYYMMDD formatted dates
333
333
  if re.match(r"^\d{8}$", start_date_str):
@@ -401,6 +401,8 @@ def ecmwf_temporal_to_eodag(
401
401
  start = end = None
402
402
 
403
403
  if date := params.get("date"):
404
+ if isinstance(date, list):
405
+ date = "/".join(date)
404
406
  start, end = parse_date(date, params.get("time"))
405
407
 
406
408
  elif year := (params.get("year") or params.get("hyear")):
@@ -1099,6 +1101,7 @@ class ECMWFSearch(PostJsonSearch):
1099
1101
 
1100
1102
  return qp
1101
1103
 
1104
+ @instance_cached_method()
1102
1105
  def _fetch_data(self, url: str) -> Any:
1103
1106
  """
1104
1107
  fetches from a provider elements like constraints or forms.
@@ -1115,7 +1118,7 @@ class ECMWFSearch(PostJsonSearch):
1115
1118
  else None
1116
1119
  )
1117
1120
  timeout = getattr(self.config, "timeout", DEFAULT_SEARCH_TIMEOUT)
1118
- return functools.lru_cache()(fetch_json)(url, auth=auth, timeout=timeout)
1121
+ return fetch_json(url, auth=auth, timeout=timeout)
1119
1122
 
1120
1123
  def normalize_results(
1121
1124
  self, results: RawSearchResult, **kwargs: Any
@@ -1173,7 +1173,10 @@ class QueryStringSearch(Search):
1173
1173
 
1174
1174
  collection = getattr(self.config, "collection", None)
1175
1175
  if collection is None:
1176
- collection = prep.product_type_def_params.get("collection") or product_type
1176
+ collection = (
1177
+ getattr(prep, "product_type_def_params", {}).get("collection")
1178
+ or product_type
1179
+ )
1177
1180
 
1178
1181
  if collection is None:
1179
1182
  return ()