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


Python GitHub.addlabel方法代碼示例

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


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

示例1:

# 需要導入模塊: from github import GitHub [as 別名]
# 或者: from github.GitHub import addlabel [as 別名]
tickets = trac.sql('SELECT id, summary, description , owner, milestone, component, status, type, priority FROM ticket ORDER BY id') # LIMIT 5
for tid, summary, description, owner, milestone, component, status, type, priority in tickets:
    logging.info("Ticket %d: %s" % (tid, summary))
    if description:
        description = description.strip()
    if milestone:
        milestone = milestone.strip()
    issue = {'title': summary}
    if description:
        issue['body'] = description
    if milestone:
        m = milestone_id.get(milestone)
        if m:
            issue['milestone'] = m 
    if component:
      github.addlabel(component, labels, issue, logging)
    if type:
        # Map 'defect' to 'bug'
    	if type == 'defect':
    	    type = 'bug'
    	github.addlabel(type, labels, issue, logging)
    if priority:
      github.addlabel(priority, labels, issue, logging)

    # We have to create/map Trac users to GitHub usernames before we can assign
    # them to tickets; don't see how to do that conveniently now.
    # if owner.strip():
    #     ticket['assignee'] = owner.strip()
    gh_issue = github.issues(data=issue)
    # Add comments
    comments = trac.sql('SELECT author, newvalue AS body FROM ticket_change WHERE field="comment" AND ticket=%s' % tid)
開發者ID:callumski,項目名稱:github-migrate-trac-tickets,代碼行數:33,代碼來源:trac-tickets-to-gh.py


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