Source code for eodag.api.product.drivers

# -*- coding: utf-8 -*-
# Copyright 2018, CS GROUP - France, https://www.csgroup.eu/
#
# This file is part of EODAG project
#     https://www.github.com/CS-SI/EODAG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""EODAG drivers package"""
from __future__ import annotations

from typing import Callable

from typing_extensions import TypedDict

from .generic import DatasetDriver, GenericDriver
from .sentinel1 import Sentinel1Driver
from .sentinel2 import Sentinel2Driver


[docs] class DriverCriteria(TypedDict): """Driver criteria definition""" #: Function that returns True if the driver is suitable for the given :class:`~eodag.api.product._product.EOProduct` criteria: list[Callable[..., bool]] #: driver to use driver: DatasetDriver
#: list of drivers and their criteria DRIVERS: list[DriverCriteria] = [ { "criteria": [lambda product: Sentinel2Driver.match(product, by="collection")], "driver": Sentinel2Driver(), }, { "criteria": [lambda product: Sentinel1Driver.match(product, by="collection")], "driver": Sentinel1Driver(), }, { "criteria": [lambda product: Sentinel2Driver.match(product, by="properties")], "driver": Sentinel2Driver(), }, { "criteria": [lambda product: Sentinel1Driver.match(product, by="properties")], "driver": Sentinel1Driver(), }, { "criteria": [lambda product: GenericDriver.match(product)], "driver": GenericDriver(), }, ] # exportable content __all__ = ["DRIVERS", "DatasetDriver", "GenericDriver", "Sentinel2Driver"]