66
66
Pyperclip could not find a copy/paste mechanism for your system.
67
67
For more information, please visit https://pyperclip.readthedocs.io/en/latest/introduction.html#not-implemented-error """
68
68
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
-
73
69
ENCODING = 'utf-8'
74
70
75
71
# The "which" unix command finds where a command is.
@@ -95,13 +91,10 @@ def __init__(self, message):
95
91
96
92
97
93
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 )
102
95
if not isinstance (text , acceptedTypes ):
103
96
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 )
105
98
106
99
107
100
def init_osx_pbcopy_clipboard ():
@@ -186,7 +179,7 @@ def copy_qt(text):
186
179
187
180
def paste_qt ():
188
181
cb = app .clipboard ()
189
- return STR_OR_UNICODE (cb .text ())
182
+ return str (cb .text ())
190
183
191
184
return copy_qt , paste_qt
192
185
@@ -300,12 +293,8 @@ class ClipboardUnavailable(object):
300
293
def __call__ (self , * args , ** kwargs ):
301
294
raise PyperclipException (EXCEPT_MSG )
302
295
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
309
298
310
299
return ClipboardUnavailable (), ClipboardUnavailable ()
311
300
0 commit comments