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
9fd8dcb8
Commit
9fd8dcb8
authored
2 years ago
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
ENH: conversion of CaosDB objects to a more readable yaml serialization
parent
bd32f1bf
No related branches found
No related tags found
1 merge request
!96
Draft: F refactor debug tree
Pipeline
#33448
failed
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/scanner.py
+6
-1
6 additions, 1 deletion
src/caoscrawler/scanner.py
unittests/debug_tree_test.py
+16
-3
16 additions, 3 deletions
unittests/debug_tree_test.py
with
22 additions
and
4 deletions
src/caoscrawler/scanner.py
+
6
−
1
View file @
9fd8dcb8
...
...
@@ -61,6 +61,8 @@ from .stores import Store, GeneralStore, RecordStore
from
.structure_elements
import
StructureElement
,
Directory
,
NoneElement
from
.version
import
check_cfood_version
from
caosdb.high_level_api
import
convert_to_python_object
from
.debug.debug_tree
import
(
DebugTreeStructureElement
,
DebugTreeConverter
,
DebugTreeVariable
)
...
...
@@ -437,9 +439,12 @@ def store_to_tree(store: Store):
res
:
list
[
DebugTreeVariable
]
=
list
()
copied
=
store
.
get_dict_copied
()
for
name
,
value
in
store
.
get_storage
().
items
():
converted_value
=
value
if
isinstance
(
value
,
db
.
Entity
):
converted_value
=
convert_to_python_object
(
value
).
serialize
(
True
)
res
.
append
(
DebugTreeVariable
(
name
,
value
,
name
,
converted_
value
,
copied
[
name
],
store
.
get_internal_id
(
name
)))
return
res
This diff is collapsed.
Click to expand it.
unittests/debug_tree_test.py
+
16
−
3
View file @
9fd8dcb8
...
...
@@ -48,7 +48,14 @@ from caosdb.apiutils import compare_entities
import
pytest
from
pytest
import
raises
from
caoscrawler.scanner
import
scanner
from
caoscrawler.scanner
import
scanner
,
scan_directory
def
rfp
(
*
pathcomponents
):
"""
Return full path.
Shorthand convenience function.
"""
return
join
(
dirname
(
__file__
),
*
pathcomponents
)
def
test_scanner
():
...
...
@@ -59,7 +66,13 @@ def test_scanner():
crawled_data
,
debug_tree
=
scanner
([
d
],
[
c
])
print
(
yaml
.
dump
(
debug_tree
))
assert
False
#
assert False
def
test_scanner_directories
():
d
=
Directory
(
"
2023-02-07_ProjectName
"
,
"
/
"
)
crawled_data
,
debug_tree
=
scan_directory
(
rfp
(
"
test_directories
"
,
"
examples_article
"
),
rfp
(
"
scifolder_cfood.yml
"
))
print
(
crawled_data
)
print
(
yaml
.
dump
(
debug_tree
))
assert
False
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