mirror of https://github.com/tLDP/python-tldp
in case we do not have SimpleNamespace
This commit is contained in:
parent
eaf2823fd6
commit
d16d10f405
|
@ -0,0 +1,16 @@
|
|||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
|
||||
class SimpleNamespace:
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.__dict__.update(kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
keys = sorted(self.__dict__)
|
||||
items = ("{}={!r}".format(k, self.__dict__[k]) for k in keys)
|
||||
return "{}({})".format(type(self).__name__, ", ".join(items))
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.__dict__ == other.__dict__
|
Loading…
Reference in New Issue