Skip to content

Commit 8f10b42

Browse files
authored
Merge pull request #743 from bashtage/remove-python-27
Remove python 27
2 parents 57766a5 + b839adc commit 8f10b42

File tree

7 files changed

+20
-37
lines changed

7 files changed

+20
-37
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ env:
1010
matrix:
1111
fast_finish: true
1212
include:
13-
- python: 2.7
14-
env: PANDAS=0.24 NUMPY=1.16
1513
- python: 3.5
1614
env: PANDAS=0.21 NUMPY=1.13
1715
- python: 3.5
@@ -24,6 +22,8 @@ matrix:
2422
env: PANDAS=0.25 NUMPY=1.17
2523
- python: 3.7
2624
env: TEST_TYPE="quandl" PANDAS=0.25 NUMPY=1.17
25+
- python: 3.8
26+
env: PANDAS=0.25 NUMPY=1.18
2727
# In allow failures
2828
- python: 3.7
2929
env: TEST_TYPE="alpha_vantage" PANDAS=0.25 NUMPY=1.17

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ Up to date remote data access for pandas, works for multiple versions of pandas.
2424

2525
.. warning::
2626

27-
v0.8.0 is the last version which officially supports Python 2.7. Future versions of ``pandas_datareader`` will end support for Python 2.x.
27+
v0.8.0 is the last version which officially supports Python 2.7. Future versions of
28+
``pandas_datareader`` will end support for Python 2.x.
2829

2930
.. warning::
3031

pandas_datareader/compat/__init__.py

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from distutils.version import LooseVersion
2-
import sys
2+
from functools import reduce
3+
from io import StringIO
4+
from urllib.error import HTTPError
35

46
import pandas as pd
57
from pandas.api.types import is_list_like, is_number
68
import pandas.io.common as com
79
from pandas.util.testing import assert_frame_equal
810

9-
PY3 = sys.version_info >= (3, 0)
10-
1111
PANDAS_VERSION = LooseVersion(pd.__version__)
1212

1313
PANDAS_0210 = PANDAS_VERSION >= LooseVersion("0.21.0")
@@ -30,6 +30,7 @@
3030
"lmap",
3131
"lrange",
3232
"concat",
33+
"reduce",
3334
]
3435

3536

@@ -45,34 +46,16 @@ def get_filepath_or_buffer(filepath_or_buffer, encoding=None, compression=None):
4546
)
4647

4748

48-
if PY3:
49-
from urllib.error import HTTPError
50-
from functools import reduce
51-
52-
string_types = (str,)
53-
binary_type = bytes
54-
from io import StringIO
55-
56-
def str_to_bytes(s, encoding=None):
57-
return s.encode(encoding or "ascii")
58-
59-
def bytes_to_str(b, encoding=None):
60-
return b.decode(encoding or "utf-8")
61-
49+
string_types = (str,)
50+
binary_type = bytes
6251

63-
else:
64-
from urllib2 import HTTPError
65-
from cStringIO import StringIO
6652

67-
reduce = reduce
68-
binary_type = str
69-
string_types = (basestring,) # noqa: F821
53+
def str_to_bytes(s, encoding=None):
54+
return s.encode(encoding or "ascii")
7055

71-
def bytes_to_str(b, encoding=None):
72-
return b
7356

74-
def str_to_bytes(s, encoding=None):
75-
return s
57+
def bytes_to_str(b, encoding=None):
58+
return b.decode(encoding or "utf-8")
7659

7760

7861
def lmap(*args, **kwargs):

pandas_datareader/moex.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ def url(self):
6767
)
6868

6969
return [
70-
self.__url_data.format(
71-
engine=engine, market=market, symbol=s
72-
) for s in self.symbols if s in self.__markets_n_engines
70+
self.__url_data.format(engine=engine, market=market, symbol=s)
71+
for s in self.symbols
72+
if s in self.__markets_n_engines
7373
for market, engine in self.__markets_n_engines[s]
7474
]
7575

pandas_datareader/tests/test_tiingo.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import pandas as pd
44
import pytest
55

6-
from pandas_datareader.compat import PY3
76
from pandas_datareader.tiingo import (
87
TiingoDailyReader,
98
TiingoIEXHistoricalReader,
@@ -64,7 +63,6 @@ def test_tiingo_metadata(symbols):
6463
assert df.shape[1] == len(symbols)
6564

6665

67-
@pytest.mark.skipif(not PY3, reason="test.support missing on Python 2")
6866
def test_tiingo_no_api_key(symbols):
6967
from test.support import EnvironmentVarGuard
7068

requirements-dev.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
black; python_version > '3.5'
1+
black==19.10b0; python_version > '3.5'
22
flake8-bugbear; python_version > '3.5'
33
coverage
44
codecov
55
coveralls
66
flake8
77
pytest
88
pytest-cov
9-
wrapt
9+
wrapt

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,5 @@ def readme():
5050
test_suite="tests",
5151
tests_require=tests_require,
5252
zip_safe=False,
53+
python_requires=">=3.5",
5354
)

0 commit comments

Comments
 (0)