mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-30 07:01:52 +08:00
MAINT: Add a has_key method to BarData for compatibility.
BarData should, at least for the time being, be compatible with existing algorithms that had worked against the prior usage of an ndict as data, which provided `has_key`. Of note, the Python language has deprecated `has_key` in favor of using `in` and `__contains__`.
This commit is contained in:
@@ -144,6 +144,13 @@ class BarData(object):
|
||||
else:
|
||||
return name in self.__dict__
|
||||
|
||||
def has_key(self, name):
|
||||
"""
|
||||
DEPRECATED: __contains__ is preferred, but this method is for
|
||||
compatibility with existing algorithms.
|
||||
"""
|
||||
return name in self
|
||||
|
||||
def __setitem__(self, name, value):
|
||||
self._data[name] = value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user