MCPcopy
hub / github.com/asweigart/pyperclip / init_osx_pbcopy_clipboard

Function init_osx_pbcopy_clipboard

src/pyperclip/__init__.py:97–110  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

95
96
97def init_osx_pbcopy_clipboard():
98 def copy_osx_pbcopy(text):
99 text = _PYTHON_STR_TYPE(text) # Converts non-str values to str.
100 p = subprocess.Popen(['pbcopy', 'w'],
101 stdin=subprocess.PIPE, close_fds=True)
102 p.communicate(input=text.encode(ENCODING))
103
104 def paste_osx_pbcopy():
105 p = subprocess.Popen(['pbpaste', 'r'],
106 stdout=subprocess.PIPE, close_fds=True)
107 stdout, stderr = p.communicate()
108 return stdout.decode(ENCODING)
109
110 return copy_osx_pbcopy, paste_osx_pbcopy
111
112
113def init_osx_pyobjc_clipboard():

Callers 2

TestOSXClass · 0.90
determine_clipboardFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…