alexferl / vyper

Python configuration with (more) fangs
MIT License
144 stars 21 forks source link

some get functions doesn't return zero value on non exists key #25

Closed dlemel8 closed 4 years ago

dlemel8 commented 5 years ago

Docs says:

One important thing to recognize is that each get function will return a zero value if it’s not found.

However, on python 3.7.4:

v = vyper.Vyper()

v.get_string('bla')
'None'

v.get_int('bla')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/.local/lib/python3.7/site-packages/vyper/vyper.py", line 211, in get_int
    return int(self.get(key))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

v.get_float('bla')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/.local/lib/python3.7/site-packages/vyper/vyper.py", line 214, in get_float
    return float(self.get(key))
TypeError: float() argument must be a string or a number, not 'NoneType' 

Expected behavior is:

v = vyper.Vyper()

v.get_string('bla')
''

v.get_int('bla')
0

v.get_float('bla')
0.0