Skip to content

Commit

Permalink
Merge pull request #658 from bashtage/074-py27-fixes
Browse files Browse the repository at this point in the history
MAINT: Restore Python 2.7 compat
  • Loading branch information
bashtage authored Jul 29, 2019
2 parents 35189ec + d72e2aa commit b44f4d3
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions pandas_datareader/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import numpy as np

import requests
from io import StringIO

from pandas import DataFrame
from pandas import read_csv, concat
from pandas.io.common import urlencode
from pandas_datareader.compat import bytes_to_str, string_types, binary_type
from pandas_datareader.compat import bytes_to_str, string_types, binary_type, \
StringIO

from pandas_datareader._utils import (RemoteDataError, SymbolWarning,
_sanitize_dates, _init_session)
Expand Down
5 changes: 2 additions & 3 deletions pandas_datareader/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import pandas.io.common as com
import sys
from distutils.version import LooseVersion
from io import BytesIO

PY3 = sys.version_info >= (3, 0)

Expand Down Expand Up @@ -49,7 +48,7 @@ def get_filepath_or_buffer(filepath_or_buffer, encoding=None,

string_types = str,
binary_type = bytes

from io import StringIO

def str_to_bytes(s, encoding=None):
return s.encode(encoding or 'ascii')
Expand All @@ -59,7 +58,7 @@ def bytes_to_str(b, encoding=None):
return b.decode(encoding or 'utf-8')
else:
from urllib2 import HTTPError

from cStringIO import StringIO
reduce = reduce
binary_type = str
string_types = basestring,
Expand Down
2 changes: 1 addition & 1 deletion pandas_datareader/enigma.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import os
import time

from io import StringIO
import pandas as pd

from pandas_datareader.base import _BaseReader, string_types
from pandas_datareader.compat import StringIO


class EnigmaReader(_BaseReader):
Expand Down
4 changes: 2 additions & 2 deletions pandas_datareader/famafrench.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import datetime as dt
import re
import tempfile
from io import StringIO

from zipfile import ZipFile

from pandas import read_csv, to_datetime
from pandas_datareader.compat import lmap
from pandas_datareader.compat import lmap, StringIO

from pandas_datareader.base import _BaseReader

Expand Down
3 changes: 1 addition & 2 deletions pandas_datareader/moex.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

import pandas as pd

from io import StringIO
from pandas_datareader.base import _DailyBaseReader
from pandas_datareader.compat import is_list_like
from pandas_datareader.compat import is_list_like, StringIO


class MoexReader(_DailyBaseReader):
Expand Down
3 changes: 2 additions & 1 deletion pandas_datareader/nasdaq_trader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from ftplib import FTP, all_errors
from io import StringIO

from pandas import read_csv
from pandas_datareader._utils import RemoteDataError
from pandas_datareader.compat import StringIO

import time
import warnings
Expand Down

0 comments on commit b44f4d3

Please sign in to comment.