Efforts to make ucloud a python package
This commit is contained in:
parent
bbe09667a6
commit
1e7300b56e
71 changed files with 241 additions and 1043 deletions
26
ucloud/common/classes.py
Normal file
26
ucloud/common/classes.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from etcd3_wrapper import EtcdEntry
|
||||
|
||||
|
||||
class SpecificEtcdEntryBase:
|
||||
def __init__(self, e: EtcdEntry):
|
||||
self.key = e.key
|
||||
|
||||
for k in e.value.keys():
|
||||
self.__setattr__(k, e.value[k])
|
||||
|
||||
def original_keys(self):
|
||||
r = dict(self.__dict__)
|
||||
if "key" in r:
|
||||
del r["key"]
|
||||
return r
|
||||
|
||||
@property
|
||||
def value(self):
|
||||
return self.original_keys()
|
||||
|
||||
@value.setter
|
||||
def value(self, v):
|
||||
self.__dict__ = v
|
||||
|
||||
def __repr__(self):
|
||||
return str(dict(self.__dict__))
|
||||
Loading…
Add table
Add a link
Reference in a new issue