Skip to content

Commit 8f02622

Browse files
committed
CLN: Removed PY2 references
1 parent db162c6 commit 8f02622

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

pandas/io/clipboard/__init__.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@
6666
Pyperclip could not find a copy/paste mechanism for your system.
6767
For more information, please visit https://pyperclip.readthedocs.io/en/latest/introduction.html#not-implemented-error """
6868

69-
PY2 = sys.version_info[0] == 2
70-
71-
STR_OR_UNICODE = unicode if PY2 else str # For paste(): Python 3 uses str, Python 2 uses unicode.
72-
7369
ENCODING = 'utf-8'
7470

7571
# The "which" unix command finds where a command is.
@@ -95,13 +91,10 @@ def __init__(self, message):
9591

9692

9793
def _stringifyText(text):
98-
if PY2:
99-
acceptedTypes = (unicode, str, int, float, bool)
100-
else:
101-
acceptedTypes = (str, int, float, bool)
94+
acceptedTypes = (str, int, float, bool)
10295
if not isinstance(text, acceptedTypes):
10396
raise PyperclipException('only str, int, float, and bool values can be copied to the clipboard, not %s' % (text.__class__.__name__))
104-
return STR_OR_UNICODE(text)
97+
return str(text)
10598

10699

107100
def init_osx_pbcopy_clipboard():
@@ -186,7 +179,7 @@ def copy_qt(text):
186179

187180
def paste_qt():
188181
cb = app.clipboard()
189-
return STR_OR_UNICODE(cb.text())
182+
return str(cb.text())
190183

191184
return copy_qt, paste_qt
192185

@@ -300,12 +293,8 @@ class ClipboardUnavailable(object):
300293
def __call__(self, *args, **kwargs):
301294
raise PyperclipException(EXCEPT_MSG)
302295

303-
if PY2:
304-
def __nonzero__(self):
305-
return False
306-
else:
307-
def __bool__(self):
308-
return False
296+
def __bool__(self):
297+
return False
309298

310299
return ClipboardUnavailable(), ClipboardUnavailable()
311300

0 commit comments

Comments
 (0)