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


Python click.launch方法代码示例

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


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

示例1: select

# 需要导入模块: import click [as 别名]
# 或者: from click import launch [as 别名]
def select(questions, num):
    print_full_question(questions[num - 1])
    working = True
    while working:
        user_input = click.prompt("Enter b to launch browser, x to return to search, or q to quit")
        if user_input == 'b':
            click.launch(questions[num - 1].json['link'])
        elif user_input == 'q':
            sys.exit()
        elif user_input == 'x':
            click.echo("\n" * 12)
            # Ranging over the 5 questions including the user's choice
            origin = 0
            if not num % NUM_RESULTS:
                origin = num - NUM_RESULTS
            else:
                origin = num - num % NUM_RESULTS
            for j in range(origin, origin + NUM_RESULTS):
                print_question(questions[j], j + 1)
            working = False
        else:
            click.echo(click.style(
                "The input entered was not recognized as a valid choice.",
                fg="red",
                err=True)) 
开发者ID:lukasschwab,项目名称:stackit,代码行数:27,代码来源:stackit_core.py

示例2: dashboard

# 需要导入模块: import click [as 别名]
# 或者: from click import launch [as 别名]
def dashboard(ctx, yes, url):
    """Open this operation's dashboard details in browser."""
    owner, project_name, run_uuid = get_project_run_or_local(
        ctx.obj.get("project"), ctx.obj.get("run_uuid"), is_cli=True,
    )
    dashboard_url = clean_host(settings.CLIENT_CONFIG.host)
    run_url = "{}/{}/{}/runs/{}/".format(dashboard_url, owner, project_name, run_uuid)
    if url:
        Printer.print_header("The dashboard is available at: {}".format(run_url))
        sys.exit(0)
    if not yes:
        click.confirm(
            "Dashboard page will now open in your browser. Continue?",
            abort=True,
            default=True,
        )
    click.launch(run_url) 
开发者ID:polyaxon,项目名称:polyaxon,代码行数:19,代码来源:operations.py

示例3: publish_via_kokoro

# 需要导入模块: import click [as 别名]
# 或者: from click import launch [as 别名]
def publish_via_kokoro(ctx: TagContext) -> None:
    kokoro_url = "https://fusion.corp.google.com/projectanalysis/current/KOKORO/"

    ctx.fusion_url = parse.urljoin(
        kokoro_url, parse.quote_plus(f"prod:{ctx.kokoro_job_name}")
    )

    if ctx.interactive:
        pyperclip.copy(ctx.release_tag)

        click.secho(
            "> Trigger the Kokoro build with the commitish below to publish to PyPI. The commitish has been copied to the clipboard.",
            fg="cyan",
        )

    click.secho(f"Kokoro build URL:\t\t{click.style(ctx.fusion_url, underline=True)}")
    click.secho(f"Commitish:\t{click.style(ctx.release_tag, bold=True)}")

    if ctx.interactive:
        if click.confirm("Would you like to go the Kokoro build page?", default=True):
            click.launch(ctx.fusion_url) 
开发者ID:googleapis,项目名称:releasetool,代码行数:23,代码来源:common.py

示例4: open

# 需要导入模块: import click [as 别名]
# 或者: from click import launch [as 别名]
def open(alias):
    """Open the series URL in a browser."""
    s = db.Series.alias_lookup(alias)
    click.launch(s.url) 
开发者ID:Hamuko,项目名称:cum,代码行数:6,代码来源:cum.py

示例5: launch

# 需要导入模块: import click [as 别名]
# 或者: from click import launch [as 别名]
def launch():
    """Launch applicaiton."""
    click.launch("https://click.palletsprojects.com/") 
开发者ID:tylerdave,项目名称:PyCon2019-Click-Tutorial,代码行数:5,代码来源:cli.py

示例6: _process_open

# 需要导入模块: import click [as 别名]
# 或者: from click import launch [as 别名]
def _process_open(self):
        """Open link in a browser."""
        click.launch(self._format_issue_url())
        if not click.confirm('Did it work?', default=True):
            click.echo()
            self._process_print()
            click.secho(
                '\nOpen the line manually and copy the text above\n',
                fg='yellow'
            )
            click.secho(
                '  ' + self.REPO_URL + self.ISSUE_SUFFIX + '\n', bold=True
            ) 
开发者ID:SwissDataScienceCenter,项目名称:renku-python,代码行数:15,代码来源:exception_handler.py

示例7: dashboard

# 需要导入模块: import click [as 别名]
# 或者: from click import launch [as 别名]
def dashboard(namespace):
    click.launch(dashboard_url(namespace)) 
开发者ID:Alephbet,项目名称:gimel,代码行数:4,代码来源:cli.py

示例8: read

# 需要导入模块: import click [as 别名]
# 或者: from click import launch [as 别名]
def read(ctx, item_id, with_note):
    """ Read an item attachment. """
    try:
        item_id = pick_item(ctx.obj, item_id)
    except ValueError as e:
        ctx.fail(e.args[0])
    read_att = None
    attachments = ctx.obj.attachments(item_id)
    if not attachments:
        ctx.fail("Could not find an attachment for reading.")
    elif len(attachments) > 1:
        click.echo("Multiple attachments available.")
        read_att = select([(att, att['data']['title'])
                           for att in attachments])
    else:
        read_att = attachments[0]

    att_path = ctx.obj.get_attachment_path(read_att)
    click.echo("Opening '{}'.".format(att_path))
    click.launch(str(att_path), wait=False)
    if with_note:
        existing_notes = list(ctx.obj.notes(item_id))
        if existing_notes:
            edit_existing = click.confirm("Edit existing note?")
            if edit_existing:
                note = pick_note(ctx, ctx.obj, item_id)
            else:
                note = None
        else:
            note = None
        note_body = click.edit(
            text=note['data']['note']['text'] if note else None,
            extension=get_extension(ctx.obj.note_format))
        if note_body and note is None:
            ctx.obj.create_note(item_id, note_body)
        elif note_body:
            note['data']['note']['text'] = note_body
            ctx.obj.save_note(note) 
开发者ID:jbaiter,项目名称:zotero-cli,代码行数:40,代码来源:cli.py

示例9: create_api_key

# 需要导入模块: import click [as 别名]
# 或者: from click import launch [as 别名]
def create_api_key():
        """ Interactively create a new API key via Zotero's OAuth API.

        Requires the user to enter a verification key displayed in the browser.

        :returns:   API key and the user's library ID
        """
        auth = OAuth1Service(
            name='zotero',
            consumer_key=CLIENT_KEY,
            consumer_secret=CLIENT_SECRET,
            request_token_url=REQUEST_TOKEN_URL,
            access_token_url=ACCESS_TOKEN_URL,
            authorize_url=AUTH_URL,
            base_url=BASE_URL)
        token, secret = auth.get_request_token(
            params={'oauth_callback': 'oob'})
        auth_url = auth.get_authorize_url(token)
        auth_url += '&' + urlencode({
            'name': 'zotero-cli',
            'library_access': 1,
            'notes_access': 1,
            'write_access': 1,
            'all_groups': 'read'})
        click.echo("Opening {} in browser, please confirm.".format(auth_url))
        click.launch(auth_url)
        verification = click.prompt("Enter verification code")
        token_resp = auth.get_raw_access_token(
            token, secret, method='POST',
            data={'oauth_verifier': verification})
        if not token_resp:
            logging.debug(token_resp.content)
            click.fail("Error during API key generation.")
        access = urlparse.parse_qs(token_resp.text)
        return access['oauth_token'][0], access['userID'][0] 
开发者ID:jbaiter,项目名称:zotero-cli,代码行数:37,代码来源:backend.py

示例10: doc

# 需要导入模块: import click [as 别名]
# 或者: from click import launch [as 别名]
def doc(version):
    if version not in ["dev", "0.12", "0.11", "0.10", "0.9"]:
        version = "dev"
    url = 'http://bottlepy.org/docs/{}/'.format(version)
    click.launch(url)
    click.echo(u'Bottle Boilerplate start browser!') 
开发者ID:bottlepy,项目名称:bottle-boilerplate,代码行数:8,代码来源:bottle_boilerplate.py

示例11: dashboard

# 需要导入模块: import click [as 别名]
# 或者: from click import launch [as 别名]
def dashboard(yes, url):
    """Open dashboard in browser."""
    dashboard_url = "{}/app".format(PolyaxonClient().api_config.http_host)
    if url:
        click.echo(dashboard_url)
        sys.exit(0)
    if not yes:
        click.confirm('Dashboard page will now open in your browser. Continue?',
                      abort=True, default=True)

    click.launch(dashboard_url) 
开发者ID:polyaxon,项目名称:polyaxon-cli,代码行数:13,代码来源:dashboard.py

示例12: view

# 需要导入模块: import click [as 别名]
# 或者: from click import launch [as 别名]
def view(stmo, file_name):
    """Opens a query in a browser.

    FILE_NAME: The filename of the tracked query SQL.

    Opens a browser window to the redash query.
    """
    try:
        url = stmo.url_for_query(file_name)
    except KeyError:
        click.echo("Couldn't find a query ID for {}: No such query, "
                   "maybe you need to 'track' first".format(file_name),
                   err=True)
        sys.exit(1)
    click.launch(url) 
开发者ID:mozilla,项目名称:stmocli,代码行数:17,代码来源:cli.py

示例13: dashboard

# 需要导入模块: import click [as 别名]
# 或者: from click import launch [as 别名]
def dashboard(yes, url):
    """Open dashboard in browser."""
    dashboard_url = settings.CLIENT_CONFIG.host
    if url:
        click.echo(dashboard_url)
        sys.exit(0)
    if not yes:
        click.confirm(
            "Dashboard page will now open in your browser. Continue?",
            abort=True,
            default=True,
        )

    click.launch(dashboard_url) 
开发者ID:polyaxon,项目名称:polyaxon,代码行数:16,代码来源:dashboard.py

示例14: dashboard

# 需要导入模块: import click [as 别名]
# 或者: from click import launch [as 别名]
def dashboard(ctx, yes, url):
    """Open this operation's dashboard details in browser."""
    owner, project_name = get_project_or_local(ctx.obj.get("project"), is_cli=True)
    dashboard_url = clean_host(settings.CLIENT_CONFIG.host)
    project_url = "{}/{}/{}/".format(dashboard_url, owner, project_name)
    if url:
        Printer.print_header("The dashboard is available at: {}".format(project_url))
        sys.exit(0)
    if not yes:
        click.confirm(
            "Dashboard page will now open in your browser. Continue?",
            abort=True,
            default=True,
        )
    click.launch(project_url) 
开发者ID:polyaxon,项目名称:polyaxon,代码行数:17,代码来源:projects.py

示例15: open_folder

# 需要导入模块: import click [as 别名]
# 或者: from click import launch [as 别名]
def open_folder(self):
        click.launch(environ.get_app_dir()) 
开发者ID:eavatar,项目名称:eavatar-me,代码行数:4,代码来源:shell.py


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