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
433160cf
Commit
433160cf
authored
6 months ago
by
I. Nüske
Browse files
Options
Downloads
Patches
Plain Diff
MNT: Replace dict default values with None and update in method body
parent
40961b1d
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!128
MNT: Added a warning when column metadata is not configured, and a better...
,
!126
Fix pylint errors
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/caosadvancedtools/crawler.py
+3
-1
3 additions, 1 deletion
src/caosadvancedtools/crawler.py
src/caosadvancedtools/models/parser.py
+8
-2
8 additions, 2 deletions
src/caosadvancedtools/models/parser.py
src/caosadvancedtools/table_importer.py
+3
-2
3 additions, 2 deletions
src/caosadvancedtools/table_importer.py
with
14 additions
and
5 deletions
src/caosadvancedtools/crawler.py
+
3
−
1
View file @
433160cf
...
...
@@ -66,7 +66,7 @@ def separated(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
=
None
,
update_cache
=
None
,
run_id
=
None
):
"""
Updates the `to_be_updated` Container, i.e., pushes the changes to LinkAhead
after removing possible duplicates. If a chace is provided, uauthorized
...
...
@@ -86,6 +86,8 @@ def apply_list_of_updates(to_be_updated, update_flags={},
Id with which the pending updates are cached. Only meaningful if
`update_cache` is provided. Default is None.
"""
if
update_flags
is
None
:
update_flags
=
{}
if
len
(
to_be_updated
)
==
0
:
return
...
...
This diff is collapsed.
Click to expand it.
src/caosadvancedtools/models/parser.py
+
8
−
2
View file @
433160cf
...
...
@@ -162,7 +162,7 @@ debug : bool, optional
def
parse_model_from_json_schema
(
filename
:
str
,
top_level_recordtype
:
bool
=
True
,
types_for_missing_array_items
:
dict
=
{}
,
types_for_missing_array_items
:
dict
=
None
,
ignore_unspecified_array_items
:
bool
=
False
,
existing_model
:
Optional
[
dict
]
=
None
):
...
...
@@ -204,6 +204,9 @@ def parse_model_from_json_schema(
about the limitations of the current implementation.
"""
if
types_for_missing_array_items
is
None
:
types_for_missing_array_items
=
{}
if
existing_model
is
not
None
:
raise
NotImplementedError
(
"
Adding to an existing model is not implemented yet.
"
)
...
...
@@ -706,8 +709,11 @@ class JsonSchemaParser(Parser):
# @date 2022-02-17
# @review Timm Fitschen 2023-05-25
def
__init__
(
self
,
types_for_missing_array_items
=
{},
ignore_unspecified_array_items
=
False
):
def
__init__
(
self
,
types_for_missing_array_items
=
None
,
ignore_unspecified_array_items
=
False
):
super
().
__init__
()
if
types_for_missing_array_items
is
None
:
types_for_missing_array_items
=
{}
self
.
types_for_missing_array_items
=
types_for_missing_array_items
self
.
ignore_unspecified_array_items
=
ignore_unspecified_array_items
...
...
This diff is collapsed.
Click to expand it.
src/caosadvancedtools/table_importer.py
+
3
−
2
View file @
433160cf
...
...
@@ -110,8 +110,7 @@ def date_converter(val, fmt="%Y-%m-%d"):
return
datetime_converter
(
val
,
fmt
=
fmt
).
date
()
def
incomplete_date_converter
(
val
,
fmts
=
{
"
%Y-%m-%d
"
:
"
%Y-%m-%d
"
,
"
%Y-%m
"
:
"
%Y-%m
"
,
"
%Y
"
:
"
%Y
"
}):
def
incomplete_date_converter
(
val
,
fmts
=
None
):
"""
if the value is already a datetime, it is returned otherwise it
converts it using format string
...
...
@@ -124,6 +123,8 @@ def incomplete_date_converter(val, fmts={"%Y-%m-%d": "%Y-%m-%d",
keys are the formats into which the input value is tried to be
converted, values are the possible input formats.
"""
if
fmts
is
None
:
fmts
=
{
"
%Y-%m-%d
"
:
"
%Y-%m-%d
"
,
"
%Y-%m
"
:
"
%Y-%m
"
,
"
%Y
"
:
"
%Y
"
}
for
to
,
fro
in
fmts
.
items
():
try
:
...
...
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