Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
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-advanced-user-tools
Commits
d4cae093
Commit
d4cae093
authored
3 years ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Patches
Plain Diff
DOC: Add docstring
parent
1f4d0517
No related branches found
No related tags found
2 merge requests
!39
Release 0.4.0
,
!26
MAINT: allow the apply_list_of_updates function to be used elsewhere
Pipeline
#17065
passed
3 years ago
Stage: setup
Stage: cert
Stage: style
Stage: unittest
Stage: integrationtest
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caosadvancedtools/crawler.py
+21
-5
21 additions, 5 deletions
src/caosadvancedtools/crawler.py
with
21 additions
and
5 deletions
src/caosadvancedtools/crawler.py
+
21
−
5
View file @
d4cae093
...
@@ -66,10 +66,25 @@ def separated(text):
...
@@ -66,10 +66,25 @@ def separated(text):
return
"
-
"
*
60
+
"
\n
"
+
text
return
"
-
"
*
60
+
"
\n
"
+
text
def
apply_list_of_updates
(
to_be_updated
,
update_flags
,
def
apply_list_of_updates
(
to_be_updated
,
update_flags
=
{}
,
update_cache
=
None
,
run_id
=
None
):
update_cache
=
None
,
run_id
=
None
):
"""
"""
Updates the `to_be_updated` Container, i.e., pushes the changes to CaosDB
Updates the to_be_updated Container, i.e. pushes the changes to CaosDB
after removing possible duplicates. If a chace is provided, uauthorized
updates can be cached for further authorization.
Parameters:
-----------
to_be_updated : db.Container
Container with the entities that will be updated.
update_flags : dict, optional
Dictionary of CaosDB server flags that will be used for the
update. Default is an empty dict.
update_cache : UpdateCache or None, optional
Cache in which the intended updates will be stored so they can be
authorized afterwards. Default is None.
run_id : String or None, optional
Id with which the pending updates are cached. Only meaningful if
`update_cache` is provided. Default is None.
"""
"""
if
len
(
to_be_updated
)
==
0
:
if
len
(
to_be_updated
)
==
0
:
...
@@ -90,9 +105,10 @@ def apply_list_of_updates(to_be_updated, update_flags,
...
@@ -90,9 +105,10 @@ def apply_list_of_updates(to_be_updated, update_flags,
baseurl
=
db
.
configuration
.
get_config
()[
"
Connection
"
][
"
url
"
]
baseurl
=
db
.
configuration
.
get_config
()[
"
Connection
"
][
"
url
"
]
def
make_clickable
(
txt
,
id
):
return
"
<a href=
'
{}/Entity/{}
'
>{}</a>
"
.
format
(
baseurl
,
id
,
txt
)
for
el
in
to_be_updated
:
for
el
in
to_be_updated
:
def
make_clickable
(
txt
,
id
):
return
"
<a href=
'
{}/Entity/{}
'
>{}</a>
"
.
format
(
baseurl
,
id
,
txt
)
info
+=
str
(
"
\t
"
+
make_clickable
(
el
.
name
,
el
.
id
)
info
+=
str
(
"
\t
"
+
make_clickable
(
el
.
name
,
el
.
id
)
if
el
.
name
is
not
None
if
el
.
name
is
not
None
else
"
\t
"
+
make_clickable
(
str
(
el
.
id
),
el
.
id
))
else
"
\t
"
+
make_clickable
(
str
(
el
.
id
),
el
.
id
))
...
...
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