Skip to content

Commit 4b6d9b7

Browse files
committed
CLN: Clean up the IO directory even more
1 parent 8f7b01e commit 4b6d9b7

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

pandas/io/clipboard/clipboards.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import subprocess
22

3-
from pandas.compat import text_type
4-
53
from .exceptions import PyperclipException
64

75
EXCEPT_MSG = """
@@ -66,7 +64,7 @@ def copy_qt(text):
6664

6765
def paste_qt():
6866
cb = app.clipboard()
69-
return text_type(cb.text())
67+
return str(cb.text())
7068

7169
return copy_qt, paste_qt
7270

pandas/io/common.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
'-nan', ''}
3232

3333

34-
_urlopen = urlopen
35-
36-
3734
_VALID_URLS = set(uses_relative + uses_netloc + uses_params)
3835
_VALID_URLS.discard('')
3936

@@ -163,7 +160,7 @@ def get_filepath_or_buffer(filepath_or_buffer, encoding=None,
163160
----------
164161
filepath_or_buffer : a url, filepath (str, py.path.local or pathlib.Path),
165162
or buffer
166-
compression : str, optional
163+
compression : {{'gzip', 'bz2', 'zip', 'xz', None}}, optional
167164
encoding : the encoding to use to decode bytes, default is 'utf-8'
168165
mode : str, optional
169166
@@ -177,7 +174,7 @@ def get_filepath_or_buffer(filepath_or_buffer, encoding=None,
177174
filepath_or_buffer = _stringify_path(filepath_or_buffer)
178175

179176
if _is_url(filepath_or_buffer):
180-
req = _urlopen(filepath_or_buffer)
177+
req = urlopen(filepath_or_buffer)
181178
content_encoding = req.headers.get('Content-Encoding', None)
182179
if content_encoding == 'gzip':
183180
# Override compression based on Content-Encoding header

pandas/io/excel/_xlrd.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
from datetime import time
22
from distutils.version import LooseVersion
33
from io import UnsupportedOperation
4+
from urllib.request import urlopen
45

56
import numpy as np
67

78
import pandas.compat as compat
89

9-
from pandas.io.common import _is_url, _urlopen, get_filepath_or_buffer
10+
from pandas.io.common import _is_url, get_filepath_or_buffer
1011
from pandas.io.excel._base import _BaseExcelReader
1112

1213

@@ -35,7 +36,7 @@ def __init__(self, filepath_or_buffer):
3536
# If filepath_or_buffer is a url, want to keep the data as bytes so
3637
# can't pass to get_filepath_or_buffer()
3738
if _is_url(filepath_or_buffer):
38-
filepath_or_buffer = _urlopen(filepath_or_buffer)
39+
filepath_or_buffer = urlopen(filepath_or_buffer)
3940
elif not isinstance(filepath_or_buffer, (ExcelFile, xlrd.Book)):
4041
filepath_or_buffer, _, _, _ = get_filepath_or_buffer(
4142
filepath_or_buffer)

0 commit comments

Comments
 (0)