當前位置: 首頁>>代碼示例>>Python>>正文


Python Issue.select方法代碼示例

本文整理匯總了Python中models.Issue.select方法的典型用法代碼示例。如果您正苦於以下問題:Python Issue.select方法的具體用法?Python Issue.select怎麽用?Python Issue.select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.Issue的用法示例。


在下文中一共展示了Issue.select方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_issue_events

# 需要導入模塊: from models import Issue [as 別名]
# 或者: from models.Issue import select [as 別名]
def get_issue_events(show_progress):

    # Retrieve the list of all projects for which issue events should be fetched.
    github_projects = (
        GitHubProject
        .select(GitHubProject.owner, GitHubProject.repo)
        .group_by(GitHubProject.owner, GitHubProject.repo)
    )

    if show_progress:
        progress_bar = ProgressBar(maxval=github_projects.count(), widgets=[
            'Progress: ', Percentage(),
            ' ', Bar(marker=RotatingMarker()),
            ' ', ETA(),
            ' Processing project ', Counter(), ' / ' + str(github_projects.count()) + '.'
        ])
        progress_bar.start()

    # Create a new fetch index
    last_fetch_index = IssueEvent.select(fn.Max(IssueEvent.fetch_index)).scalar() or 0
    fetch_index = last_fetch_index + 1
    issue_fetch_index = Issue.select(fn.Max(Issue.fetch_index)).scalar() or 0

    for project_index, project in enumerate(github_projects, start=1):

        # Wrap a callback that will save fetched events
        save_events_callback = functools.partial(
            save_events,
            project=project,
            fetch_index=fetch_index,
            issue_fetch_index=issue_fetch_index,
        )

        # Fetch all events for all issues for the project
        github_get(
            start_url=(
                GITHUB_API_URL + '/repos/' + project.owner + '/' +
                project.repo + '/issues/events'
            ),
            results_callback=save_events_callback,
        )

        if show_progress:
            progress_bar.update(project_index)

    if show_progress:
        progress_bar.finish()

    # Make sure that all records from the batch inserter have been written out
    batch_inserter.flush()
開發者ID:andrewhead,項目名稱:Package-Qualifiers,代碼行數:52,代碼來源:issue_events.py


注:本文中的models.Issue.select方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。