eodag 4.0.0a2__py3-none-any.whl → 4.0.0a4__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/collection.py CHANGED
@@ -130,8 +130,9 @@ class Collection(BaseModel):
130
130
 
131
131
  @model_validator(mode="after")
132
132
  def set_id_from_alias(self) -> Self:
133
- """if an alias exists, use it to update id attribute"""
133
+ """If an alias exists, use it to update ``id`` attribute"""
134
134
  if self.alias is not None:
135
+ self._id = self.id
135
136
  self.id = self.alias
136
137
  return self
137
138
 
@@ -140,9 +141,9 @@ class Collection(BaseModel):
140
141
  def validate_collection(
141
142
  cls, values: dict[str, Any] | Self, handler: ModelWrapValidatorHandler[Self]
142
143
  ) -> Self:
143
- """Allow to create a collection instance with bad formatted attributes (except "id").
144
- Set incorrectly formatted attributes to None and ignore extra attributes.
145
- Log a warning about validation errors if EODAG_VALIDATE_COLLECTIONS is set to True.
144
+ """Allow to create a collection instance with bad formatted attributes (except ``id``).
145
+ Set incorrectly formatted attributes to ``None`` and ignore extra attributes.
146
+ Log a warning about validation errors if ``EODAG_VALIDATE_COLLECTIONS`` environment variable is set to ``True``.
146
147
  """
147
148
  errors: list[ErrorDetails] = []
148
149
  continue_validation: bool = True
@@ -236,7 +237,7 @@ class Collection(BaseModel):
236
237
  return self._dag
237
238
 
238
239
  def search(self, **kwargs: Any) -> SearchResult:
239
- """Look for products of this collection matching criteria using the `dag` attribute of the instance.
240
+ """Look for products of this collection matching criteria using the ``dag`` attribute of the instance.
240
241
 
241
242
  :param kwargs: Some other criteria that will be used to do the search,
242
243
  using parameters compatible with the provider
@@ -256,12 +257,12 @@ class Collection(BaseModel):
256
257
  return dag.search(collection=self.id, **kwargs)
257
258
 
258
259
  def list_queryables(self, **kwargs: Any) -> QueryablesDict:
259
- """Fetch the queryable properties for this collection using the `dag` attribute of the instance.
260
+ """Fetch the queryable properties for this collection using the ``dag`` attribute of the instance.
260
261
 
261
262
  :param kwargs: additional filters for queryables
262
263
 
263
264
  :returns: A :class:`~eodag.api.product.queryables.QuerybalesDict` containing the EODAG queryable
264
- properties, associating parameters to their annotated type, and a additional_properties attribute
265
+ properties, associating parameters to their annotated type, and an ``additional_properties`` attribute
265
266
  :raises: :class:`~eodag.utils.exceptions.ValidationError`: If the `collection` argument is set in `kwargs`,
266
267
  since it is already defined by the instance
267
268
  """
@@ -277,7 +278,7 @@ class Collection(BaseModel):
277
278
 
278
279
 
279
280
  class CollectionsDict(UserDict[str, Collection]):
280
- """A UserDict object which values are :class:`~eodag.api.collection.Collection` objects, keyed by provider id.
281
+ """A UserDict object which values are :class:`~eodag.api.collection.Collection` objects, keyed by provider ``id``.
281
282
 
282
283
  :param collections: A list of collections
283
284
 
@@ -290,7 +291,7 @@ class CollectionsDict(UserDict[str, Collection]):
290
291
  ) -> None:
291
292
  super().__init__()
292
293
 
293
- self.data = {col.id: col for col in collections}
294
+ self.data = {col._id: col for col in collections}
294
295
 
295
296
  def __str__(self) -> str:
296
297
  return "{" + ", ".join(f'"{col}": {col_f}' for col, col_f in self.items()) + "}"