Skip to content

Commit

Permalink
fix: one more workaround try of UpdateWithReplaceDict.update for pyth…
Browse files Browse the repository at this point in the history
…on 2.6 (again)
  • Loading branch information
ssato committed Dec 25, 2015
1 parent 9de9516 commit b9591cc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions anyconfig/mergeabledict.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,14 @@ class UpdateWithReplaceDict(dict):
Traceback (most recent call last):
TypeError: ...
"""
def _update(self, other, key, val=None, is_dict=True):
def _update(self, other, key, *args):
"""
:param other:
dict or dict-like object or a list of (key, value) pair tuples
:param key: object key
:param val: object value
:param args: [] or (value, ...)
"""
self[key] = other[key] if val is None and is_dict else val
self[key] = args[0] if args else other[key]

def update(self, *others, **another):
"""
Expand All @@ -231,7 +231,7 @@ def update(self, *others, **another):
self._update(other, key)
else:
for key, val in other: # TypeError, etc. may be raised.
self._update(other, key, val=val, is_dict=False)
self._update(other, key, val)

for key in another.keys():
self._update(another, key)
Expand Down

0 comments on commit b9591cc

Please sign in to comment.