Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-pylib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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-pylib
Commits
668164e7
Commit
668164e7
authored
3 years ago
by
Daniel Hornung
Browse files
Options
Downloads
Plain Diff
Merge branch 'f-fix-types-for-py3.8' into 'dev'
F fix types for py3.8 See merge request
!59
parents
75fae7ef
680ce81d
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!60
Release 0.7.4
,
!59
F fix types for py3.8
Pipeline
#23465
passed
3 years ago
Stage: code_style
Stage: linting
Stage: setup
Stage: test
Stage: deploy
Changes
4
Pipelines
9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.md
+4
-0
4 additions, 0 deletions
CHANGELOG.md
src/caosdb/apiutils.py
+8
-6
8 additions, 6 deletions
src/caosdb/apiutils.py
src/caosdb/high_level_api.py
+2
-2
2 additions, 2 deletions
src/caosdb/high_level_api.py
src/caosdb/utils/plantuml.py
+4
-4
4 additions, 4 deletions
src/caosdb/utils/plantuml.py
with
18 additions
and
12 deletions
CHANGELOG.md
+
4
−
0
View file @
668164e7
...
@@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
...
@@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ###
### Fixed ###
*
[
#64
](
https://gitlab.com/caosdb/caosdb-pylib/-/issues/64
)
Use
`Dict[]`
and
`List[]`
from
`typing`
for type hinting instead of
`dict[]`
and
`list[]`
for
compatibility with Python<3.9.
### Security ###
### Security ###
### Documentation ###
### Documentation ###
...
...
This diff is collapsed.
Click to expand it.
src/caosdb/apiutils.py
+
8
−
6
View file @
668164e7
...
@@ -33,7 +33,7 @@ import warnings
...
@@ -33,7 +33,7 @@ import warnings
from
collections.abc
import
Iterable
from
collections.abc
import
Iterable
from
subprocess
import
call
from
subprocess
import
call
from
typing
import
Optional
,
Any
from
typing
import
Optional
,
Any
,
Dict
,
List
from
caosdb.common.datatype
import
(
BOOLEAN
,
DATETIME
,
DOUBLE
,
FILE
,
INTEGER
,
from
caosdb.common.datatype
import
(
BOOLEAN
,
DATETIME
,
DOUBLE
,
FILE
,
INTEGER
,
REFERENCE
,
TEXT
,
is_reference
)
REFERENCE
,
TEXT
,
is_reference
)
...
@@ -205,8 +205,8 @@ def compare_entities(old_entity: Entity, new_entity: Entity):
...
@@ -205,8 +205,8 @@ def compare_entities(old_entity: Entity, new_entity: Entity):
In case of changed information the value listed under the respective key shows the
In case of changed information the value listed under the respective key shows the
value that is stored in the respective entity.
value that is stored in the respective entity.
"""
"""
olddiff
:
d
ict
[
str
,
Any
]
=
{
"
properties
"
:
{},
"
parents
"
:
[]}
olddiff
:
D
ict
[
str
,
Any
]
=
{
"
properties
"
:
{},
"
parents
"
:
[]}
newdiff
:
d
ict
[
str
,
Any
]
=
{
"
properties
"
:
{},
"
parents
"
:
[]}
newdiff
:
D
ict
[
str
,
Any
]
=
{
"
properties
"
:
{},
"
parents
"
:
[]}
if
old_entity
is
new_entity
:
if
old_entity
is
new_entity
:
return
(
olddiff
,
newdiff
)
return
(
olddiff
,
newdiff
)
...
@@ -467,7 +467,7 @@ def resolve_reference(prop: Property):
...
@@ -467,7 +467,7 @@ def resolve_reference(prop: Property):
prop
.
value
=
retrieve_entity_with_id
(
prop
.
value
)
prop
.
value
=
retrieve_entity_with_id
(
prop
.
value
)
def
create_flat_list
(
ent_list
:
l
ist
[
Entity
],
flat
:
l
ist
[
Entity
]):
def
create_flat_list
(
ent_list
:
L
ist
[
Entity
],
flat
:
L
ist
[
Entity
]):
"""
"""
Recursively adds all properties contained in entities from ent_list to
Recursively adds all properties contained in entities from ent_list to
the output list flat. Each element will only be added once to the list.
the output list flat. Each element will only be added once to the list.
...
@@ -483,8 +483,10 @@ def create_flat_list(ent_list: list[Entity], flat: list[Entity]):
...
@@ -483,8 +483,10 @@ def create_flat_list(ent_list: list[Entity], flat: list[Entity]):
if
isinstance
(
el
,
Entity
):
if
isinstance
(
el
,
Entity
):
if
el
not
in
flat
:
if
el
not
in
flat
:
flat
.
append
(
el
)
flat
.
append
(
el
)
create_flat_list
([
el
],
flat
)
# TODO: move inside if block?
# TODO: move inside if block?
create_flat_list
([
el
],
flat
)
elif
isinstance
(
p
.
value
,
Entity
):
elif
isinstance
(
p
.
value
,
Entity
):
if
p
.
value
not
in
flat
:
if
p
.
value
not
in
flat
:
flat
.
append
(
p
.
value
)
flat
.
append
(
p
.
value
)
create_flat_list
([
p
.
value
],
flat
)
# TODO: move inside if block?
# TODO: move inside if block?
create_flat_list
([
p
.
value
],
flat
)
This diff is collapsed.
Click to expand it.
src/caosdb/high_level_api.py
+
2
−
2
View file @
668164e7
...
@@ -561,7 +561,7 @@ class CaosDBPythonEntity(object):
...
@@ -561,7 +561,7 @@ class CaosDBPythonEntity(object):
return
propval
return
propval
def
resolve_references
(
self
,
deep
:
bool
,
references
:
db
.
Container
,
def
resolve_references
(
self
,
deep
:
bool
,
references
:
db
.
Container
,
visited
:
d
ict
[
Union
[
str
,
int
],
visited
:
D
ict
[
Union
[
str
,
int
],
"
CaosDBPythonEntity
"
]
=
None
):
"
CaosDBPythonEntity
"
]
=
None
):
"""
"""
Resolve this entity
'
s references. This affects unresolved properties as well
Resolve this entity
'
s references. This affects unresolved properties as well
...
@@ -692,7 +692,7 @@ class CaosDBPythonEntity(object):
...
@@ -692,7 +692,7 @@ class CaosDBPythonEntity(object):
if
self
in
visited
:
if
self
in
visited
:
return
visited
[
self
]
return
visited
[
self
]
metadata
:
d
ict
[
str
,
Any
]
=
dict
()
metadata
:
D
ict
[
str
,
Any
]
=
dict
()
properties
=
dict
()
properties
=
dict
()
parents
=
list
()
parents
=
list
()
...
...
This diff is collapsed.
Click to expand it.
src/caosdb/utils/plantuml.py
+
4
−
4
View file @
668164e7
...
@@ -39,7 +39,7 @@ import shutil
...
@@ -39,7 +39,7 @@ import shutil
import
caosdb
as
db
import
caosdb
as
db
from
caosdb.common.datatype
import
is_reference
,
get_referenced_recordtype
from
caosdb.common.datatype
import
is_reference
,
get_referenced_recordtype
from
typing
import
Optional
from
typing
import
List
,
Optional
import
tempfile
import
tempfile
...
@@ -341,9 +341,9 @@ def retrieve_substructure(start_record_types, depth, result_id_set=None, result_
...
@@ -341,9 +341,9 @@ def retrieve_substructure(start_record_types, depth, result_id_set=None, result_
return
None
return
None
def
to_graphics
(
recordtypes
:
l
ist
[
db
.
Entity
],
filename
:
str
,
def
to_graphics
(
recordtypes
:
L
ist
[
db
.
Entity
],
filename
:
str
,
output_dirname
:
Optional
[
str
]
=
None
,
output_dirname
:
Optional
[
str
]
=
None
,
formats
:
l
ist
[
str
]
=
[
"
tsvg
"
],
formats
:
L
ist
[
str
]
=
[
"
tsvg
"
],
silent
:
bool
=
True
,
silent
:
bool
=
True
,
add_properties
:
bool
=
True
,
add_properties
:
bool
=
True
,
add_recordtypes
:
bool
=
True
,
add_recordtypes
:
bool
=
True
,
...
@@ -367,7 +367,7 @@ def to_graphics(recordtypes: list[db.Entity], filename: str,
...
@@ -367,7 +367,7 @@ def to_graphics(recordtypes: list[db.Entity], filename: str,
the destination directory for the resulting images as defined by the
"
-o
"
the destination directory for the resulting images as defined by the
"
-o
"
option by plantuml
option by plantuml
default is to use current working dir
default is to use current working dir
formats :
l
ist[str]
formats :
L
ist[str]
list of target formats as defined by the -t
"
...
"
options by plantuml, e.g.
"
tsvg
"
list of target formats as defined by the -t
"
...
"
options by plantuml, e.g.
"
tsvg
"
silent : bool
silent : bool
Don
'
t output messages.
Don
'
t output messages.
...
...
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