MCPcopy
hub / github.com/pandas-dev/pandas / init_xsel_clipboard

Function init_xsel_clipboard

pandas/io/clipboard/__init__.py:196–220  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

194
195
196def init_xsel_clipboard():
197 DEFAULT_SELECTION = "-b"
198 PRIMARY_SELECTION = "-p"
199
200 def copy_xsel(text, primary=False):
201 text = _stringifyText(text) # Converts non-str values to str.
202 selection_flag = DEFAULT_SELECTION
203 if primary:
204 selection_flag = PRIMARY_SELECTION
205 with subprocess.Popen(
206 ["xsel", selection_flag, "-i"], stdin=subprocess.PIPE, close_fds=True
207 ) as p:
208 p.communicate(input=text.encode(ENCODING))
209
210 def paste_xsel(primary=False):
211 selection_flag = DEFAULT_SELECTION
212 if primary:
213 selection_flag = PRIMARY_SELECTION
214 with subprocess.Popen(
215 ["xsel", selection_flag, "-o"], stdout=subprocess.PIPE, close_fds=True
216 ) as p:
217 stdout = p.communicate()[0]
218 return stdout.decode(ENCODING)
219
220 return copy_xsel, paste_xsel
221
222
223def init_wl_clipboard():

Callers 1

determine_clipboardFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected