11import os
22from decimal import Decimal
3- import simplejson as json
3+
44import requests
5+ import simplejson as json
56
67
78class RatesNotAvailableError (Exception ):
@@ -45,7 +46,7 @@ def _get_decoded_rate(
4546 self , response , dest_cur , use_decimal = False , date_str = None ):
4647 return self ._decode_rates (
4748 response , use_decimal = use_decimal , date_str = date_str ).get (
48- dest_cur , None )
49+ dest_cur , None )
4950
5051
5152class CurrencyRates (Common ):
@@ -102,7 +103,8 @@ def convert(self, base_cur, dest_cur, amount, date_obj=None):
102103 converted_amount = rate * amount
103104 return converted_amount
104105 except TypeError :
105- raise DecimalFloatMismatchError ("convert requires amount parameter is of type Decimal when force_decimal=True" )
106+ raise DecimalFloatMismatchError (
107+ "convert requires amount parameter is of type Decimal when force_decimal=True" )
106108 raise RatesNotAvailableError ("Currency Rates Source Not Ready" )
107109
108110
@@ -120,7 +122,7 @@ def __init__(self):
120122
121123 def _get_data (self , currency_code ):
122124 file_path = os .path .dirname (os .path .abspath (__file__ ))
123- with open (file_path + '/raw_data/currencies.json' ) as f :
125+ with open (file_path + '/raw_data/currencies.json' ) as f :
124126 currency_data = json .loads (f .read ())
125127 currency_dict = next ((item for item in currency_data if item ["cc" ] == currency_code ), None )
126128 return currency_dict
@@ -153,7 +155,6 @@ def get_currency_code_from_symbol(self, symbol):
153155
154156_CURRENCY_CODES = CurrencyCodes ()
155157
156-
157158get_symbol = _CURRENCY_CODES .get_symbol
158159get_currency_name = _CURRENCY_CODES .get_currency_name
159160get_currency_code_from_symbol = _CURRENCY_CODES .get_currency_code_from_symbol
0 commit comments