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
39d40c84
Verified
Commit
39d40c84
authored
1 year ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
REVERT: revert some unintended changes to high_level_api.py
parent
a35313d0
No related branches found
No related tags found
No related merge requests found
Pipeline
#41655
passed
1 year ago
Stage: code_style
Stage: linting
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caosdb/high_level_api.py
+16
-16
16 additions, 16 deletions
src/caosdb/high_level_api.py
with
16 additions
and
16 deletions
src/caosdb/high_level_api.py
+
16
−
16
View file @
39d40c84
...
@@ -60,23 +60,23 @@ def standard_type_for_high_level_type(high_level_record: "CaosDBPythonEntity",
...
@@ -60,23 +60,23 @@ def standard_type_for_high_level_type(high_level_record: "CaosDBPythonEntity",
class in the standard CaosDB API or - if return_string is True - return
class in the standard CaosDB API or - if return_string is True - return
the role as a string.
the role as a string.
"""
"""
if
isinstanc
e
(
high_level_record
,
CaosDBPythonRecord
)
:
if
typ
e
(
high_level_record
)
==
CaosDBPythonRecord
:
if
not
return_string
:
if
not
return_string
:
return
db
.
Record
return
db
.
Record
return
"
Record
"
return
"
Record
"
elif
isinstanc
e
(
high_level_record
,
CaosDBPythonFile
)
:
elif
typ
e
(
high_level_record
)
==
CaosDBPythonFile
:
if
not
return_string
:
if
not
return_string
:
return
db
.
File
return
db
.
File
return
"
File
"
return
"
File
"
elif
isinstanc
e
(
high_level_record
,
CaosDBPythonProperty
)
:
elif
typ
e
(
high_level_record
)
==
CaosDBPythonProperty
:
if
not
return_string
:
if
not
return_string
:
return
db
.
Property
return
db
.
Property
return
"
Property
"
return
"
Property
"
elif
isinstanc
e
(
high_level_record
,
CaosDBPythonRecordType
)
:
elif
typ
e
(
high_level_record
)
==
CaosDBPythonRecordType
:
if
not
return_string
:
if
not
return_string
:
return
db
.
RecordType
return
db
.
RecordType
return
"
RecordType
"
return
"
RecordType
"
elif
isinstanc
e
(
high_level_record
,
CaosDBPythonEntity
)
:
elif
typ
e
(
high_level_record
)
==
CaosDBPythonEntity
:
if
not
return_string
:
if
not
return_string
:
return
db
.
Entity
return
db
.
Entity
return
"
Entity
"
return
"
Entity
"
...
@@ -101,15 +101,15 @@ def high_level_type_for_standard_type(standard_record: db.Entity):
...
@@ -101,15 +101,15 @@ def high_level_type_for_standard_type(standard_record: db.Entity):
if
not
isinstance
(
standard_record
,
db
.
Entity
):
if
not
isinstance
(
standard_record
,
db
.
Entity
):
raise
ValueError
()
raise
ValueError
()
role
=
standard_record
.
role
role
=
standard_record
.
role
if
role
==
"
Record
"
or
isinstanc
e
(
standard_record
,
db
.
Record
)
:
if
role
==
"
Record
"
or
typ
e
(
standard_record
)
==
db
.
Record
:
return
CaosDBPythonRecord
return
CaosDBPythonRecord
elif
role
==
"
File
"
or
isinstanc
e
(
standard_record
,
db
.
File
)
:
elif
role
==
"
File
"
or
typ
e
(
standard_record
)
==
db
.
File
:
return
CaosDBPythonFile
return
CaosDBPythonFile
elif
role
==
"
Property
"
or
isinstanc
e
(
standard_record
,
db
.
Property
)
:
elif
role
==
"
Property
"
or
typ
e
(
standard_record
)
==
db
.
Property
:
return
CaosDBPythonProperty
return
CaosDBPythonProperty
elif
role
==
"
RecordType
"
or
isinstanc
e
(
standard_record
,
db
.
RecordType
)
:
elif
role
==
"
RecordType
"
or
typ
e
(
standard_record
)
==
db
.
RecordType
:
return
CaosDBPythonRecordType
return
CaosDBPythonRecordType
elif
role
==
"
Entity
"
or
isinstanc
e
(
standard_record
,
db
.
Entity
)
:
elif
role
==
"
Entity
"
or
typ
e
(
standard_record
)
==
db
.
Entity
:
return
CaosDBPythonEntity
return
CaosDBPythonEntity
raise
RuntimeError
(
"
Incompatible type.
"
)
raise
RuntimeError
(
"
Incompatible type.
"
)
...
@@ -213,14 +213,14 @@ class CaosDBPythonEntity(object):
...
@@ -213,14 +213,14 @@ class CaosDBPythonEntity(object):
"""
"""
Getter for the file.
Getter for the file.
"""
"""
if
not
isinstanc
e
(
self
,
CaosDBPythonFile
)
:
if
typ
e
(
self
)
!=
CaosDBPythonFile
:
raise
RuntimeError
(
"
Please don
'
t use the file attribute for entities
"
raise
RuntimeError
(
"
Please don
'
t use the file attribute for entities
"
"
that are no files.
"
)
"
that are no files.
"
)
return
self
.
_file
return
self
.
_file
@file.setter
@file.setter
def
file
(
self
,
val
:
str
):
def
file
(
self
,
val
:
str
):
if
val
is
not
None
and
not
isinstanc
e
(
self
,
CaosDBPythonFile
)
:
if
val
is
not
None
and
typ
e
(
self
)
!=
CaosDBPythonFile
:
raise
RuntimeError
(
"
Please don
'
t use the file attribute for entities
"
raise
RuntimeError
(
"
Please don
'
t use the file attribute for entities
"
"
that are no files.
"
)
"
that are no files.
"
)
self
.
_file
=
val
self
.
_file
=
val
...
@@ -230,14 +230,14 @@ class CaosDBPythonEntity(object):
...
@@ -230,14 +230,14 @@ class CaosDBPythonEntity(object):
"""
"""
Getter for the path.
Getter for the path.
"""
"""
if
not
isinstanc
e
(
self
,
CaosDBPythonFile
)
:
if
typ
e
(
self
)
!=
CaosDBPythonFile
:
raise
RuntimeError
(
"
Please don
'
t use the path attribute for entities
"
raise
RuntimeError
(
"
Please don
'
t use the path attribute for entities
"
"
that are no files.
"
)
"
that are no files.
"
)
return
self
.
_path
return
self
.
_path
@path.setter
@path.setter
def
path
(
self
,
val
:
str
):
def
path
(
self
,
val
:
str
):
if
val
is
not
None
and
not
isinstanc
e
(
self
,
CaosDBPythonFile
)
:
if
val
is
not
None
and
typ
e
(
self
)
!=
CaosDBPythonFile
:
raise
RuntimeError
(
"
Please don
'
t use the path attribute for entities
"
raise
RuntimeError
(
"
Please don
'
t use the path attribute for entities
"
"
that are no files.
"
)
"
that are no files.
"
)
self
.
_path
=
val
self
.
_path
=
val
...
@@ -651,7 +651,7 @@ class CaosDBPythonEntity(object):
...
@@ -651,7 +651,7 @@ class CaosDBPythonEntity(object):
if
baseprop
in
serialization
:
if
baseprop
in
serialization
:
entity
.
__setattr__
(
baseprop
,
serialization
[
baseprop
])
entity
.
__setattr__
(
baseprop
,
serialization
[
baseprop
])
if
isinstanc
e
(
entity
,
CaosDBPythonFile
)
:
if
typ
e
(
entity
)
==
CaosDBPythonFile
:
entity
.
file
=
serialization
[
"
file
"
]
entity
.
file
=
serialization
[
"
file
"
]
entity
.
path
=
serialization
[
"
path
"
]
entity
.
path
=
serialization
[
"
path
"
]
...
@@ -725,7 +725,7 @@ class CaosDBPythonEntity(object):
...
@@ -725,7 +725,7 @@ class CaosDBPythonEntity(object):
val
=
str
(
val
)
val
=
str
(
val
)
fulldict
[
baseprop
]
=
val
fulldict
[
baseprop
]
=
val
if
isinstanc
e
(
self
,
CaosDBPythonFile
)
:
if
typ
e
(
self
)
==
CaosDBPythonFile
:
fulldict
[
"
file
"
]
=
self
.
file
fulldict
[
"
file
"
]
=
self
.
file
fulldict
[
"
path
"
]
=
self
.
path
fulldict
[
"
path
"
]
=
self
.
path
...
...
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