EOX GitLab Instance
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
View Server 2
harvester
Commits
aa7054d4
Commit
aa7054d4
authored
Dec 09, 2021
by
Fabian Schindler
Browse files
Fixing interfaces
parent
ae50ad02
Pipeline
#19518
failed with stage
in 45 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
harvester/endpoint/__init__.py
View file @
aa7054d4
...
...
@@ -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__
=
[
...
...
harvester/filescheme/__init__.py
View file @
aa7054d4
...
...
@@ -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
harvester/harvester.py
View file @
aa7054d4
...
...
@@ -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"
)
...
...
harvester/source/__init__.py
View file @
aa7054d4
...
...
@@ -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__
=
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment