From 30b10cc8524ac25200b442afd80d5596239509f9 Mon Sep 17 00:00:00 2001 From: "Mark E. Fuller" Date: Sun, 5 Feb 2023 22:09:25 +0200 Subject: [PATCH] typos and grammar --- docs/source/index.rst | 12 ++++++------ docs/source/usage.rst | 14 +++++++------- forex_python/bitcoin.py | 22 +++++++++++----------- forex_python/converter.py | 2 +- tests/test_bitcoin.py | 14 +++++++------- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index c009d5f..6d42f63 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,17 +1,17 @@ forex-python ============ -Free Foreign exchange rates, bitcoin prices and currency conversion. +Free foreign exchange rates, Bitcoin prices and currency conversion. Features: --------- - List all currency rates. -- BitCoin price for all currencies. -- Converting amount to BitCoins. +- Bitcoin price for all currencies. +- Converting amount to BitCoin. - Get historical rates for any day since 1999. -- Conversion rate for one currency(ex; USD to INR). -- Convert amount from one currency to other.('USD 10$' to INR) -- Currency Symbols +- Conversion rate for one currency (e.g. USD to INR). +- Convert amount from one currency to another (e.g. 'USD $10' to INR) +- Currency symbols - Currency names Contents: diff --git a/docs/source/usage.rst b/docs/source/usage.rst index 15e39a2..d62607f 100644 --- a/docs/source/usage.rst +++ b/docs/source/usage.rst @@ -66,21 +66,21 @@ Bitcoin Prices: >>> b.get_previous_price('USD', date_obj) # get_previous_price('USD', date_obj) 453.378 -3. Convert Amout to bitcoins:: +3. Convert Amount to Bitcoin:: >>> b.convert_to_btc(5000, 'USD') # convert_to_btc(5000, 'USD') 9.36345369116708 -4. Convert Amount to bitcoins based on previous date prices:: +4. Convert Amount to Bitcoin based on previous date prices:: >>> date_obj datetime.datetime(2016, 5, 18, 19, 39, 36, 815417) >>> b.convert_to_btc_on(5000, 'USD', date_obj) # convert_to_btc_on(5000, 'USD', date_obj) 11.028325150316071 -5. Convert Bitcoins to valid currency amount based on latest price:: +5. Convert Bitcoin to valid currency amount based on latest price:: >>> b.convert_btc_to_cur(1.25, 'USD') # convert_btc_to_cur(1.25, 'USD') 668.1012499999999 -6. Convert Bitcoins to valid currency amount based on previous date price:: +6. Convert Bitcoin to valid currency amount based on previous date price:: >>> date_obj datetime.datetime(2016, 5, 18, 19, 39, 36, 815417) >>> b.convert_btc_to_cur_on(1.25, 'EUR', date_obj) @@ -106,7 +106,7 @@ Bitcoin Prices: Currency Symbols & Codes ------------------------- -1. Get Currency symbol Using currency code:: +1. Get currency symbol using currency code:: >>> from forex_python.converter import CurrencyCodes >>> c = CurrencyCodes() >>> c.get_symbol('GBP') @@ -116,8 +116,8 @@ Currency Symbols & Codes >>> print c.get_symbol('EUR') € -2. Get Currency Name using currency code:: +2. Get currency name using currency code:: >>> c.get_currency_name('EUR') u'European Euro' >>> c.get_currency_name('INR') - u'Indian rupee' + u'Indian Rupee' diff --git a/forex_python/bitcoin.py b/forex_python/bitcoin.py index 6ccd226..b699a4d 100644 --- a/forex_python/bitcoin.py +++ b/forex_python/bitcoin.py @@ -6,7 +6,7 @@ class BtcConverter(object): """ - Get bit coin rates and convertion + Get Bitcoin rates and conversion """ def __init__(self, force_decimal=False): self._force_decimal = force_decimal @@ -20,7 +20,7 @@ def _decode_rates(self, response, use_decimal=False): def get_latest_price(self, currency): """ - Get Lates price of one bitcoin to valid Currency 1BTC => X USD + Get latest price of one Bitcoin to valid currency 1BTC => X USD """ url = 'https://api.coindesk.com/v1/bpi/currentprice/{}.json'.format(currency) response = requests.get(url) @@ -34,7 +34,7 @@ def get_latest_price(self, currency): def get_previous_price(self, currency, date_obj): """ - Get Price for one bit coin on given date + Get price for one Bitcoin on given date """ start = date_obj.strftime('%Y-%m-%d') end = date_obj.strftime('%Y-%m-%d') @@ -55,7 +55,7 @@ def get_previous_price(self, currency, date_obj): def get_previous_price_list(self, currency, start_date, end_date): """ - Get List of prices between two dates + Get list of Bitcoin prices between two dates """ start = start_date.strftime('%Y-%m-%d') end = end_date.strftime('%Y-%m-%d') @@ -74,7 +74,7 @@ def get_previous_price_list(self, currency, start_date, end_date): def convert_to_btc(self, amount, currency): """ - Convert X amount to Bit Coins + Convert X amount to Bitcoin """ if isinstance(amount, Decimal): use_decimal = True @@ -98,7 +98,7 @@ def convert_to_btc(self, amount, currency): def convert_btc_to_cur(self, coins, currency): """ - Convert X bit coins to valid currency amount + Convert X Bitcoin to valid currency amount """ if isinstance(coins, Decimal): use_decimal = True @@ -122,7 +122,7 @@ def convert_btc_to_cur(self, coins, currency): def convert_to_btc_on(self, amount, currency, date_obj): """ - Convert X amount to BTC based on given date rate + Convert X amount to Bitcoin based on a given date's rate """ if isinstance(amount, Decimal): use_decimal = True @@ -149,11 +149,11 @@ def convert_to_btc_on(self, amount, currency, date_obj): return converted_btc except TypeError: raise DecimalFloatMismatchError("convert_to_btc_on requires amount parameter is of type Decimal when force_decimal=True") - raise RatesNotAvailableError("BitCoin Rates Source Not Ready For Given Date") + raise RatesNotAvailableError("Bitcoin rates source not ready for given date") def convert_btc_to_cur_on(self, coins, currency, date_obj): """ - Convert X BTC to valid currency amount based on given date + Convert X Bitcoin to valid currency amount based on given's date rate """ if isinstance(coins, Decimal): use_decimal = True @@ -180,11 +180,11 @@ def convert_btc_to_cur_on(self, coins, currency, date_obj): return converted_btc except TypeError: raise DecimalFloatMismatchError("convert_btc_to_cur_on requires amount parameter is of type Decimal when force_decimal=True") - raise RatesNotAvailableError("BitCoin Rates Source Not Ready For Given Date") + raise RatesNotAvailableError("Bitcoin rates source not ready for given date") def get_symbol(self): """ - Here is Unicode symbol for bitcoin + Here is the Unicode symbol for Bitcoin: """ return "\u0E3F" diff --git a/forex_python/converter.py b/forex_python/converter.py index 390a11a..4655b7b 100644 --- a/forex_python/converter.py +++ b/forex_python/converter.py @@ -7,7 +7,7 @@ class RatesNotAvailableError(Exception): """ - Custome Exception when https://theforexapi.com is Down and not available for currency rates + Custom exception when https://theforexapi.com is down and not available for currency rates """ pass diff --git a/tests/test_bitcoin.py b/tests/test_bitcoin.py index a747c8c..f2eccfd 100644 --- a/tests/test_bitcoin.py +++ b/tests/test_bitcoin.py @@ -55,7 +55,7 @@ def test_previous_price_list_with_invalid_currency(self): class TestConvertBtc(TestCase): """ - Test Converting amount to Bit coins + Test converting amount to Bitcoin """ def test_convet_to_btc_with_valid_currency(self): coins = convert_to_btc(250, 'USD') @@ -67,7 +67,7 @@ def test_convet_to_btc_with_invalid_currency(self): class TestConvertBtcToCur(TestCase): """ - Convert Bit Coins to Valid Currency amount + Convert Bitcoin to valid currency amount """ def test_convert_btc_to_cur_valid_currency(self): amount = convert_btc_to_cur(2, 'USD') @@ -79,7 +79,7 @@ def test_convert_btc_to_cur_invalid_currency(self): class TestConvertToBtcOn(TestCase): """ - Convert To bit coin based on previous dates + Convert to Bitcoin based on previous date """ def test_convert_to_btc_on_with_valid_currency(self): date_obj = datetime.datetime.today() - datetime.timedelta(days=15) @@ -93,7 +93,7 @@ def test_convert_to_btc_on_with_invalid_currency(self): class TestConvertBtcToCurOn(TestCase): """ - Convert BitCoins to valid Currency + Convert Bitcoin to valid currency """ def test_convert_to_btc_on_with_valid_currency(self): date_obj = datetime.datetime.today() - datetime.timedelta(days=15) @@ -107,7 +107,7 @@ def test_convert_to_btc_on_with_invalid_currency(self): class TestBitCoinSymbol(TestCase): """ - Bit Coin symbol + Bitcoin symbol """ def test_bitcoin_symbol(self): self.assertEqual(get_btc_symbol(), "\u0E3F") @@ -218,11 +218,11 @@ def test_previous_price_list_with_invalid_currency(self): self.assertFalse(price_list) self.assertEqual(type(price_list), dict) - def test_convet_to_btc_with_valid_currency(self): + def test_convert_to_btc_with_valid_currency(self): coins = self.b.convert_to_btc(Decimal('250'), 'USD') self.assertEqual(type(coins), Decimal) - def test_convet_to_btc_with_invalid_currency(self): + def test_convert_to_btc_with_invalid_currency(self): self.assertRaises(RatesNotAvailableError, self.b.convert_to_btc, Decimal('250'), 'XYZ') def test_convert_btc_to_cur_valid_currency(self):