EOX GitLab Instance

Commit aa7054d4 authored by Fabian Schindler's avatar Fabian Schindler
Browse files

Fixing interfaces

parent ae50ad02
Pipeline #19518 failed with stage
in 45 seconds
......@@ -15,16 +15,11 @@ ENDPOINT_MAP = {
def get_endpoint(endpoint_cfg: dict) -> Optional[Endpoint]:
cls = ENDPOINT_MAP.get(endpoint_cfg["type"])
cls = ENDPOINT_MAP.get(endpoint_cfg.pop("type"))
if not cls:
return None
url = endpoint_cfg.pop("url")
query = endpoint_cfg.pop("query")
endpoint = cls(url=url, query=query, **endpoint_cfg)
return endpoint
return cls(**endpoint_cfg)
__all__ = [
......
......@@ -13,11 +13,10 @@ SCHEME_MAP = {
def get_filescheme(filescheme_cfg: dict) -> Optional[FileScheme]:
cls = SCHEME_MAP.get(filescheme_cfg["type"])
cls = SCHEME_MAP.get(filescheme_cfg.pop("type"))
if not cls:
return None
parameters = filescheme_cfg["parameters"]
filescheme = cls(get_source(filescheme_cfg["source"]), **parameters)
filescheme = cls(get_source(filescheme_cfg["source"]), **filescheme_cfg)
return filescheme
......@@ -27,10 +27,10 @@ def stringify(
def init_resource(harvest_config: dict) -> Resource:
config: dict = harvest_config.pop("resource")
if endpoint := get_endpoint(config):
if endpoint := get_endpoint(dict(config)):
return endpoint
if source := get_filescheme(config):
if source := get_filescheme(dict(config)):
return source
raise HarvestError(f"Resource type {config['type']} not found")
......
......@@ -13,11 +13,8 @@ SOURCE_MAP = {
def get_source(source_cfg: dict) -> Optional[Source]:
cls = SOURCE_MAP.get(source_cfg.pop("type"))
if not cls:
return None
source = cls(**source_cfg)
return source
cls = SOURCE_MAP[source_cfg.pop("type")]
return cls(**source_cfg)
__all__ = [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment