change name to make python happy
from werobot.utils import to_text
-def __get_value(instance, path, default=None):
+def get_value(instance, path, default=None):
dic = instance.__dict__
for entry in path.split('.'):
dic = dic.get(entry)
@@ -20,24 +20,22 @@ class BaseEntry(object):
class IntEntry(BaseEntry):
def __get__(self, instance, owner):
try:
- v = int(__get_value(instance, self.entry, self.default))
+ return int(get_value(instance, self.entry, self.default))
except TypeError:
- v = None
- return v
+ return
class FloatEntry(BaseEntry):
def __get__(self, instance, owner):
try:
- v = float(__get_value(instance, self.entry, self.default))
+ return float(get_value(instance, self.entry, self.default))
except TypeError:
- v = None
- return v
+ return
class StringEntry(BaseEntry):
def __get__(self, instance, owner):
- v = __get_value(instance, self.entry, self.default)
+ v = get_value(instance, self.entry, self.default)
if v is not None:
return to_text(v)
return v
