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
a0855542
Commit
a0855542
authored
7 months ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: Remove now obsolete _validate_definition
parent
e7b65817
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!178
FIX: #96 Better error output for crawl.py script.
,
!163
F dict heuristic
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caoscrawler/converters.py
+0
-17
0 additions, 17 deletions
src/caoscrawler/converters.py
unittests/test_converters.py
+0
-25
0 additions, 25 deletions
unittests/test_converters.py
with
0 additions
and
42 deletions
src/caoscrawler/converters.py
+
0
−
17
View file @
a0855542
...
...
@@ -824,27 +824,10 @@ class PropertiesFromDictConverter(DictElementConverter):
"""
def
_validate_definition
(
self
):
if
"
record_from_dict
"
not
in
self
.
definition
or
self
.
definition
[
"
record_from_dict
"
]
is
None
:
raise
ValueError
(
"
You need to specify the (root) record, the properties of
"
f
"
which will be set from the dict in converter
{
self
.
name
}
.
"
)
if
not
"
variable_name
"
in
self
.
definition
[
"
record_from_dict
"
]
or
not
self
.
definition
[
"
record_from_dict
"
][
"
variable_name
"
]:
raise
ValueError
(
f
"
The root record in converter
{
self
.
name
}
needs to have a
"
"
`variable_name` by which it is accessed in the subtree.
"
)
def
__init__
(
self
,
definition
:
dict
,
name
:
str
,
converter_registry
:
dict
,
referenced_record_callback
:
Optional
[
callable
]
=
None
):
super
().
__init__
(
definition
,
name
,
converter_registry
)
self
.
_validate_definition
()
self
.
referenced_record_callback
=
referenced_record_callback
def
_recursively_create_records
(
self
,
subdict
:
dict
,
root_record
:
db
.
Record
,
...
...
This diff is collapsed.
Click to expand it.
unittests/test_converters.py
+
0
−
25
View file @
a0855542
...
...
@@ -802,31 +802,6 @@ def test_properties_from_dict_basic(converter_registry):
assert
author_rec
.
get_property
(
"
full_name
"
).
value
==
"
Some Author
"
def
test_properties_from_dict_errors
(
converter_registry
):
with
pytest
.
raises
(
ValueError
)
as
ve
:
pdfc
=
PropertiesFromDictConverter
(
definition
=
{
},
name
=
"
TestConverter
"
,
converter_registry
=
converter_registry
)
assert
"
You need to specify the (root) record
"
in
str
(
ve
.
value
)
with
pytest
.
raises
(
ValueError
)
as
ve
:
pdfc
=
PropertiesFromDictConverter
(
definition
=
{
"
record_from_dict
"
:
{}
},
name
=
"
TestConverter
"
,
converter_registry
=
converter_registry
)
assert
"
needs to have a `variable_name`
"
in
str
(
ve
.
value
)
def
test_properties_from_dict_callable
(
converter_registry
):
def
convert_some_values
(
rec
:
db
.
Record
):
...
...
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