Skip to content

Commit 4e826b3

Browse files
committed
Format converter.py
1 parent 0ca3add commit 4e826b3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

forex_python/converter.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import os
22
from decimal import Decimal
3-
import simplejson as json
3+
44
import requests
5+
import simplejson as json
56

67

78
class 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

5152
class 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-
157158
get_symbol = _CURRENCY_CODES.get_symbol
158159
get_currency_name = _CURRENCY_CODES.get_currency_name
159160
get_currency_code_from_symbol = _CURRENCY_CODES.get_currency_code_from_symbol

0 commit comments

Comments
 (0)