Skip to content

Commit 9ef9551

Browse files
committed
MAINT: Upgrade to Python 3.8
1 parent 61630a2 commit 9ef9551

File tree

10 files changed

+19
-19
lines changed

10 files changed

+19
-19
lines changed

pandas_datareader/av/quotes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,6 @@ def _read_lines(self, out):
7676
df["volume"] = [np.nan * len(self.symbols)]
7777
result.append(df)
7878
if len(result) != len(self.symbols):
79-
raise ValueError("Not all symbols downloaded. Check valid " "ticker(s).")
79+
raise ValueError("Not all symbols downloaded. Check valid ticker(s).")
8080
else:
8181
return pd.concat(result)

pandas_datareader/data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ def DataReader(
491491
elif data_source == "nasdaq":
492492
if name != "symbols":
493493
raise ValueError(
494-
"Only the string 'symbols' is supported for " "Nasdaq, not %r" % (name,)
494+
"Only the string 'symbols' is supported for Nasdaq, not {!r}".format(name)
495495
)
496496
return get_nasdaq_symbols(retry_count=retry_count, pause=pause)
497497

pandas_datareader/io/jsdmx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def _fix_quarter_values(value):
6868
if not m:
6969
return value
7070
quarter, year = m.groups()
71-
value = "{}Q{}".format(quarter, year)
71+
value = f"{quarter}Q{year}"
7272
return value
7373

7474

pandas_datareader/io/sdmx.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ def _get_child(element, key):
165165
if len(elements) == 1:
166166
return elements[0]
167167
elif len(elements) == 0:
168-
raise ValueError("Element {} contains " "no {}".format(element.tag, key))
168+
raise ValueError(f"Element {element.tag} contains no {key}")
169169
else:
170170
raise ValueError(
171-
"Element {} contains " "multiple {}".format(element.tag, key)
171+
f"Element {element.tag} contains multiple {key}"
172172
)
173173

174174

pandas_datareader/nasdaq_trader.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ def _download_nasdaq_symbols(timeout):
4242
ftp_session.login()
4343
except all_errors as err:
4444
raise RemoteDataError(
45-
"Error connecting to {!r}: {}".format(_NASDAQ_FTP_SERVER, err)
45+
f"Error connecting to {_NASDAQ_FTP_SERVER!r}: {err}"
4646
) from err
4747

4848
lines = []
4949
try:
5050
ftp_session.retrlines("RETR " + _NASDAQ_TICKER_LOC, lines.append)
5151
except all_errors as err:
5252
raise RemoteDataError(
53-
"Error downloading from {!r}: {}".format(_NASDAQ_FTP_SERVER, err)
53+
f"Error downloading from {_NASDAQ_FTP_SERVER!r}: {err}"
5454
) from err
5555
finally:
5656
ftp_session.close()
@@ -96,12 +96,12 @@ def get_nasdaq_symbols(retry_count=3, timeout=30, pause=None):
9696
global _ticker_cache
9797

9898
if timeout < 0:
99-
raise ValueError("timeout must be >= 0, not {!r}".format(timeout))
99+
raise ValueError(f"timeout must be >= 0, not {timeout!r}")
100100

101101
if pause is None:
102102
pause = timeout / 3
103103
elif pause < 0:
104-
raise ValueError("pause must be >= 0, not {!r}".format(pause))
104+
raise ValueError(f"pause must be >= 0, not {pause!r}")
105105

106106
if _ticker_cache is None:
107107
while retry_count > 0:

pandas_datareader/quandl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def url(self):
9393
"order": "asc",
9494
"api_key": self.api_key,
9595
}
96-
paramstring = "&".join(["{}={}".format(k, v) for k, v in params.items()])
96+
paramstring = "&".join([f"{k}={v}" for k, v in params.items()])
9797
url = "{url}{dataset}/{symbol}.csv?{params}"
9898
return url.format(
9999
url=self._BASE_URL, dataset=datasetname, symbol=symbol, params=paramstring

pandas_datareader/tests/test_wb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def test_wdi_download_error_handling(self):
154154
cntry_codes = ["USA"]
155155
inds = ["NY.GDP.PCAP.CD", "BAD_INDICATOR"]
156156

157-
msg = "The provided parameter value is not valid\\. " "Indicator: BAD_INDICATOR"
157+
msg = "The provided parameter value is not valid\\. Indicator: BAD_INDICATOR"
158158
with pytest.raises(ValueError, match=msg):
159159
download(
160160
country=cntry_codes,

pandas_datareader/tests/yahoo/test_yahoo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ def test_get_quote_comma_name(self):
7272
assert df["longName"][0] == "Royal Gold, Inc."
7373

7474
@pytest.mark.skip(
75-
"Unreliable test, receive partial " "components back for dow_jones"
75+
"Unreliable test, receive partial components back for dow_jones"
7676
)
7777
def test_get_components_dow_jones(self): # pragma: no cover
7878
df = web.get_components_yahoo("^DJI") # Dow Jones
7979
assert isinstance(df, pd.DataFrame)
8080
assert len(df) == 30
8181

82-
@pytest.mark.skip("Unreliable test, receive partial " "components back for dax")
82+
@pytest.mark.skip("Unreliable test, receive partial components back for dax")
8383
def test_get_components_dax(self): # pragma: no cover
8484
df = web.get_components_yahoo("^GDAXI") # DAX
8585
assert isinstance(df, pd.DataFrame)
@@ -88,7 +88,7 @@ def test_get_components_dax(self): # pragma: no cover
8888
assert df[df.name.str.contains("adidas", case=False)].index == "ADS.DE"
8989

9090
@pytest.mark.skip(
91-
"Unreliable test, receive partial " "components back for nasdaq_100"
91+
"Unreliable test, receive partial components back for nasdaq_100"
9292
)
9393
def test_get_components_nasdaq_100(self): # pragma: no cover
9494
# As of 7/12/13, the conditional will

pandas_datareader/wb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ def __init__(
595595
freq_symbols = ["M", "Q", "A", None]
596596

597597
if freq not in freq_symbols:
598-
msg = "The frequency `{}` is not in the accepted " "list.".format(freq)
598+
msg = f"The frequency `{freq}` is not in the accepted list."
599599
raise ValueError(msg)
600600

601601
self.freq = freq

pandas_datareader/yahoo/options.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class Options(_OptionBaseReader):
6262
>>> all_data = aapl.get_all_data()
6363
"""
6464

65-
_OPTIONS_BASE_URL = "https://query1.finance.yahoo.com/" "v7/finance/options/{sym}"
65+
_OPTIONS_BASE_URL = "https://query1.finance.yahoo.com/v7/finance/options/{sym}"
6666

6767
def get_options_data(self, month=None, year=None, expiry=None):
6868
"""
@@ -144,7 +144,7 @@ def _option_from_url(self, url):
144144
puts = result["options"]["puts"]
145145
except IndexError as exc:
146146
raise RemoteDataError(
147-
"Option json not available " "for url: %s" % url
147+
"Option json not available for url: %s" % url
148148
) from exc
149149

150150
self.underlying_price = (
@@ -479,7 +479,7 @@ def _try_parse_dates(self, year, month, expiry):
479479
if expiry.year == year and expiry.month == month
480480
]
481481
if len(expiry) == 0:
482-
raise ValueError("No expiries available " "in %s-%s" % (year, month))
482+
raise ValueError("No expiries available in {}-{}".format(year, month))
483483

484484
return expiry
485485

@@ -707,7 +707,7 @@ def _parse_url(self, url):
707707
jd = json.loads(self._read_url_as_StringIO(url).read())
708708
if jd is None: # pragma: no cover
709709
raise RemoteDataError(
710-
"Parsed URL {!r} is not " "a valid json object".format(url)
710+
f"Parsed URL {url!r} is not a valid json object"
711711
)
712712
return jd
713713

0 commit comments

Comments
 (0)