-
Notifications
You must be signed in to change notification settings - Fork 6
revert some changes to TypedDict which crept in via Flux
#449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -158,13 +158,11 @@ def __init__(self, from_dict=None, **kwargs): | |||||||||||
|
|
||||||||||||
|
|
||||||||||||
| if self._deep: | ||||||||||||
| self.__dict__['_data'] = copy.deepcopy(self._defaults) | ||||||||||||
| self.update(copy.deepcopy(self._defaults)) | ||||||||||||
| else: | ||||||||||||
| self.__dict__['_data'] = dict() | ||||||||||||
| self.__dict__['_data'].update(self._defaults) | ||||||||||||
| self.update(self._defaults) | ||||||||||||
|
|
||||||||||||
| if from_dict: | ||||||||||||
| self.update(from_dict) | ||||||||||||
| self.update(from_dict) | ||||||||||||
|
|
||||||||||||
| if kwargs: | ||||||||||||
| self.update(kwargs) | ||||||||||||
|
|
@@ -230,10 +228,7 @@ def __getitem__(self, k): | |||||||||||
| return self._data[k] | ||||||||||||
|
|
||||||||||||
| def __setitem__(self, k, v): | ||||||||||||
| if self._check : | ||||||||||||
| self._data[k] = self._verify_setter(k, v) | ||||||||||||
| else: | ||||||||||||
| self._data[k] = v | ||||||||||||
| self._data[k] = self._verify_setter(k, v) | ||||||||||||
|
||||||||||||
| self._data[k] = self._verify_setter(k, v) | |
| if self._check: | |
| self._data[k] = self._verify_setter(k, v) | |
| else: | |
| self._data[k] = v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling
self.update(from_dict)whenfrom_dictisNonewill cause anAttributeErrorsinceNonedoes not have anitems()method. While theupdate()method checksif not other:, this will only skipNoneand empty dicts. However, the call is unconditional here. Consider adding a conditional check before callingupdate(from_dict), similar to howkwargsis handled on line 167.