当前位置: 首页>>代码示例>>Python>>正文


Python pyperclip.copy方法代码示例

本文整理汇总了Python中pyperclip.copy方法的典型用法代码示例。如果您正苦于以下问题:Python pyperclip.copy方法的具体用法?Python pyperclip.copy怎么用?Python pyperclip.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyperclip的用法示例。


在下文中一共展示了pyperclip.copy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: lazy_load_stub_copy

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import copy [as 别名]
def lazy_load_stub_copy(text):
    '''
    A stub function for copy(), which will load the real copy() function when
    called so that the real copy() function is used for later calls.

    This allows users to import pyperclip without having determine_clipboard()
    automatically run, which will automatically select a clipboard mechanism.
    This could be a problem if it selects, say, the memory-heavy PyQt4 module
    but the user was just going to immediately call set_clipboard() to use a
    different clipboard mechanism.

    The lazy loading this stub function implements gives the user a chance to
    call set_clipboard() to pick another clipboard mechanism. Or, if the user
    simply calls copy() or paste() without calling set_clipboard() first,
    will fall back on whatever clipboard mechanism that determine_clipboard()
    automatically chooses.
    '''
    global copy, paste
    copy, paste = determine_clipboard()
    return copy(text) 
开发者ID:danielecook,项目名称:gist-alfred,代码行数:22,代码来源:__init__.py

示例2: init_dev_clipboard_clipboard

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import copy [as 别名]
def init_dev_clipboard_clipboard():
    def copy_dev_clipboard(text):
        text = _stringifyText(text) # Converts non-str values to str.
        if text == '':
            warnings.warn('Pyperclip cannot copy a blank string to the clipboard on Cygwin. This is effectively a no-op.')
        if '\r' in text:
            warnings.warn('Pyperclip cannot handle \\r characters on Cygwin.')

        fo = open('/dev/clipboard', 'wt')
        fo.write(text)
        fo.close()

    def paste_dev_clipboard():
        fo = open('/dev/clipboard', 'rt')
        content = fo.read()
        fo.close()
        return content

    return copy_dev_clipboard, paste_dev_clipboard 
开发者ID:danielecook,项目名称:gist-alfred,代码行数:21,代码来源:__init__.py

示例3: lazy_load_stub_paste

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import copy [as 别名]
def lazy_load_stub_paste():
    '''
    A stub function for paste(), which will load the real paste() function when
    called so that the real paste() function is used for later calls.

    This allows users to import pyperclip without having determine_clipboard()
    automatically run, which will automatically select a clipboard mechanism.
    This could be a problem if it selects, say, the memory-heavy PyQt4 module
    but the user was just going to immediately call set_clipboard() to use a
    different clipboard mechanism.

    The lazy loading this stub function implements gives the user a chance to
    call set_clipboard() to pick another clipboard mechanism. Or, if the user
    simply calls copy() or paste() without calling set_clipboard() first,
    will fall back on whatever clipboard mechanism that determine_clipboard()
    automatically chooses.
    '''
    global copy, paste
    copy, paste = determine_clipboard()
    return paste() 
开发者ID:danielecook,项目名称:gist-alfred,代码行数:22,代码来源:__init__.py

示例4: copy

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import copy [as 别名]
def copy(to_copy, name='password', erase=False):
    """
        Copy an item to the clipboard
    """

    global clipboard_signature

    # Discard invalid input like `None` or empty strings
    if not erase and (type(to_copy) != str or to_copy == ''):
        print('* Nothing to copy!')
        return False

    pyperclip.copy(to_copy)

    if not erase:
        print('* The %s has been copied to the clipboard.' % (name))

    # Save signature
    clipboard_signature = get_signature(to_copy) 
开发者ID:gabfl,项目名称:vault,代码行数:21,代码来源:clipboard.py

示例5: paste

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import copy [as 别名]
def paste(self, *args):
        """ Usage: paste([PSMRL], text)

        If a pattern is specified, the pattern is clicked first. Doesn't support text paths.
        ``text`` is pasted as is using the OS paste shortcut (Ctrl+V for Windows/Linux, Cmd+V
        for OS X). Note that `paste()` does NOT use special formatting like `type()`.
        """
        target = None
        text = ""
        if len(args) == 1 and isinstance(args[0], basestring):
            text = args[0]
        elif len(args) == 2 and isinstance(args[1], basestring):
            self.click(target)
            text = args[1]
        else:
            raise TypeError("paste method expected [PSMRL], text")

        pyperclip.copy(text)
        # Triggers OS paste for foreground window
        PlatformManager.osPaste()
        time.sleep(0.2) 
开发者ID:glitchassassin,项目名称:lackey,代码行数:23,代码来源:RegionMatching.py

示例6: process_output

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import copy [as 别名]
def process_output(self, text, args):

        if args.json:
            res = self.output_as_json(text)
            print(res)

        elif args.cmd:
            if args.custom_depth:
                self.markdown = args.custom_depth.split(",")
            res = self.output_as_cmd(text)
            print(res)

        elif args.plain:
            res = "\n".join(text)
            print(res)
        else:
            print(text)
            res = text
        if args.clipboard:
            pyperclip.copy(res)

        if args.output:
            codecs.open(args.output, "w", encoding="utf-8").write(u"{}".format(res)) 
开发者ID:depthsecurity,项目名称:armory,代码行数:25,代码来源:ReportTemplate.py

示例7: piratebay_search

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import copy [as 别名]
def piratebay_search(query, doDownload):
    url='https://pirateproxy.gdn/search/'+query+'/0/99/0'
    print("Searching......")
    source=requests.get(url).text
    soup=bs(source,'lxml')
    results=soup.find_all('div',class_='detName')
    i=1
    for r in results:
        print(i,r.text)
        i=i+1

    if doDownload == True:
        print("Enter the Serial Number of the search item you like to download: ")
        choice=int(input())
        print ("Fetching data.....")
        magnet_results=soup.find_all('a',title='Download this torrent using magnet')
        a=[]
        for m in magnet_results:
            a.append(m['href'])
        magnet_link=(a[choice-1])
        print("Magnet Link of your selected choice has been fetched.")
        pyperclip.copy(magnet_link)
        print ("Your magnet link is now in your clipboard.") 
开发者ID:cyberboysumanjay,项目名称:Torrent-Searcher,代码行数:25,代码来源:piratebay.py

示例8: kickass_search

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import copy [as 别名]
def kickass_search(query, doDownload):
    base_url="https://kickasss.to/"
    url=base_url+query+'/'
    print("Searching......")
    source=requests.get(url).text
    soup=bs(source,'lxml')
    name=soup.find_all('a', class_="cellMainLink")
    results=[]
    i=1
    for r in name:
        print(i,r.text)
        i=i+1

    if doDownload == True:
        print("Enter the Serial Number of the search item you like to download: ")
        choice=int(input())
        print ("Fetching data.....")
        magnet=soup.find_all('a', title="Torrent magnet link")
        a=[]
        for m in magnet:
            a.append(m['href'])
        magnet_link=(a[choice-1])
        print("Magnet Link of your selected choice has been fetched.")
        pyperclip.copy(magnet_link)
        print ("Your magnet link is now in your clipboard.") 
开发者ID:cyberboysumanjay,项目名称:Torrent-Searcher,代码行数:27,代码来源:kickass.py

示例9: register_commands

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import copy [as 别名]
def register_commands(commands):
    commands['add'] = RecordAddCommand()
    commands['edit'] = RecordEditCommand()
    commands['rm'] = RecordRemoveCommand()
    commands['search'] = SearchCommand()
    commands['list'] = RecordListCommand()
    commands['list-sf'] = RecordListSfCommand()
    commands['list-team'] = RecordListTeamCommand()
    commands['get'] = RecordGetUidCommand()
    commands['append-notes'] = RecordAppendNotesCommand()
    commands['download-attachment'] = RecordDownloadAttachmentCommand()
    commands['upload-attachment'] = RecordUploadAttachmentCommand()
    commands['delete-attachment'] = RecordDeleteAttachmentCommand()
    commands['clipboard-copy'] = ClipboardCommand()
    commands['record-history'] = RecordHistoryCommand()
    commands['totp'] = TotpCommand() 
开发者ID:Keeper-Security,项目名称:Commander,代码行数:18,代码来源:record.py

示例10: register_command_info

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import copy [as 别名]
def register_command_info(aliases, command_info):
    aliases['a'] = 'add'
    aliases['s'] = 'search'
    aliases['l'] = 'list'
    aliases['lsf'] = 'list-sf'
    aliases['lt'] = 'list-team'
    aliases['g'] = 'get'
    aliases['an'] = 'append-notes'
    aliases['da'] = 'download-attachment'
    aliases['ua'] = 'upload-attachment'
    aliases['cc'] = 'clipboard-copy'
    aliases['find-password'] = ('clipboard-copy', '--output=stdout')
    aliases['rh'] = 'record-history'

    for p in [search_parser, list_parser, get_info_parser, clipboard_copy_parser, record_history_parser, totp_parser,  add_parser, edit_parser, rm_parser,
              append_parser, download_parser, upload_parser, delete_attachment_parser]:
        command_info[p.prog] = p.description
    command_info['list-sf|lsf'] = 'Display all shared folders'
    command_info['list-team|lt'] = 'Display all teams' 
开发者ID:Keeper-Security,项目名称:Commander,代码行数:21,代码来源:record.py

示例11: pass_load

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import copy [as 别名]
def pass_load(self, originator, path):
        """Load a password page."""
        self.set_header(path)
        self.current = path
        self.mode = 'pass_load'
        self._clear_box()
        prevdir = os.path.dirname(path) or '.'
        self.box.body.append(BackButton('BACK', self.dir_load, prevdir, self))
        self.box.body.append(ActionButton('DISPLAY', self.call_pass,
                                          (path, False, None)))
        self.box.body.append(ActionButton('COPY FIRST LINE', self.call_pass,
                                          (path, True, False)))
        self.box.body.append(ActionButton('COPY EVERYTHING', self.call_pass,
                                          (path, True, True)))
        self.box.body.append(ActionButton('GENERATE NEW PASSWORD', self.generate_password, (path, 16, True, True)))
        self.box.body.append(urwid.Text("More copy options are available after displaying the password.")) 
开发者ID:Kwpolska,项目名称:upass,代码行数:18,代码来源:__main__.py

示例12: get_command

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import copy [as 别名]
def get_command(self, ctx, cmd_name):
        """Allow aliases for commands.
        """
        if cmd_name == 'list':
            cmd_name = 'ls'
        elif cmd_name == 'search':
            cmd_name = 'find'
        elif cmd_name == 'gen':
            cmd_name = 'generate'
        elif cmd_name == 'add':
            cmd_name = 'insert'
        elif cmd_name in ['remove', 'delete']:
            cmd_name = 'rm'
        elif cmd_name == 'rename':
            cmd_name = 'mv'
        elif cmd_name == 'copy':
            cmd_name = 'cp'

        # TODO(benedikt) Figure out how to make 'show' the default
        # command and pass cmd_name as the first argument.
        rv = click.Group.get_command(self, ctx, cmd_name)
        if rv is not None:
            return rv 
开发者ID:bfrascher,项目名称:passpy,代码行数:25,代码来源:__main__.py

示例13: cp

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import copy [as 别名]
def cp(ctx, old_path, new_path, force):
    """Copies the password or directory names `old-path` to `new-path`.
    This command is alternatively named `copy`.  If `--force` is
    specified, silently overwrite `new_path` if it exists.  If
    `new-path` ends in a trailing `/`, it is always treated as a
    directory.  Passwords are selectively reencrypted to the
    corresponding keys of their new destination.

    """
    try:
        ctx.obj.copy_path(old_path, new_path, force)
    except StoreNotInitialisedError:
        click.echo(MSG_STORE_NOT_INITIALISED_ERROR)
        return 1
    except FileNotFoundError:
        click.echo('{0} is not in the password store.'.format(old_path))
        return 1
    except PermissionError:
        click.echo(MSG_PERMISSION_ERROR)
        return 1
    except RecursiveCopyMoveError:
        click.echo(MSG_RECURSIVE_COPY_MOVE_ERROR.format('copy'))
        return 1 
开发者ID:bfrascher,项目名称:passpy,代码行数:25,代码来源:__main__.py

示例14: piratebay_search

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import copy [as 别名]
def piratebay_search(query):
    #ubuntu
    url='https://pirateproxy.gdn/search/'+query+'/0/99/0'
    print("Searching......")
    source=requests.get(url).text
    soup=bs(source,'lxml')
    results=soup.find_all('div',class_='detName')
    i=1
    for r in results:
        print(i,r.text)
        i=i+1
    print("Enter the Serial Number of the search item you like to download: ")
    choice=int(input())
    print ("Fetching data.....")
    magnet_results=soup.find_all('a',title='Download this torrent using magnet')
    a=[]
    for m in magnet_results:
        a.append(m['href'])
    magnet_link=(a[choice-1])
    print("Magnet Link of your selected choice has been fetched.")
    pyperclip.copy(magnet_link)
    print ("Your magnet link is now in your clipboard.")
    handle_stream(magnet_link) 
开发者ID:cyberboysumanjay,项目名称:TorrFlix,代码行数:25,代码来源:play.py

示例15: kickass_search

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import copy [as 别名]
def kickass_search(query):
    base_url="https://kat.unblocked.gdn/katsearch/page/1/"
    url=base_url+query
    print("Searching......")
    source=requests.get(url).text
    soup=bs(source,'lxml')
    name=soup.find_all('a', class_="cellMainLink")
    results=[]
    i=1
    for r in name:
        print(i,r.text)
        i=i+1
    print("Enter the Serial Number of the search item you like to download: ")
    choice=int(input())
    print ("Fetching data.....")
    magnet=soup.find_all('a', title="Torrent magnet link")
    a=[]
    for m in magnet:
        a.append(m['href'])
    magnet_link=(a[choice-1])
    print("Magnet Link of your selected choice has been fetched.")
    pyperclip.copy(magnet_link)
    print ("Your magnet link is now in your clipboard.")
    handle_stream(magnet_link) 
开发者ID:cyberboysumanjay,项目名称:TorrFlix,代码行数:26,代码来源:play.py


注:本文中的pyperclip.copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。