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
f4f3a766
Commit
f4f3a766
authored
3 years ago
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
added a preliminary cfood for testing
parent
9248267a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
setup.py
+1
-1
1 addition, 1 deletion
setup.py
src/crawl.py
+28
-2
28 additions, 2 deletions
src/crawl.py
test/scifolder_cfood.yml
+31
-0
31 additions, 0 deletions
test/scifolder_cfood.yml
with
60 additions
and
3 deletions
setup.py
+
1
−
1
View file @
f4f3a766
...
...
@@ -71,7 +71,7 @@ def setup_package():
package_data
=
{},
entry_points
=
{
"
console_scripts
"
:
[
"
crawl =
crawl
.__main__:main
"
,
"
crawl =
src
.__main__:main
"
,
]
}
)
...
...
This diff is collapsed.
Click to expand it.
src/crawl.py
100644 → 100755
+
28
−
2
View file @
f4f3a766
...
...
@@ -5,8 +5,32 @@
import
argparse
import
os
import
sys
import
yaml
import
re
def
crawl_cfood
(
dirname
:
str
,
cfood
:
str
):
"""
Crawl a single cfood.
"""
# Load the cfood from a yaml file:
with
open
(
cfood
,
"
r
"
)
as
f
:
cf
=
yaml
.
load
(
f
,
Loader
=
yaml
.
SafeLoader
)
for
currentpath
,
dirs
,
files
in
os
.
walk
(
dirname
):
# for current nodes of type dir look in the list of dirs for matches
# dir is the default
if
current_node
[
"
type
"
]
==
"
dir
"
:
for
dirname
in
dirs
:
pass
elif
current_node
[
"
type
"
]
==
"
file
"
:
for
filename
in
files
:
pass
else
:
# work in progress
pass
def
crawl
(
dirname
:
str
,
cfoods
:
list
[
str
]):
...
...
@@ -17,10 +41,12 @@ def crawl(dirname: str,
cfoods : a list of filenames of cfood files
"""
pass
# simplified for testing:
for
cfood
in
cfoods
:
crawl_cfood
(
dirname
,
cfood
)
def
main
():
pass
crawl
(
sys
.
args
[
1
],
[
sys
.
args
[
2
]])
if
__name__
==
"
__main__
"
:
...
...
This diff is collapsed.
Click to expand it.
test/scifolder_cfood.yml
0 → 100644
+
31
−
0
View file @
f4f3a766
DataAnalysis
:
children
:
project_dir
:
re
:
(?P<date>.*?)_(?P<identifier>.*)
handlers
:
-
type
:
identifiable
name
:
idf_project
children
:
single
:
re
:
(?P<date>.*?)_(?P<identifier>.*)
children
:
README
:
type
:
file
case
:
insensitive
re
:
README\.md
children
:
-
description
:
type
:
TEXT
-
responsible
:
children
:
type
:
TEXT
re
:
(?P<first_name>.+) (?P<last_name>.+)
handlers
:
type
:
identifiable
name
:
idf_person
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