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
40f3cc5f
Commit
40f3cc5f
authored
2 years ago
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
MAIN: changed name and name of a parameter of main scanner function
parent
90620c94
No related branches found
No related tags found
2 merge requests
!108
Release 0.5.0
,
!104
Create a new scanner module and move functions from crawl module there
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caoscrawler/scanner.py
+15
-13
15 additions, 13 deletions
src/caoscrawler/scanner.py
with
15 additions
and
13 deletions
src/caoscrawler/scanner.py
+
15
−
13
View file @
40f3cc5f
...
@@ -224,19 +224,21 @@ def initialize_converters(crawler_definition: dict, converter_registry: dict):
...
@@ -224,19 +224,21 @@ def initialize_converters(crawler_definition: dict, converter_registry: dict):
# Main scanner function:
# Main scanner function:
# --------------------------------------------------------------------------------
# --------------------------------------------------------------------------------
def
_crawl
(
self
,
def
scanner
(
self
,
items
:
list
[
StructureElement
],
items
:
list
[
StructureElement
],
local_
converters
:
list
[
Converter
],
converters
:
list
[
Converter
],
generalStore
:
GeneralStore
,
generalStore
:
GeneralStore
,
recordStore
:
RecordStore
,
recordStore
:
RecordStore
,
structure_elements_path
:
list
[
str
],
structure_elements_path
:
list
[
str
],
converters_path
:
list
[
str
],
converters_path
:
list
[
str
],
restricted_path
:
Optional
[
list
[
str
]]
=
None
):
restricted_path
:
Optional
[
list
[
str
]]
=
None
):
"""
"""
Crawl a list of StructureElements and apply any matching converters.
Crawl a list of StructureElements and apply any matching converters.
Formerly known as
"
_crawl
"
.
items: structure_elements (e.g. files and folders on one level on the hierarchy)
items: structure_elements (e.g. files and folders on one level on the hierarchy)
local_
converters: locally defined converters for
converters: locally defined converters for
treating structure elements. A locally defined converter could be
treating structure elements. A locally defined converter could be
one that is only valid for a specific subtree of the originally
one that is only valid for a specific subtree of the originally
cralwed StructureElement structure.
cralwed StructureElement structure.
...
@@ -257,7 +259,7 @@ def _crawl(self,
...
@@ -257,7 +259,7 @@ def _crawl(self,
restricted_path
=
None
restricted_path
=
None
for
element
in
items
:
for
element
in
items
:
for
converter
in
local_
converters
:
for
converter
in
converters
:
# type is something like "matches files", replace isinstance with "type_matches"
# type is something like "matches files", replace isinstance with "type_matches"
# match function tests regexp for example
# match function tests regexp for example
...
@@ -302,7 +304,7 @@ def _crawl(self,
...
@@ -302,7 +304,7 @@ def _crawl(self,
structure_elements_path
+
[
element
.
get_name
()],
structure_elements_path
+
[
element
.
get_name
()],
converters_path
+
[
converter
.
name
])
converters_path
+
[
converter
.
name
])
self
.
_crawl
(
children
,
converter
.
converters
,
self
.
scanner
(
children
,
converter
.
converters
,
generalStore_copy
,
recordStore_copy
,
generalStore_copy
,
recordStore_copy
,
structure_elements_path
+
[
element
.
get_name
()],
structure_elements_path
+
[
element
.
get_name
()],
converters_path
+
[
converter
.
name
],
converters_path
+
[
converter
.
name
],
...
@@ -411,9 +413,9 @@ def scan_structure_elements(items: Union[list[StructureElement], StructureElemen
...
@@ -411,9 +413,9 @@ def scan_structure_elements(items: Union[list[StructureElement], StructureElemen
self
.
run_id
=
uuid
.
uuid1
()
self
.
run_id
=
uuid
.
uuid1
()
converters
=
initialize_converters
(
crawler_definition
,
converter_registry
)
converters
=
initialize_converters
(
crawler_definition
,
converter_registry
)
return
_crawl
(
return
scanner
(
items
=
items
,
items
=
items
,
local_
converters
=
converters
,
converters
=
converters
,
generalStore
=
self
.
generalStore
,
generalStore
=
self
.
generalStore
,
recordStore
=
self
.
recordStore
,
recordStore
=
self
.
recordStore
,
structure_elements_path
=
[],
structure_elements_path
=
[],
...
...
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