Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
assert p.returncode == 0
if sys.version_info > (3,):
out = out.decode('utf-8')
return out
def use(self):
global getcb, setcb
getcb = self.paste
setcb = self.copy
if os.name == 'nt' or platform.system() == 'Windows':
import ctypes
getcb = winGetClipboard
setcb = winSetClipboard
elif os.name == 'mac' or platform.system() == 'Darwin':
CommandClipboard(copy=['pbcopy'],paste=['pbpaste']).use()
else:
possible_impls = [
CommandClipboard(copy=['putclip'], paste=['getclip']), # cygwin
CommandClipboard(copy=['xsel','-ib'], paste=['xsel','-b']),
CommandClipboard(copy=['xclip', '-selection', 'clipboard','-i'],
paste=['xclip', '-selection', 'clipboard', '-o'])
]
for impl in possible_impls:
if impl.available:
impl.use()
break
else:
try:
import gtk
getcb = gtkGetClipboard