5151 update_nested_dict ,
5252)
5353from eodag .utils .exceptions import (
54- UnsupportedProductType ,
54+ UnsupportedCollection ,
5555 UnsupportedProvider ,
5656 ValidationError ,
5757)
5858from eodag .utils .free_text_search import compile_free_text_query
5959from eodag .utils .repr import html_table
6060
6161if TYPE_CHECKING :
62- from eodag .api .core import EODataAccessGateway
6362 from typing_extensions import Self
6463
64+ from eodag .api .core import EODataAccessGateway
65+
6566logger = logging .getLogger ("eodag.provider" )
6667
6768AUTH_TOPIC_KEYS = ("auth" , "search_auth" , "download_auth" )
@@ -259,7 +260,7 @@ class Provider:
259260 >>> provider = Provider(config)
260261 >>> provider.name
261262 'example_provider'
262- >>> 'S2_MSI_L1C' in provider.product_types
263+ >>> 'S2_MSI_L1C' in provider.collections
263264 True
264265 >>> provider.priority # Default priority
265266 0
@@ -329,7 +330,7 @@ def _repr_html_(self, show_name: bool = True) -> str:
329330 { html_table (summaries )}
330331 <br />
331332 <br />
332- { html_table (list (self .product_types .keys ()))}
333+ { html_table (list (self .collections .keys ()))}
333334 </div>
334335 """
335336
@@ -354,8 +355,8 @@ def name(self) -> str:
354355 return self ._name
355356
356357 @property
357- def product_types (self ) -> dict [str , Any ]:
358- """Return the product types dictionary for this provider."""
358+ def collections (self ) -> dict [str , Any ]:
359+ """Return the collections dictionary for this provider."""
359360 return getattr (self .config , "products" , {})
360361
361362 @property
@@ -375,20 +376,20 @@ def search_config(self) -> Optional[PluginConfig]:
375376
376377 @property
377378 def fetchable (self ) -> bool :
378- """Return True if the provider can fetch product types ."""
379+ """Return True if the provider can fetch collections ."""
379380 return bool (
380- getattr (self .search_config , "discover_product_types " , {}).get ("fetch_url" )
381+ getattr (self .search_config , "discover_collections " , {}).get ("fetch_url" )
381382 )
382383
383384 @property
384385 def unparsable_properties (self ) -> set [str ]:
385- """Return set of unparsable properties for generic product types , if any."""
386+ """Return set of unparsable properties for generic collections , if any."""
386387 if not self .fetchable or self .search_config is None :
387388 return set ()
388389
389390 props = getattr (
390- getattr (self .search_config , "discover_product_types " , None ),
391- "generic_product_type_unparsable_properties " ,
391+ getattr (self .search_config , "discover_collections " , None ),
392+ "generic_collection_unparsable_properties " ,
392393 {},
393394 )
394395 return set (props .keys ()) if isinstance (props , dict ) else set ()
@@ -434,37 +435,37 @@ def _copy_matching_credentials(
434435 self .config , key
435436 ).credentials = conf_with_creds .credentials
436437
437- def delete_product_type (self , name : str ) -> None :
438- """Remove a product type from this provider.
438+ def delete_collection (self , name : str ) -> None :
439+ """Remove a collection from this provider.
439440
440- :param name: The product type name.
441+ :param name: The collection name.
441442
442- :raises UnsupportedProductType : If the product type is not found.
443+ :raises UnsupportedCollection : If the collection is not found.
443444 """
444445 try :
445- del self .product_types [name ]
446+ del self .collections [name ]
446447 except KeyError :
447- msg = f"Product type '{ name } ' not found in provider '{ self .name } '."
448- raise UnsupportedProductType (msg )
448+ msg = f"Collection '{ name } ' not found in provider '{ self .name } '."
449+ raise UnsupportedCollection (msg )
449450
450- def sync_product_types (
451+ def sync_collections (
451452 self ,
452453 dag : EODataAccessGateway ,
453454 strict_mode : bool ,
454455 ) -> None :
455456 """
456- Synchronize product types for a provider based on strict or permissive mode.
457+ Synchronize collections for a provider based on strict or permissive mode.
457458
458459 In strict mode, removes collections not in "dag.collections_config".
459460 In permissive mode, adds empty collection to config for missing types.
460461
461462 :param dag: The gateway instance to use to list existing collections and to create new collection instances.
462- :param strict_mode: If True, remove unknown product types ; if False, add empty configs for them.
463+ :param strict_mode: If True, remove unknown collections ; if False, add empty configs for them.
463464 """
464465 products_to_remove : list [str ] = []
465466 products_to_add : list [str ] = []
466467
467- for product_id in self .product_types :
468+ for product_id in self .collections :
468469 if product_id == GENERIC_COLLECTION :
469470 continue
470471
@@ -476,26 +477,24 @@ def sync_product_types(
476477 empty_product = Collection (
477478 dag = dag , id = product_id , title = product_id , description = NOT_AVAILABLE
478479 )
479- dag .collections_config [
480- product_id
481- ] = empty_product # will update available_product_types
480+ dag .collections_config [product_id ] = empty_product
482481 products_to_add .append (product_id )
483482
484483 if products_to_add :
485484 logger .debug (
486- "Product types permissive mode, %s added (provider %s)" ,
485+ "Collections permissive mode, %s added (provider %s)" ,
487486 ", " .join (products_to_add ),
488487 self ,
489488 )
490489
491490 if products_to_remove :
492491 logger .debug (
493- "Product types strict mode, ignoring %s (provider %s)" ,
492+ "Collections strict mode, ignoring %s (provider %s)" ,
494493 ", " .join (products_to_remove ),
495494 self ,
496495 )
497496 for id in products_to_remove :
498- self .delete_product_type (id )
497+ self .delete_collection (id )
499498
500499 def _mm_already_built (self ) -> bool :
501500 """Check if metadata mapping is already built (converted to querypaths/conversion)."""
@@ -759,20 +758,20 @@ def filter_by_name_or_group(
759758 ):
760759 yield provider
761760
762- def delete_product_type (self , provider : str , product_type : str ) -> None :
761+ def delete_collection (self , provider : str , collection : str ) -> None :
763762 """
764- Delete a product type from a provider.
763+ Delete a collection from a provider.
765764
766765 :param provider: The provider's name.
767- :param product_ID: The product type to delete.
766+ :param product_ID: The collection to delete.
768767 :raises UnsupportedProvider: If the provider or product is not found.
769768 """
770769 if provider_obj := self .get (provider ):
771- if product_type in provider_obj .product_types :
772- provider_obj .delete_product_type ( product_type )
770+ if collection in provider_obj .collections :
771+ provider_obj .delete_collection ( collection )
773772 else :
774- msg = f"Product type ' { product_type } ' not found for provider '{ provider } '."
775- raise UnsupportedProductType (msg )
773+ msg = f"Collection ' { collection } ' not found for provider '{ provider } '."
774+ raise UnsupportedCollection (msg )
776775 else :
777776 msg = f"Provider '{ provider } ' not found."
778777 raise UnsupportedProvider (msg )
0 commit comments