Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CaosDB Crawler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Crawler
Commits
96293ef2
Commit
96293ef2
authored
2 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: doc string and rename of create_local_converters"
parent
fb67f45e
No related branches found
No related tags found
1 merge request
!53
Release 0.1
Pipeline
#28848
passed
2 years ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caoscrawler/converters.py
+4
-0
4 additions, 0 deletions
src/caoscrawler/converters.py
src/caoscrawler/crawl.py
+10
-7
10 additions, 7 deletions
src/caoscrawler/crawl.py
with
14 additions
and
7 deletions
src/caoscrawler/converters.py
+
4
−
0
View file @
96293ef2
...
...
@@ -283,6 +283,10 @@ class Converter(object, metaclass=ABCMeta):
def
converter_factory
(
definition
:
dict
,
name
:
str
,
converter_registry
:
dict
):
"""
creates a Converter instance of the appropriate class.
The `type` key in the `definition` defines the Converter class which is being used.
"""
if
"
type
"
not
in
definition
:
raise
RuntimeError
(
...
...
This diff is collapsed.
Click to expand it.
src/caoscrawler/crawl.py
+
10
−
7
View file @
96293ef2
...
...
@@ -376,9 +376,13 @@ class Crawler(object):
converter_registry
)
@staticmethod
def
create_local_converters
(
crawler_definition
:
dict
,
converter_registry
:
dict
):
local_converters
=
[]
def
initialize_converters
(
crawler_definition
:
dict
,
converter_registry
:
dict
):
"""
takes the cfood as dict (`crawler_definition`) and creates the converter objects that
are defined on the highest level. Child Converters will in turn be created during the
initialization of the Converters.
"""
converters
=
[]
for
key
,
value
in
crawler_definition
.
items
():
# Definitions and Converters are reserved keywords
...
...
@@ -390,10 +394,10 @@ class Crawler(object):
continue
elif
key
==
"
Converters
"
:
continue
local_
converters
.
append
(
Converter
.
converter_factory
(
converters
.
append
(
Converter
.
converter_factory
(
value
,
key
,
converter_registry
))
return
local_
converters
return
converters
def
start_crawling
(
self
,
items
:
Union
[
List
[
StructureElement
],
StructureElement
],
crawler_definition
:
dict
,
...
...
@@ -425,8 +429,7 @@ class Crawler(object):
items
=
[
items
]
self
.
run_id
=
uuid
.
uuid1
()
local_converters
=
Crawler
.
create_local_converters
(
crawler_definition
,
converter_registry
)
local_converters
=
Crawler
.
initialize_converters
(
crawler_definition
,
converter_registry
)
# This recursive crawling procedure generates the update list:
self
.
target_data
:
List
[
db
.
Record
]
=
[]
self
.
_crawl
(
items
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment