Esempio n. 1
0
 def test_clipboard_copy_tabs_default(self, sep, excel, df):
     kwargs = build_kwargs(sep, excel)
     df.to_clipboard(**kwargs)
     if PY2:
         # to_clipboard copies unicode, to_csv produces bytes. This is
         # expected behavior
         assert clipboard_get().encode('utf-8') == df.to_csv(sep='\t')
     else:
         assert clipboard_get() == df.to_csv(sep='\t')
 def test_clipboard_copy_tabs_default(self, sep, excel, df):
     kwargs = build_kwargs(sep, excel)
     df.to_clipboard(**kwargs)
     if PY2:
         # to_clipboard copies unicode, to_csv produces bytes. This is
         # expected behavior
         assert clipboard_get().encode('utf-8') == df.to_csv(sep='\t')
     else:
         assert clipboard_get() == df.to_csv(sep='\t')
Esempio n. 3
0
def parse_grid(data=None, sep=None, nostrip=False, comment='#', jagged=False):
    if data is None:
        data = clipboard_get()
    if not nostrip:
        data = dedent(data.rstrip()).strip()
    lines = data.splitlines()
    if comment:
        lines = [re.sub(comment + '.*$', '', line).strip() for line in lines]
        lines = [line for line in lines if line]
    if sep is None:
        sep = guess_splitter(lines)
    if sep is not None and sep != '':
        lines = [re.split(sep, line) for line in lines]
    else:
        lines = [list(line) for line in lines]
    all_items = sum(lines, [])
    mode = str
    if all(re.match('^\d+$', d) for d in all_items):
        mode = int
    elif all(re.match('^\d+\.?\d*$', d) for d in all_items):
        mode = float
    is_rect = all(len(line) == len(lines[0]) for line in lines)
    if is_rect:
        jagged = False
    if jagged:
        return np.array(
            [np.array([mode(val) for val in line]) for line in lines])
    data = np.array([mode(val) for val in all_items])
    if is_rect:
        data = data.reshape(len(lines), -1)
    return data
Esempio n. 4
0
def get_content():
    address = input(
        "Please paste the address or please enter and what it has copied to clipboard will be used: \n"
    )
    if not address:
        address = clipboard_get()
    return address
Esempio n. 5
0
 def read_clipboard(self):
     """Read clipboard into uplaod buffer.
     """
     from pandas.io.clipboard import clipboard_get
     try:
         self.paste_bin.value = clipboard_get()
     except Exception as e:
         print(e)
Esempio n. 6
0
def read_clipboard(sep='\s+', **kwargs):  # pragma: no cover
    r"""
    Read text from clipboard and pass to read_table. See read_table for the
    full argument list

    Parameters
    ----------
    sep : str, default '\s+'.
        A string or regex delimiter. The default of '\s+' denotes
        one or more whitespace characters.

    Returns
    -------
    parsed : DataFrame
    """
    encoding = kwargs.pop('encoding', 'utf-8')

    # only utf-8 is valid for passed value because that's what clipboard
    # supports
    if encoding is not None and encoding.lower().replace('-', '') != 'utf8':
        raise NotImplementedError(
            'reading from clipboard only supports utf-8 encoding')

    from pandas.io.clipboard import clipboard_get
    from pandas.io.parsers import read_table
    text = clipboard_get()

    # try to decode (if needed on PY3)
    # Strange. linux py33 doesn't complain, win py33 does
    if compat.PY3:
        try:
            text = compat.bytes_to_str(
                text,
                encoding=(kwargs.get('encoding')
                          or get_option('display.encoding')))
        except:
            pass

    # Excel copies into clipboard with \t separation
    # inspect no more then the 10 first lines, if they
    # all contain an equal number (>0) of tabs, infer
    # that this came from excel and set 'sep' accordingly
    lines = text[:10000].split('\n')[:-1][:10]

    # Need to remove leading white space, since read_table
    # accepts:
    #    a  b
    # 0  1  2
    # 1  3  4

    counts = set([x.lstrip().count('\t') for x in lines])
    if len(lines) > 1 and len(counts) == 1 and counts.pop() != 0:
        sep = '\t'

    if sep is None and kwargs.get('delim_whitespace') is None:
        sep = '\s+'

    return read_table(StringIO(text), sep=sep, **kwargs)
Esempio n. 7
0
def read_clipboard(sep=r'\s+', **kwargs):  # pragma: no cover
    r"""
    Read text from clipboard and pass to read_table. See read_table for the
    full argument list

    Parameters
    ----------
    sep : str, default '\s+'.
        A string or regex delimiter. The default of '\s+' denotes
        one or more whitespace characters.

    Returns
    -------
    parsed : DataFrame
    """
    encoding = kwargs.pop('encoding', 'utf-8')

    # only utf-8 is valid for passed value because that's what clipboard
    # supports
    if encoding is not None and encoding.lower().replace('-', '') != 'utf8':
        raise NotImplementedError(
            'reading from clipboard only supports utf-8 encoding')

    from pandas.io.clipboard import clipboard_get
    from pandas.io.parsers import read_table
    text = clipboard_get()

    # try to decode (if needed on PY3)
    # Strange. linux py33 doesn't complain, win py33 does
    if compat.PY3:
        try:
            text = compat.bytes_to_str(
                text, encoding=(kwargs.get('encoding') or
                                get_option('display.encoding'))
            )
        except:
            pass

    # Excel copies into clipboard with \t separation
    # inspect no more then the 10 first lines, if they
    # all contain an equal number (>0) of tabs, infer
    # that this came from excel and set 'sep' accordingly
    lines = text[:10000].split('\n')[:-1][:10]

    # Need to remove leading white space, since read_table
    # accepts:
    #    a  b
    # 0  1  2
    # 1  3  4

    counts = {x.lstrip().count('\t') for x in lines}
    if len(lines) > 1 and len(counts) == 1 and counts.pop() != 0:
        sep = r'\t'

    if sep is None and kwargs.get('delim_whitespace') is None:
        sep = r'\s+'

    return read_table(StringIO(text), sep=sep, **kwargs)
Esempio n. 8
0
def parse_table(table=None, sep='\s+', header=None, conv=None, **kw):
    if table is None:
        table = clipboard_get()
    if isinstance(table, str):
        table = io.StringIO(table)
    if conv is not None:
        kw['converters'] = dict(enumerate(conv))
    kw.setdefault("comment", '#')
    return pd.read_table(table, sep=sep, header=header, **kw)
Esempio n. 9
0
def read_clipboard(sep=r"\s+", **kwargs):  # pragma: no cover

    encoding = kwargs.pop("encoding", "utf-8")

    # only utf-8 is valid for passed value because that's what clipboard
    # supports
    if encoding is not None and encoding.lower().replace("-", "") != "utf8":
        raise NotImplementedError(
            "reading from clipboard only supports utf-8 encoding")

    from pandas.io.clipboard import clipboard_get
    from pandas.io.parsers import read_csv

    text = clipboard_get()

    # Try to decode (if needed, as "text" might already be a string here).
    try:
        text = text.decode(
            kwargs.get("encoding") or get_option("display.encoding"))
    except AttributeError:
        pass

    # Excel copies into clipboard with \t separation
    # inspect no more then the 10 first lines, if they
    # all contain an equal number (>0) of tabs, infer
    # that this came from excel and set 'sep' accordingly
    lines = text[:10000].split("\n")[:-1][:10]

    # Need to remove leading white space, since read_csv
    # accepts:
    #    a  b
    # 0  1  2
    # 1  3  4

    counts = {x.lstrip().count("\t") for x in lines}
    if len(lines) > 1 and len(counts) == 1 and counts.pop() != 0:
        sep = "\t"

    # Edge case where sep is specified to be None, return to default
    if sep is None and kwargs.get("delim_whitespace") is None:
        sep = r"\s+"

    # Regex separator currently only works with python engine.
    # Default to python if separator is multi-character (regex)
    if len(sep) > 1 and kwargs.get("engine") is None:
        kwargs["engine"] = "python"
    elif len(sep) > 1 and kwargs.get("engine") == "c":
        warnings.warn(
            "read_clipboard with regex separator does not work properly with c engine"
        )

    return read_csv(StringIO(text), sep=sep, **kwargs)
Esempio n. 10
0
def test_raw_roundtrip(data):
    # PR #25040 wide unicode wasn't copied correctly on PY3 on windows
    clipboard_set(data)
    assert data == clipboard_get()
Esempio n. 11
0
def get_clipboard():
    pass
    return clipboard_get()
Esempio n. 12
0
def clip_read():
    from pandas.io import clipboard

    clipboard.clipboard_get()
Esempio n. 13
0
        title (str): The title
        subtitle (str): The subtitle
        sound (str): The macOS X sound
    """

    code, out, err = osascript.run(
        'display notification "{0}" with title "{1}" subtitle "{2}" sound name "{3}"'
        .format(message, title, subtitle, sound))


## Main process

if argsVid == 'clipboard':  # this is True (i.e. argsVid == 'clipboard') only if debugModeOn is set to "False"
    # 1) Retrieving stored clipboard value
    print('\n1) Retrieving stored clipboard value')
    clipboard_value = clipboard_get()
else:
    # 1) Retrieving the ".ipynb" file path argument
    print('\n1) Retrieving the ".ipynb" file path argument')
    clipboard_value = argsVid
print(' clipboard_value: {0}'.format(clipboard_value.encode('utf-8')))

if os.path.isfile(
        clipboard_value
):  # checking if the file exists on the computer (cf.: https://linuxize.com/post/python-check-if-file-exists/)

    try:

        # 2) Converting ".ipynb" to ".html" (cf.: https://github.com/jupyter/nbconvert)
        # (Example: jupyter nbconvert --to html my_file.ipynb)
        print('2) Converting ".ipynb" to ".html"')
Esempio n. 14
0
def build_maps(tour='DEFAULT'):
    # copy from clipboard
    # assumes a list separated by \n, as if written in a google sheets column
    from pandas.io.clipboard import clipboard_get
    maplist = [x.strip() for x in clipboard_get().split('\n')]

    # copy the maps over from battlecode20-internal-scaffold
    for m in maplist:
        with open(INTERNAL_SCAFFOLD_PATH + '/src/maps/' + m + '.java',
                  'r') as f:
            mp = f.read()
        # change the package name
        mp = mp.replace('package maps', 'package battlecode.world.maps')
        # change the path
        mp = mp.replace(
            'public static final String outputDirectory = "maps/";',
            'public static final String outputDirectory = "engine/src/main/battlecode/world/resources/";'
        )
        # write to maps
        with open('engine/src/main/battlecode/world/maps/' + m + '.java',
                  'w') as f:
            f.write(mp)

    # add the maps to BuildMaps.java
    with open(ENGINE_WORLD_PATH + "/BuildMaps.java", "r") as f:
        bmps = f.read()

    bmps = bmps.replace(
        'public static void main(String[] args) {',
        'public static void main(String[] args) {\n' +
        '\n'.join(['        ' + m + '.main(args);' for m in maplist]))

    with open(ENGINE_WORLD_PATH + "/BuildMaps.java", "w") as f:
        f.write(bmps)

    # build the maps
    os.system('./gradlew buildMaps')

    # now update SERVER_MAPS in client/visualizer/constants.ts
    with open('client/visualizer/src/constants.ts', 'r') as f:
        cs = f.read()

    cs = cs.replace(
        'export const SERVER_MAPS: Map<string, MapType> = new Map<string, MapType>([',
        'export const SERVER_MAPS: Map<string, MapType> = new Map<string, MapType>([\n'
        +
        '\n'.join(['  ["' + m + '", MapType.' + tour + '],' for m in maplist]))

    with open('client/visualizer/src/constants.ts', 'w') as f:
        f.write(cs)

    # now update backend/settings.py
    with open('backend/settings.py', 'r') as f:
        cs = f.read()

    cs = cs.replace(
        'SERVER_MAPS = [',
        'SERVER_MAPS = [\n' + '\n'.join(['  "' + m + '",' for m in maplist]))

    with open('backend/settings.py', 'w') as f:
        f.write(cs)
#!/usr/bin/env python

import gspread
import json
import os
import re
import requests

from webloc2csv import sanitize_title, get_url_tags, get_keyword_tags  # clean_url, extract_title_n_url, add_tags
from bs4 import BeautifulSoup
from oauth2client.service_account import ServiceAccountCredentials
from pandas.io.clipboard import clipboard_get

# ----- Initialization -----
clipboard_txt = clipboard_get()
print(f'Clipboard text:\n{clipboard_txt}')


# ----- Helper Subroutines -----
def clipboard_to_url(clipboard_txt):
    """
    Returns url if the clipboard text starts with http
    otherwise, returns None
    """
    if clipboard_txt.startswith('http'):
        return clipboard_txt
    else:
        print('Clipboard content is not a url:')
        print(f'{clipboard_txt}')
        return None
Esempio n. 16
0
from pandas.io.clipboard import clipboard_get, clipboard_set
text = clipboard_get() 
print(text)

clipboard_set("http://evil-website.net")

text = clipboard_get() 
print(text)
Esempio n. 17
0
from gensim.summarization.summarizer import summarize
from pandas.io.clipboard import clipboard_get, clipboard_set
import argparse

parser = argparse.ArgumentParser(description='Taking word count as argument')
parser.add_argument('word_count', type=int, nargs='?', help='Summery Length')
args = parser.parse_args()
word_count = args.word_count
if word_count is None: word_count = 50

print(summarize(clipboard_get(), word_count=word_count))
Esempio n. 18
0
    'e': ['e', 'E', '£', '€'],
    'f': ['f', 'F'],
    'g': ['g', 'G'],
    'h': ['h', 'H', '#', "¦¬¦"],
    'i': ['i', 'I', '!', "¡"],
    'j': ['j', 'J'],
    'k': ['k', 'K', "|<", "¦<"],
    'l': ['l', 'L'],
    'm': ['m', 'M', '|\/|'],
    'n': ['n', 'N', "|\|", "¦\¦"],
    'o': ['o', 'O', "0"],
    'p': ['p', 'P', "¶"],
    'q': ['q', 'Q'],
    'r': ['r', 'R', "®"],
    's': ['s', 'S', "$", "&"],
    't': ['t', 'T', "¿"],
    'u': ['u', 'U', "|_|"],
    'v': ['v', 'V', "\/"],
    'w': ['w', 'W', "|/\|"],
    'x': ['x', 'X', "×"],
    'y': ['y', 'Y', "¥"],
    'z': ['z', 'Z']
}

try:
    inp = clipboard_get().lower()[::-1]
    out = "".join([random.choice(maps.get(r, r)) for r in inp])
    clipboard_set(out)
except:
    print("ERROR!")
Esempio n. 19
0
def read_clipboard(sep=r'\s+', **kwargs):  # pragma: no cover
    r"""
    Read text from clipboard and pass to read_csv. See read_csv for the
    full argument list

    Parameters
    ----------
    sep : str, default '\s+'
        A string or regex delimiter. The default of '\s+' denotes
        one or more whitespace characters.

    Returns
    -------
    parsed : DataFrame
    """
    encoding = kwargs.pop('encoding', 'utf-8')

    # only utf-8 is valid for passed value because that's what clipboard
    # supports
    if encoding is not None and encoding.lower().replace('-', '') != 'utf8':
        raise NotImplementedError(
            'reading from clipboard only supports utf-8 encoding')

    from pandas.io.clipboard import clipboard_get
    from pandas.io.parsers import read_csv
    text = clipboard_get()

    # Try to decode (if needed, as "text" might already be a string here).
    try:
        text = text.decode(
            kwargs.get('encoding') or get_option('display.encoding'))
    except AttributeError:
        pass

    # Excel copies into clipboard with \t separation
    # inspect no more then the 10 first lines, if they
    # all contain an equal number (>0) of tabs, infer
    # that this came from excel and set 'sep' accordingly
    lines = text[:10000].split('\n')[:-1][:10]

    # Need to remove leading white space, since read_csv
    # accepts:
    #    a  b
    # 0  1  2
    # 1  3  4

    counts = {x.lstrip().count('\t') for x in lines}
    if len(lines) > 1 and len(counts) == 1 and counts.pop() != 0:
        sep = '\t'

    # Edge case where sep is specified to be None, return to default
    if sep is None and kwargs.get('delim_whitespace') is None:
        sep = r'\s+'

    # Regex separator currently only works with python engine.
    # Default to python if separator is multi-character (regex)
    if len(sep) > 1 and kwargs.get('engine') is None:
        kwargs['engine'] = 'python'
    elif len(sep) > 1 and kwargs.get('engine') == 'c':
        warnings.warn('read_clipboard with regex separator does not work'
                      ' properly with c engine')

    return read_csv(StringIO(text), sep=sep, **kwargs)
Esempio n. 20
0
def read_clipboard(sep=r'\s+', **kwargs):  # pragma: no cover
    r"""
    Read text from clipboard and pass to read_csv. See read_csv for the
    full argument list

    Parameters
    ----------
    sep : str, default '\s+'
        A string or regex delimiter. The default of '\s+' denotes
        one or more whitespace characters.

    Returns
    -------
    parsed : DataFrame
    """
    encoding = kwargs.pop('encoding', 'utf-8')

    # only utf-8 is valid for passed value because that's what clipboard
    # supports
    if encoding is not None and encoding.lower().replace('-', '') != 'utf8':
        raise NotImplementedError(
            'reading from clipboard only supports utf-8 encoding')

    from pandas.io.clipboard import clipboard_get
    from pandas.io.parsers import read_csv
    text = clipboard_get()

    # Try to decode (if needed, as "text" might already be a string here).
    try:
        text = text.decode(kwargs.get('encoding')
                           or get_option('display.encoding'))
    except AttributeError:
        pass

    # Excel copies into clipboard with \t separation
    # inspect no more then the 10 first lines, if they
    # all contain an equal number (>0) of tabs, infer
    # that this came from excel and set 'sep' accordingly
    lines = text[:10000].split('\n')[:-1][:10]

    # Need to remove leading white space, since read_csv
    # accepts:
    #    a  b
    # 0  1  2
    # 1  3  4

    counts = {x.lstrip().count('\t') for x in lines}
    if len(lines) > 1 and len(counts) == 1 and counts.pop() != 0:
        sep = '\t'

    # Edge case where sep is specified to be None, return to default
    if sep is None and kwargs.get('delim_whitespace') is None:
        sep = r'\s+'

    # Regex separator currently only works with python engine.
    # Default to python if separator is multi-character (regex)
    if len(sep) > 1 and kwargs.get('engine') is None:
        kwargs['engine'] = 'python'
    elif len(sep) > 1 and kwargs.get('engine') == 'c':
        warnings.warn('read_clipboard with regex separator does not work'
                      ' properly with c engine')

    return read_csv(StringIO(text), sep=sep, **kwargs)
Esempio n. 21
0
filter_re = [문자열사이공백(i) for i in filter_]
for file in filename:
    pass
    hwp.Open(dir1 + file, "HWP", "forceopen:true")
    hwp.HAction.GetDefault("RepeatFind", hwp.HParameterSet.HFindReplace.HSet)
    ctrlcode = hwp.HeadCtrl
    data_parent = []
    while ctrlcode is not None:
        if ctrlcode.CtrlID == "tbl":
            hwp.SetPosBySet(ctrlcode.GetAnchorPos(0))
            hwp.FindCtrl()
            hwp.Run("ShapeObjTableSelCell")
            hwp.Run("TableCellBlockExtend")
            hwp.Run("TableCellBlockExtend")
            hwp.Run("Copy")
            a = clipboard_get()
            if all([re.compile(i).search(a) for i in filter_re]):
                num = 1
                dat = {i: "" for i in filter_}
                posibl = {i: True for i in ["A", "B", "C"]}
                while True:
                    num += 1
                    for 위치, 항목 in zip(["A", "B", "C"], filter_):
                        try:
                            SetTableCellAddr(f"{위치}{num}")
                            hwp.Run("Copy")
                            sub_dat = clipboard_get()
                            sub_dat = re.compile(r'\s+').sub(" ", sub_dat)
                            dat[항목] += " " + sub_dat
                        except:
                            posibl[위치] = False
Esempio n. 22
0
def parse_grid(data=None,
               sep=None,
               strip='udr',
               comment='#',
               empty='',
               ignore_blank=True,
               dtype=None,
               on_empty=None,
               quiet=False):
    msg = fn.identity if quiet else print
    if data is None:
        data = clipboard_get()
    lines = data.splitlines()
    # Strip leading blank line (generally from pasting something into triple
    # quotes)
    if lines and lines[0] == '':
        lines = lines[1:]
    if not lines:
        msg("No data to parse.")
        return np.empty((0, 0), dtype=dtype)
    # Strip comments and blank lines
    if comment:
        lines = [re.sub(comment + '.*$', '', line) for line in lines]
    if ignore_blank:
        lines = [line for line in lines if line]
    # Determine splitter and split lines into items
    if sep is None:
        sep = guess_splitter([line for line in lines if line])
    if sep is not None and sep != '':
        msg(f"Separating by {sep!r}")
        lines = [re.split(sep, line) for line in lines]
    else:
        msg(f"Separating by character")
        lines = [list(line) for line in lines]
    # Pad out shape to rectangular
    lens = [len(line) for line in lines]
    width = max(lens)
    for line in lines:
        if len(line) < width:
            line.extend([''] * (width - len(line)))
    grid = np.array(lines, dtype=str)
    grid[grid == empty] = ''
    if strip:
        grid = subrect(grid, dirs=strip)
    # Determine dtype
    if dtype is None:
        dtype = object
        if all(re.match(r'^\d+$', d) for d in grid.flat if d):
            dtype = int
        elif all(re.match(r'^\d+\.?\d*$', d) for d in grid.flat if d):
            dtype = float
    # xform coerces items to type
    if dtype is object:
        xform = lambda x: x if x != empty else None
    else:
        xform = fn.iffy(dtype, default=on_empty)
        dtype = object if '' in grid.flat and on_empty is None else dtype
    h, w = grid.shape
    result = np.array([[xform(val) for val in line] for line in grid],
                      dtype=dtype)
    msg(f"Array is {h} rows x {w} cols of type {result.dtype}")
    return result
Esempio n. 23
0
def read_clipboard(sep=r'\s+', **kwargs):  # pragma: no cover
    r"""
    Read text from clipboard and pass to read_table. See read_table for the
    full argument list

    Parameters
    ----------
    sep : str, default '\s+'.
        A string or regex delimiter. The default of '\s+' denotes
        one or more whitespace characters.

    Returns
    -------
    parsed : DataFrame
    """
    encoding = kwargs.pop('encoding', 'utf-8')

    # only utf-8 is valid for passed value because that's what clipboard
    # supports
    if encoding is not None and encoding.lower().replace('-', '') != 'utf8':
        raise NotImplementedError(
            'reading from clipboard only supports utf-8 encoding')

    from pandas.io.clipboard import clipboard_get
    from pandas.io.parsers import read_table
    text = clipboard_get()

    # try to decode (if needed on PY3)
    # Strange. linux py33 doesn't complain, win py33 does
    if PY3:
        try:
            text = compat.bytes_to_str(
                text,
                encoding=(kwargs.get('encoding')
                          or get_option('display.encoding')))
        except:
            pass

    # Excel copies into clipboard with \t separation
    # inspect no more then the 10 first lines, if they
    # all contain an equal number (>0) of tabs, infer
    # that this came from excel and set 'sep' accordingly
    lines = text[:10000].split('\n')[:-1][:10]

    # Need to remove leading white space, since read_table
    # accepts:
    #    a  b
    # 0  1  2
    # 1  3  4

    counts = {x.lstrip().count('\t') for x in lines}
    if len(lines) > 1 and len(counts) == 1 and counts.pop() != 0:
        sep = '\t'

    # Edge case where sep is specified to be None, return to default
    if sep is None and kwargs.get('delim_whitespace') is None:
        sep = r'\s+'

    # Regex separator currently only works with python engine.
    # Default to python if separator is multi-character (regex)
    if len(sep) > 1 and kwargs.get('engine') is None:
        kwargs['engine'] = 'python'
    elif len(sep) > 1 and kwargs.get('engine') == 'c':
        warnings.warn('read_clipboard with regex separator does not work'
                      ' properly with c engine')

    # In PY2, the c table reader first encodes text with UTF-8 but Python
    # table reader uses the format of the passed string. For consistency,
    # encode strings for python engine so that output from python and c
    # engines produce consistent results
    if kwargs.get('engine') == 'python' and PY2:
        text = text.encode('utf-8')

    return read_table(StringIO(text), sep=sep, **kwargs)
Esempio n. 24
0
def test_raw_roundtrip(data):
    # PR #25040 wide unicode wasn't copied correctly on PY3 on windows
    clipboard_set(data)
    assert data == clipboard_get()
Esempio n. 25
0
def read_clipboard(sep=r'\s+', **kwargs):  # pragma: no cover
    r"""
    Read text from clipboard and pass to read_table. See read_table for the
    full argument list

    Parameters
    ----------
    sep : str, default '\s+'.
        A string or regex delimiter. The default of '\s+' denotes
        one or more whitespace characters.

    Returns
    -------
    parsed : DataFrame
    """
    encoding = kwargs.pop('encoding', 'utf-8')

    # only utf-8 is valid for passed value because that's what clipboard
    # supports
    if encoding is not None and encoding.lower().replace('-', '') != 'utf8':
        raise NotImplementedError(
            'reading from clipboard only supports utf-8 encoding')

    from pandas.io.clipboard import clipboard_get
    from pandas.io.parsers import read_table
    text = clipboard_get()

    # try to decode (if needed on PY3)
    # Strange. linux py33 doesn't complain, win py33 does
    if PY3:
        try:
            text = compat.bytes_to_str(
                text, encoding=(kwargs.get('encoding') or
                                get_option('display.encoding'))
            )
        except:
            pass

    # Excel copies into clipboard with \t separation
    # inspect no more then the 10 first lines, if they
    # all contain an equal number (>0) of tabs, infer
    # that this came from excel and set 'sep' accordingly
    lines = text[:10000].split('\n')[:-1][:10]

    # Need to remove leading white space, since read_table
    # accepts:
    #    a  b
    # 0  1  2
    # 1  3  4

    counts = {x.lstrip().count('\t') for x in lines}
    if len(lines) > 1 and len(counts) == 1 and counts.pop() != 0:
        sep = '\t'

    # Edge case where sep is specified to be None, return to default
    if sep is None and kwargs.get('delim_whitespace') is None:
        sep = r'\s+'

    # Regex separator currently only works with python engine.
    # Default to python if separator is multi-character (regex)
    if len(sep) > 1 and kwargs.get('engine') is None:
        kwargs['engine'] = 'python'
    elif len(sep) > 1 and kwargs.get('engine') == 'c':
        warnings.warn('read_clipboard with regex separator does not work'
                      ' properly with c engine')

    # In PY2, the c table reader first encodes text with UTF-8 but Python
    # table reader uses the format of the passed string. For consistency,
    # encode strings for python engine so that output from python and c
    # engines produce consistent results
    if kwargs.get('engine') == 'python' and PY2:
        text = text.encode('utf-8')

    return read_table(StringIO(text), sep=sep, **kwargs)