From 3458fdab62c06c9ae69985ceecbbd677b4b1e0b3 Mon Sep 17 00:00:00 2001 From: Kevin Sheppard Date: Mon, 12 Jul 2021 11:24:46 +0100 Subject: [PATCH] MAINT: Update black Update black and reformat --- pandas_datareader/av/__init__.py | 6 +-- pandas_datareader/av/time_series.py | 2 +- pandas_datareader/base.py | 10 ++--- pandas_datareader/econdb.py | 2 +- pandas_datareader/enigma.py | 2 +- pandas_datareader/io/sdmx.py | 2 +- pandas_datareader/oecd.py | 2 +- pandas_datareader/tiingo.py | 60 ++++++++++++++--------------- pandas_datareader/tsp.py | 2 +- pandas_datareader/yahoo/daily.py | 2 +- pandas_datareader/yahoo/fx.py | 2 +- requirements-dev.txt | 2 +- 12 files changed, 47 insertions(+), 47 deletions(-) diff --git a/pandas_datareader/av/__init__.py b/pandas_datareader/av/__init__.py index 74008b09..a5c34ad2 100644 --- a/pandas_datareader/av/__init__.py +++ b/pandas_datareader/av/__init__.py @@ -50,7 +50,7 @@ def __init__( @property def url(self): - """ API URL """ + """API URL""" return AV_BASE_URL @property @@ -59,12 +59,12 @@ def params(self): @property def function(self): - """ Alpha Vantage endpoint function""" + """Alpha Vantage endpoint function""" raise NotImplementedError @property def data_key(self): - """ Key of data returned from Alpha Vantage """ + """Key of data returned from Alpha Vantage""" raise NotImplementedError def _read_lines(self, out): diff --git a/pandas_datareader/av/time_series.py b/pandas_datareader/av/time_series.py index ace052e1..8abe8445 100644 --- a/pandas_datareader/av/time_series.py +++ b/pandas_datareader/av/time_series.py @@ -84,7 +84,7 @@ def forex(self): @property def output_size(self): - """ Used to limit the size of the Alpha Vantage query when + """Used to limit the size of the Alpha Vantage query when possible. """ delta = dt.datetime.now() - self.start diff --git a/pandas_datareader/base.py b/pandas_datareader/base.py index 4d4148df..c9cbd570 100644 --- a/pandas_datareader/base.py +++ b/pandas_datareader/base.py @@ -102,7 +102,7 @@ def read(self): self.close() def _read_one_data(self, url, params): - """ read one data from specified URL """ + """read one data from specified URL""" if self._format == "string": out = self._read_url_as_StringIO(url, params=params) elif self._format == "json": @@ -139,7 +139,7 @@ def _sanitize_response(response): return response.content def _get_response(self, url, params=None, headers=None): - """ send raw HTTP request to get requests.Response from the specified url + """send raw HTTP request to get requests.Response from the specified url Parameters ---------- url : str @@ -181,7 +181,7 @@ def _get_response(self, url, params=None, headers=None): raise RemoteDataError(msg) def _get_crumb(self, *args): - """ To be implemented by subclass """ + """To be implemented by subclass""" raise NotImplementedError("Subclass has not implemented method.") def _output_error(self, out): @@ -221,7 +221,7 @@ def _read_lines(self, out): class _DailyBaseReader(_BaseReader): - """ Base class for Google / Yahoo daily reader """ + """Base class for Google / Yahoo daily reader""" def __init__( self, @@ -302,7 +302,7 @@ def _in_chunks(seq, size): class _OptionBaseReader(_BaseReader): def __init__(self, symbol, session=None): - """ Instantiates options_data with a ticker saved as symbol """ + """Instantiates options_data with a ticker saved as symbol""" self.symbol = symbol.upper() super(_OptionBaseReader, self).__init__(symbols=symbol, session=session) diff --git a/pandas_datareader/econdb.py b/pandas_datareader/econdb.py index 09cb8539..65c450b1 100644 --- a/pandas_datareader/econdb.py +++ b/pandas_datareader/econdb.py @@ -21,7 +21,7 @@ def url(self): ) def read(self): - """ read one data from specified URL """ + """read one data from specified URL""" results = self.session.get(self.url).json()["results"] df = pd.DataFrame({"dates": []}).set_index("dates") diff --git a/pandas_datareader/enigma.py b/pandas_datareader/enigma.py index 5ac162eb..a99dfc79 100644 --- a/pandas_datareader/enigma.py +++ b/pandas_datareader/enigma.py @@ -123,7 +123,7 @@ def get_current_snapshot_id(self, dataset_id): def get_dataset_metadata(self, dataset_id): """Get the Dataset Model of this EnigmaReader's dataset - https://docs.public.enigma.com/resources/dataset/index.html + https://docs.public.enigma.com/resources/dataset/index.html """ url = "datasets/{0}?row_limit=0".format(dataset_id) response = self._get(url) diff --git a/pandas_datareader/io/sdmx.py b/pandas_datareader/io/sdmx.py index 8f6dce9d..29bcbc4a 100644 --- a/pandas_datareader/io/sdmx.py +++ b/pandas_datareader/io/sdmx.py @@ -234,7 +234,7 @@ def _read_sdmx_dsd(path_or_buf): def _read_zipped_sdmx(path_or_buf): - """ Unzipp data contains SDMX-XML """ + """Unzipp data contains SDMX-XML""" data = _read_content(path_or_buf) zp = BytesIO() diff --git a/pandas_datareader/oecd.py b/pandas_datareader/oecd.py index 94364352..d32edb45 100644 --- a/pandas_datareader/oecd.py +++ b/pandas_datareader/oecd.py @@ -22,7 +22,7 @@ def url(self): return "{0}/{1}/all/all?".format(url, self.symbols) def _read_lines(self, out): - """ read one data from specified URL """ + """read one data from specified URL""" df = read_jsdmx(out) try: idx_name = df.index.name # hack for pandas 0.16.2 diff --git a/pandas_datareader/tiingo.py b/pandas_datareader/tiingo.py index 1ab5af56..9b080411 100644 --- a/pandas_datareader/tiingo.py +++ b/pandas_datareader/tiingo.py @@ -25,34 +25,34 @@ def get_tiingo_symbols(): class TiingoIEXHistoricalReader(_BaseReader): """ - Historical data from Tiingo on equities, ETFs and mutual funds, - with re-sampling capability. This query is limited to the last - 1,000 bars based in the endDate. So the startDate is moved if - it goes past the limit. - - Parameters - ---------- - symbols : {str, List[str]} - String symbol or list of symbols - start : string, int, date, datetime, Timestamp - Starting date. Parses many different kind of date - representations (e.g., 'JAN-01-2010', '1/1/10', 'Jan, 1, 1980'). Defaults to - 20 years before current date. - end : string, int, date, datetime, Timestamp - Ending date - retry_count : int, default 3 - Number of times to retry query request. - pause : float, default 0.1 - Time, in seconds, of the pause between retries. - session : Session, default None - requests.sessions.Session instance to be used - freq : {str, None} - Re-sample frequency. Format is # + (min/hour); e.g. "15min" or "4hour". - If no value is provided, defaults to 5min. The minimum value is "1min". - Units in minutes (min) and hours (hour) are accepted. - api_key : str, optional - Tiingo API key . If not provided the environmental variable - TIINGO_API_KEY is read. The API key is *required*. + Historical data from Tiingo on equities, ETFs and mutual funds, + with re-sampling capability. This query is limited to the last + 1,000 bars based in the endDate. So the startDate is moved if + it goes past the limit. + + Parameters + ---------- + symbols : {str, List[str]} + String symbol or list of symbols + start : string, int, date, datetime, Timestamp + Starting date. Parses many different kind of date + representations (e.g., 'JAN-01-2010', '1/1/10', 'Jan, 1, 1980'). Defaults to + 20 years before current date. + end : string, int, date, datetime, Timestamp + Ending date + retry_count : int, default 3 + Number of times to retry query request. + pause : float, default 0.1 + Time, in seconds, of the pause between retries. + session : Session, default None + requests.sessions.Session instance to be used + freq : {str, None} + Re-sample frequency. Format is # + (min/hour); e.g. "15min" or "4hour". + If no value is provided, defaults to 5min. The minimum value is "1min". + Units in minutes (min) and hours (hour) are accepted. + api_key : str, optional + Tiingo API key . If not provided the environmental variable + TIINGO_API_KEY is read. The API key is *required*. """ def __init__( @@ -105,7 +105,7 @@ def _get_crumb(self, *args): pass def _read_one_data(self, url, params): - """ read one data from specified URL """ + """read one data from specified URL""" headers = { "Content-Type": "application/json", "Authorization": "Token " + self.api_key, @@ -207,7 +207,7 @@ def _get_crumb(self, *args): pass def _read_one_data(self, url, params): - """ read one data from specified URL """ + """read one data from specified URL""" headers = { "Content-Type": "application/json", "Authorization": "Token " + self.api_key, diff --git a/pandas_datareader/tsp.py b/pandas_datareader/tsp.py index 1b5b6c35..06bcb8ca 100644 --- a/pandas_datareader/tsp.py +++ b/pandas_datareader/tsp.py @@ -72,7 +72,7 @@ def url(self): return "https://secure.tsp.gov/components/CORS/getSharePricesRaw.html" def read(self): - """ read one data from specified URL """ + """read one data from specified URL""" df = super(TSPReader, self).read() df.columns = map(lambda x: x.strip(), df.columns) df.drop(columns=self.all_symbols - set(self.symbols), inplace=True) diff --git a/pandas_datareader/yahoo/daily.py b/pandas_datareader/yahoo/daily.py index e1578b09..32bb38db 100644 --- a/pandas_datareader/yahoo/daily.py +++ b/pandas_datareader/yahoo/daily.py @@ -144,7 +144,7 @@ def _get_params(self, symbol): return params def _read_one_data(self, url, params): - """ read one data from specified symbol """ + """read one data from specified symbol""" symbol = params["symbol"] del params["symbol"] diff --git a/pandas_datareader/yahoo/fx.py b/pandas_datareader/yahoo/fx.py index 81a0f0ec..8420cabd 100644 --- a/pandas_datareader/yahoo/fx.py +++ b/pandas_datareader/yahoo/fx.py @@ -78,7 +78,7 @@ def read(self): self.close() def _read_one_data(self, symbol): - """ read one data from specified URL """ + """read one data from specified URL""" url = "https://query1.finance.yahoo.com/v8/finance/chart/{}=X".format(symbol) params = self._get_params(symbol) diff --git a/requirements-dev.txt b/requirements-dev.txt index 57b0261f..aff8441a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,4 @@ -black==19.10b0; python_version > '3.5' +black==21.5b1; python_version > '3.5' flake8-bugbear; python_version > '3.5' coverage codecov