Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ipaaca
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Social Cognitive Systems
ipaaca
Commits
d73e8cf9
Commit
d73e8cf9
authored
9 years ago
by
Ramin Yaghoubzadeh Torky
Browse files
Options
Downloads
Patches
Plain Diff
Python: batch updates: updates invalidate older removals and vice versa
parent
bec99adf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ipaacalib/python/src/ipaaca/payload.py
+4
-0
4 additions, 0 deletions
ipaacalib/python/src/ipaaca/payload.py
with
4 additions
and
0 deletions
ipaacalib/python/src/ipaaca/payload.py
+
4
−
0
View file @
d73e8cf9
...
@@ -96,6 +96,8 @@ class Payload(dict):
...
@@ -96,6 +96,8 @@ class Payload(dict):
else
:
# Collect additions/modifications
else
:
# Collect additions/modifications
self
.
_batch_update_writer_name
=
writer_name
self
.
_batch_update_writer_name
=
writer_name
self
.
_collected_modifications
[
k
]
=
v
self
.
_collected_modifications
[
k
]
=
v
# revoke deletion of item since a new version has been added
self
.
_collected_removals
=
[
i
for
i
in
self
.
_collected_removals
if
i
!=
k
]
return
dict
.
__setitem__
(
self
,
k
,
v
)
return
dict
.
__setitem__
(
self
,
k
,
v
)
def
__delitem__
(
self
,
k
,
writer_name
=
None
):
def
__delitem__
(
self
,
k
,
writer_name
=
None
):
...
@@ -110,6 +112,8 @@ class Payload(dict):
...
@@ -110,6 +112,8 @@ class Payload(dict):
else
:
# Collect additions/modifications
else
:
# Collect additions/modifications
self
.
_batch_update_writer_name
=
writer_name
self
.
_batch_update_writer_name
=
writer_name
self
.
_collected_removals
.
append
(
k
)
self
.
_collected_removals
.
append
(
k
)
# revoke older update of item since more recent changes take precedence
if
k
in
self
.
_collected_modifications
:
del
self
.
_collected_modifications
[
k
]
return
dict
.
__delitem__
(
self
,
k
)
return
dict
.
__delitem__
(
self
,
k
)
# Context-manager based batch updates, not thread-safe (on remote updates)
# Context-manager based batch updates, not thread-safe (on remote updates)
...
...
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