Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
anselm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
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
vaclab
anselm
Commits
8e72424b
Commit
8e72424b
authored
6 years ago
by
Wact B. Prot
Browse files
Options
Downloads
Patches
Plain Diff
.get()
parent
976be479
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
anselm.py
+1
-1
1 addition, 1 deletion
anselm.py
anselm/db.py
+13
-13
13 additions, 13 deletions
anselm/db.py
with
14 additions
and
14 deletions
anselm.py
+
1
−
1
View file @
8e72424b
...
...
@@ -100,7 +100,7 @@ class Anselm(System):
line_key
=
self
.
get_line_key
(
line
)
doc_id
=
self
.
state
[
line_key
][
'
doc_id
'
]
doc_id
=
self
.
state
.
get
(
line_key
).
get
(
'
doc_id
'
)
task_name
=
combo
.
currentText
()
self
.
state
[
line_key
][
'
task_name
'
]
=
task_name
...
...
This diff is collapsed.
Click to expand it.
anselm/db.py
+
13
−
13
View file @
8e72424b
...
...
@@ -12,9 +12,9 @@ class DB(System):
self
.
log
.
info
(
"
database
"
)
def
init_db
(
self
):
db_dict
=
self
.
config
[
'
couchdb
'
]
port
=
db_dict
[
'
port
'
]
host
=
db_dict
[
'
host
'
]
db_dict
=
self
.
config
.
get
(
'
couchdb
'
)
port
=
db_dict
.
get
(
'
port
'
)
host
=
db_dict
.
get
(
'
host
'
)
url
=
'
http://{}:{}/
'
.
format
(
host
,
port
)
self
.
db_dict
=
db_dict
...
...
@@ -23,10 +23,10 @@ class DB(System):
self
.
log
.
info
(
"
long-term memory system ok
"
)
def
store_doc
(
self
,
doc
):
id
=
doc
[
'
_id
'
]
id
=
doc
.
get
(
'
_id
'
)
dbdoc
=
self
.
db
[
id
]
if
dbdoc
:
doc
[
'
_rev
'
]
=
dbdoc
[
'
_rev
'
]
doc
[
'
_rev
'
]
=
dbdoc
.
get
(
'
_rev
'
)
else
:
doc
.
pop
(
'
_rev
'
,
None
)
...
...
@@ -34,19 +34,19 @@ class DB(System):
def
get_auxobj_ids
(
self
):
view
=
self
.
db_dict
[
'
view
'
][
'
auxobj
'
]
view
=
self
.
db_dict
.
get
(
'
view
'
).
get
(
'
auxobj
'
)
return
[
doc
[
'
id
'
]
for
doc
in
self
.
db
.
view
(
view
)]
return
[
doc
.
get
(
'
id
'
)
for
doc
in
self
.
db
.
view
(
view
)]
def
get_red_doc
(
self
,
doc_id
):
doc
=
self
.
db
[
doc_id
]
red_doc
=
None
if
doc
:
if
'
AuxObject
'
in
doc
:
red_doc
=
doc
[
'
AuxObject
'
]
red_doc
=
doc
.
get
(
'
AuxObject
'
)
if
'
CalibrationObject
'
in
doc
:
red_doc
=
doc
[
'
CalibrationObject
'
]
red_doc
=
doc
.
get
(
'
CalibrationObject
'
)
else
:
self
.
log
.
error
(
"
no doc with id {}
"
.
format
(
doc_id
))
...
...
@@ -58,20 +58,20 @@ class DB(System):
def
get_task_names
(
self
,
doc_id
):
doc
=
self
.
get_red_doc
(
doc_id
)
if
doc
and
'
Task
'
in
doc
:
return
[
task
[
'
TaskName
'
]
for
task
in
doc
[
'
Task
'
]
]
return
[
task
.
get
(
'
TaskName
'
)
for
task
in
doc
.
get
(
'
Task
'
)
]
else
:
return
[]
def
get_task
(
self
,
doc_id
,
task_name
):
doc
=
self
.
get_red_doc
(
doc_id
)
if
doc
and
'
Task
'
in
doc
:
tasks
=
doc
[
'
Task
'
]
tasks
=
doc
.
get
(
'
Task
'
)
for
task
in
tasks
:
if
task
[
'
TaskName
'
]
==
task_name
:
if
task
.
get
(
'
TaskName
'
)
==
task_name
:
break
if
'
Defaults
'
in
doc
:
defaults
=
doc
[
'
Defaults
'
]
defaults
=
doc
.
get
(
'
Defaults
'
)
task
=
self
.
replace_defaults
(
task
=
task
,
defaults
=
defaults
)
return
task
...
...
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