Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoming0625 committed Dec 29, 2022
1 parent 9bc1b68 commit 7cf0ad3
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions brainpy/tools/dicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,6 @@ def add_attr_not_key(self, *args):
raise TypeError('Only support string.')
self.attrs_not_keys += args

def __setitem__(self, key, value):
"""Overload bracket assignment to catch potential conflicts during assignment."""
if key in self:
if id(self[key]) != id(value):
raise ValueError(f'Name "{key}" conflicts: same name for {value} and {self[key]}.')
dict.__setitem__(self, key, value)

def replace(self, key, new_value):
"""Replace the original key with the new value."""
self.pop(key)
self[key] = new_value

def update(self, *args, **kwargs):
super().update(*args, **kwargs)
return self
Expand Down

0 comments on commit 7cf0ad3

Please sign in to comment.