
    Mga
                         S SK r S SKrS SKJr  S SKJr  S SKJr  S SKJrJ	r	  \ R                  R                  \ R                  R                  \5      5      r\	" SS9\" S5       " S	 S
5      5       5       rg)    N)Decimal)BtcConverter)CurrencyRates)pluginrequireT)networkcurrencyconvc                   0    \ rS rSrSrS rS rS rS rSr	g)	Currencyconv   zw
Convert an amount of money from a currency to another.
-- Type currencyconv, press enter and follow the instructions!
c                     U R                  5       nUR                  S5      nU R                  USU5      nU R                  USU5      nU R                  XXV5        g )NzEnter an amount: zEnter from which currency: zEnter to which currency: )find_currenciesinput_numberget_currencyr	   )selfjarviss
currenciesamountfrom_currencyto_currencys          C/Users/admin/workspace/ai/Jarvis/jarviscli/plugins/currency_conv.py__call__Currencyconv.__call__   s\    ))+
$$%89))&2OQ[\''0KZX&-E    c                 T   [        SS9n[        SS9nUS:X  a  UR                  [        U5      U5      nO=US:X  a  UR	                  [        U5      U5      nOUR                  X4[        U5      5      n[        U5      S-   U-   S-   [        U5      -   S-   U-   nUR                  U5        g)zN
currencyconv converts the given amount to another currency
using fore-python
T)force_decimalBTC z are equal to N)r   r   convert_to_btcr   convert_btc_to_curconvertstrsay)	r   r   r   frtobcresult
outputTexts	            r   r	   Currencyconv.currencyconv   s     t,-%K%%gfor:FEk))'&/2>FYYrwv7F[3&+"6{+-01356


:r   c           	      .   [        [        R                  R                  [        S5      SS9 n[
        R                  " U5      nU VVs0 s H"  o3SS   H  oDR                  5       US   _M     M$     nnnSSS5        U$ s  snnf ! , (       d  f       W$ = f)zH
find_currency creates a dict with the inputs that forex-python accepts
z../data/currencies.csvr)moder         N)openospathjoin	FILE_PATHcsvreaderupper)r   infiler7   rowr-   mydicts         r   r   Currencyconv.find_currencies/   s    
 "'',,y*BC#NRXZZ'F39L6Cq8aggiQ'8i6FL O  M ON s   B	)A?2B?B
Bc                     UR                  U5      R                  5       nXC;   a  X4   $ USR                  5       :X  a5  [        SR                  [	        UR                  5       5      5      5        SnMr  USR                  5       :X  a  SnM  SnM  )zd
get_currency checks if the input the user gave is valid based
on the dictionary of find_currencies
z	show helpz, z*Please enter a valid country or currency: z	try againzEType -show help- to see valid currencies or -try again- to continue: )inputr8   printr4   setvalues)r   r   promptr   r(   s        r   r   Currencyconv.get_currency9   s     V$**,A!}$k''))diiJ$5$5$7 89:Ek''))E8 r    N)
__name__
__module____qualname____firstlineno____doc__r   r	   r   r   __static_attributes__rD   r   r   r   r      s    
F&8r   r   )r2   r6   decimalr   forex_python.bitcoinr   forex_python.converterr   r   r   r3   abspathdirname__file__r5   r   rD   r   r   <module>rQ      sa    	 
  - 0 "GGOOBGGOOH56	 	?8 ?8  ?8r   