@@ -37,7 +37,11 @@ def symbol(currency_code):
3737 return currency_code
3838
3939
40- def conversion_result (amount , base , converted_amount , dest , use_symbols = False ):
40+ def conversion_result (args , use_symbols = False ):
41+ amount = args .amount
42+ base = args .base
43+ dest = args .dest
44+ converted_amount = converter .convert (args .base , args .dest , args .amount )
4145 if use_symbols :
4246 return "{} {} = {} {}" .format (
4347 symbol (base ), amount , symbol (dest ), converted_amount
@@ -54,10 +58,7 @@ def notify_posix(args):
5458 print ("Requires Linux or macOS with notify2 and dbus package." )
5559 raise
5660 notify2 .init ("forex-python" )
57- notification = conversion_result (
58- 1.0 , args .base , converter .get_rate (args .base , args .dest ), args .dest ,
59- True
60- )
61+ notification = conversion_result (args , True )
6162 n = notify2 .Notification (
6263 "forex-python" , notification , "notification-message-im" # Icon name
6364 )
@@ -73,12 +74,4 @@ def run(args=None, output=sys.stdout):
7374 raise ValueError (
7475 "The option [-n] is available only for POSIX operating systems" )
7576 else :
76- print (
77- conversion_result (
78- args .amount ,
79- args .base ,
80- converter .convert (args .base , args .dest , args .amount ),
81- args .dest ,
82- ),
83- file = output
84- )
77+ print (conversion_result (args ), file = output )
0 commit comments