EOX GitLab Instance

__init__.py 504 Bytes
Newer Older
Fabian Schindler's avatar
Fabian Schindler committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from typing import Optional

from ..abc import FileScheme
from ..source import get_source
from .filematcher import FileMatcherScheme
from .stac_catalog import STACCatalogScheme


SCHEME_MAP = {
    "FileMatcher": FileMatcherScheme,
    "STACCatalog": STACCatalogScheme
}


def get_filescheme(filescheme_cfg: dict) -> Optional[FileScheme]:
Fabian Schindler's avatar
Fabian Schindler committed
16
    cls = SCHEME_MAP.get(filescheme_cfg.pop("type"))
Fabian Schindler's avatar
Fabian Schindler committed
17
18
19
    if not cls:
        return None

Fabian Schindler's avatar
Fabian Schindler committed
20
    return cls(get_source(filescheme_cfg.pop("source")), **filescheme_cfg)