Skip to content

Commit 114812e

Browse files
committed
PEP8
1 parent 684ba93 commit 114812e

File tree

13 files changed

+65
-68
lines changed

13 files changed

+65
-68
lines changed

pandas_datareader/base.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88

99
from pandas import to_datetime
1010
import pandas.compat as compat
11-
from pandas.core.common import PandasError, is_number
11+
from pandas.core.common import is_number
1212
from pandas import Panel, DataFrame
1313
from pandas import read_csv
1414
from pandas.compat import StringIO, bytes_to_str
15-
from pandas.util.testing import _network_error_classes
1615

1716
from pandas_datareader._utils import RemoteDataError, SymbolWarning
1817

@@ -125,11 +124,11 @@ def _read_lines(self, out):
125124
# return 2 rows for the most recent business day
126125
if len(rs) > 2 and rs.index[-1] == rs.index[-2]: # pragma: no cover
127126
rs = rs[:-1]
128-
#Get rid of unicode characters in index name.
127+
# Get rid of unicode characters in index name.
129128
try:
130129
rs.index.name = rs.index.name.decode('unicode_escape').encode('ascii', 'ignore')
131130
except AttributeError:
132-
#Python 3 string has no decode method.
131+
# Python 3 string has no decode method.
133132
rs.index.name = rs.index.name.encode('ascii', 'ignore').decode()
134133
return rs
135134

pandas_datareader/data.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
import warnings
66

77
from pandas_datareader.google.daily import GoogleDailyReader
8-
from pandas_datareader.google.quotes import _get_data as get_quote_google
8+
from pandas_datareader.google.quotes import _get_data as get_quote_google # noqa
99

1010
from pandas_datareader.yahoo.daily import YahooDailyReader
1111
from pandas_datareader.yahoo.quotes import YahooQuotesReader
1212
from pandas_datareader.yahoo.actions import YahooActionReader
13-
from pandas_datareader.yahoo.components import _get_data as get_components_yahoo
13+
from pandas_datareader.yahoo.components import _get_data as get_components_yahoo # noqa
1414
from pandas_datareader.yahoo.options import Options as YahooOptions
1515

1616
from pandas_datareader.eurostat import EurostatReader
@@ -23,18 +23,23 @@
2323
def get_data_fred(*args, **kwargs):
2424
return FredReader(*args, **kwargs).read()
2525

26+
2627
def get_data_famafrench(*args, **kwargs):
2728
return FamaFrenchReader(*args, **kwargs).read()
2829

30+
2931
def get_data_google(*args, **kwargs):
3032
return GoogleDailyReader(*args, **kwargs).read()
3133

34+
3235
def get_data_yahoo(*args, **kwargs):
3336
return YahooDailyReader(*args, **kwargs).read()
3437

38+
3539
def get_data_yahoo_actions(*args, **kwargs):
3640
return YahooActionReader(*args, **kwargs).read()
3741

42+
3843
def get_quote_yahoo(*args, **kwargs):
3944
return YahooQuotesReader(*args, **kwargs).read()
4045

@@ -136,9 +141,8 @@ def DataReader(name, data_source=None, start=None, end=None,
136141
retry_count=retry_count, pause=pause,
137142
session=session).read()
138143
else:
139-
raise NotImplementedError(
140-
"data_source=%r is not implemented" % data_source)
141-
144+
msg = "data_source=%r is not implemented" % data_source
145+
raise NotImplementedError(msg)
142146

143147

144148
def Options(symbol, data_source=None, session=None):

pandas_datareader/eurostat.py

-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,3 @@ def _read_one_data(self, url, params):
4141
except ValueError:
4242
pass
4343
return data
44-

pandas_datareader/famafrench.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def _read_one_data(self, url, params):
103103

104104
df = read_csv(StringIO('Date' + src[start:]), **params)
105105
try:
106-
idx_name = df.index.name # hack for pandas 0.16.2
106+
idx_name = df.index.name # hack for pandas 0.16.2
107107
df = df.to_period(df.index.inferred_freq[:1])
108108
df.index.name = idx_name
109109
except:

pandas_datareader/fred.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
class FredReader(_BaseReader):
8-
98
"""
109
Get data for the given name from the St. Louis FED (FRED).
1110
Date format is datetime
@@ -36,7 +35,7 @@ def fetch_data(url, name):
3635
na_values='.')
3736
try:
3837
return data.truncate(self.start, self.end)
39-
except KeyError: # pragma: no cover
38+
except KeyError: # pragma: no cover
4039
if data.ix[3].name[7:12] == 'Error':
4140
raise IOError("Failed to get the data. Check that {0!r} is "
4241
"a valid FRED series.".format(name))

pandas_datareader/io/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
from pandas_datareader.io.jsdmx import read_jsdmx
2-
from pandas_datareader.io.sdmx import read_sdmx
1+
from pandas_datareader.io.jsdmx import read_jsdmx # noqa
2+
from pandas_datareader.io.sdmx import read_sdmx # noqa

pandas_datareader/io/jsdmx.py

-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from __future__ import unicode_literals
44

55
import itertools
6-
import os
76
import sys
87

98
import numpy as np
@@ -100,4 +99,3 @@ def _parse_dimensions(dimensions):
10099
names.append(key['name'])
101100
midx = pd.MultiIndex.from_product(arrays, names=names)
102101
return midx
103-

pandas_datareader/io/sdmx.py

-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
from __future__ import unicode_literals
22

33
import collections
4-
import os
54

6-
import numpy as np
75
import pandas as pd
8-
import pandas.compat as compat
96

107
from pandas_datareader.io.util import _read_content
118

@@ -155,7 +152,6 @@ def _get_english_name(element):
155152
return name
156153

157154

158-
159155
SDMXCode = collections.namedtuple('SDMXCode', ['codes', 'ts'])
160156

161157

pandas_datareader/io/tests/test_jsdmx.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import numpy as np
66
import pandas as pd
7-
from pandas.compat import range
87
import pandas.util.testing as tm
98

109
from pandas_datareader.io import read_jsdmx
@@ -13,7 +12,7 @@
1312
class TestJSDMX(tm.TestCase):
1413

1514
def setUp(self):
16-
self.dirpath = tm.get_data_path()
15+
self.dirpath = tm.get_data_path()
1716

1817
def test_tourism(self):
1918
# OECD -> Industry and Services -> Inbound Tourism

pandas_datareader/io/util.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import os
44

5-
import pandas as pd
65
import pandas.compat as compat
76
from pandas.io.common import get_filepath_or_buffer
87

@@ -15,7 +14,7 @@ def _read_content(path_or_buf):
1514
if isinstance(filepath_or_buffer, compat.string_types):
1615
try:
1716
exists = os.path.exists(filepath_or_buffer)
18-
except (TypeError,ValueError):
17+
except (TypeError, ValueError):
1918
exists = False
2019

2120
if exists:

pandas_datareader/oecd.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def _read_lines(self, out):
2525
""" read one data from specified URL """
2626
df = read_jsdmx(out)
2727
try:
28-
idx_name = df.index.name # hack for pandas 0.16.2
28+
idx_name = df.index.name # hack for pandas 0.16.2
2929
df.index = pd.to_datetime(df.index)
3030
df = df.sort_index()
3131
df = df.truncate(self.start, self.end)

0 commit comments

Comments
 (0)