Allow CSRElement objects to be autocompleted.
This commit is contained in:
parent
722edfe9e8
commit
1f6dc446d2
|
@ -3,11 +3,15 @@ import csv
|
||||||
|
|
||||||
class CSRElements:
|
class CSRElements:
|
||||||
def __init__(self, d):
|
def __init__(self, d):
|
||||||
self.d = d
|
self.__dict__.update(d)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def d(self):
|
||||||
|
return self.__dict__
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
try:
|
try:
|
||||||
return self.__dict__['d'][attr]
|
return self.__dict__[attr]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
raise KeyError("No such element " + attr)
|
raise KeyError("No such element " + attr)
|
||||||
|
|
Loading…
Reference in New Issue