parent
2d1624f088
commit
0c2d049c90
3 changed files with 10 additions and 6 deletions
|
@ -23,6 +23,8 @@ at anytime.
|
|||
* Fixed incorrect formatting of "amount" fields
|
||||
* Fixed handling of SIGINT, SIGTERM.
|
||||
* Fixed shutdown sequence
|
||||
* Fix error when resolving an integer
|
||||
*
|
||||
|
||||
### Deprecated
|
||||
* The API will no longer be served at the /lbryapi path. It will now be at the root.
|
||||
|
|
|
@ -28,12 +28,12 @@ def set_flag_vals(flag_names, parsed_args):
|
|||
elif key.startswith("--"):
|
||||
if remove_brackets(key[2:]) not in kwargs:
|
||||
k = remove_brackets(key[2:])
|
||||
kwargs[k] = guess_type(arg)
|
||||
elif key in flag_names:
|
||||
if remove_brackets(flag_names[key]) not in kwargs:
|
||||
kwargs[remove_brackets(flag_names[key])] = guess_type(arg)
|
||||
k = remove_brackets(flag_names[key])
|
||||
elif remove_brackets(key) not in kwargs:
|
||||
kwargs[remove_brackets(key)] = guess_type(arg)
|
||||
k = remove_brackets(key)
|
||||
kwargs[k] = guess_type(arg, k)
|
||||
return kwargs
|
||||
|
||||
|
||||
|
@ -130,7 +130,7 @@ def main():
|
|||
return 1
|
||||
|
||||
|
||||
def guess_type(x):
|
||||
def guess_type(x, key=None):
|
||||
if not isinstance(x, (unicode, str)):
|
||||
return x
|
||||
if x in ('true', 'True', 'TRUE'):
|
||||
|
@ -143,6 +143,8 @@ def guess_type(x):
|
|||
except ValueError:
|
||||
# not a float
|
||||
pass
|
||||
if key == "uri":
|
||||
return x
|
||||
try:
|
||||
return int(x)
|
||||
except ValueError:
|
||||
|
|
|
@ -7,6 +7,7 @@ class DaemonCLITests(unittest.TestCase):
|
|||
self.assertEqual('0.3.8', DaemonCLI.guess_type('0.3.8'))
|
||||
self.assertEqual(0.3, DaemonCLI.guess_type('0.3'))
|
||||
self.assertEqual(3, DaemonCLI.guess_type('3'))
|
||||
self.assertEqual('3', DaemonCLI.guess_type('3', key="uri"))
|
||||
self.assertEqual('VdNmakxFORPSyfCprAD/eDDPk5TY9QYtSA==', DaemonCLI.guess_type('VdNmakxFORPSyfCprAD/eDDPk5TY9QYtSA=='))
|
||||
self.assertEqual(0.3, DaemonCLI.guess_type('0.3'))
|
||||
self.assertEqual(True, DaemonCLI.guess_type('TRUE'))
|
||||
|
@ -15,4 +16,3 @@ class DaemonCLITests(unittest.TestCase):
|
|||
self.assertEqual(False, DaemonCLI.guess_type('FALSE'))
|
||||
self.assertEqual(False, DaemonCLI.guess_type('false'))
|
||||
self.assertEqual(False, DaemonCLI.guess_type('False'))
|
||||
|
||||
|
|
Loading…
Reference in a new issue