Simple object for storing attributes. Implements equality by attribute names and values, and provides a simple string representation.
| 1393 | # =========================== |
| 1394 | |
| 1395 | class Namespace(_AttributeHolder): |
| 1396 | """Simple object for storing attributes. |
| 1397 | |
| 1398 | Implements equality by attribute names and values, and provides a simple |
| 1399 | string representation. |
| 1400 | """ |
| 1401 | |
| 1402 | def __init__(self, **kwargs): |
| 1403 | for name in kwargs: |
| 1404 | setattr(self, name, kwargs[name]) |
| 1405 | |
| 1406 | def __eq__(self, other): |
| 1407 | if not isinstance(other, Namespace): |
| 1408 | return NotImplemented |
| 1409 | return vars(self) == vars(other) |
| 1410 | |
| 1411 | def __contains__(self, key): |
| 1412 | return key in self.__dict__ |
| 1413 | |
| 1414 | |
| 1415 | class _ActionsContainer(object): |