本文整理汇总了Python中github.GitHub.labels方法的典型用法代码示例。如果您正苦于以下问题:Python GitHub.labels方法的具体用法?Python GitHub.labels怎么用?Python GitHub.labels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.GitHub
的用法示例。
在下文中一共展示了GitHub.labels方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GitHub
# 需要导入模块: from github import GitHub [as 别名]
# 或者: from github.GitHub import labels [as 别名]
github = GitHub(github_username, github_password, github_repo)
# Show the Trac usernames assigned to tickets as an FYI
logging.info("Getting Trac ticket owners (will NOT be mapped to GitHub username)...")
for (username,) in trac.sql('SELECT DISTINCT owner FROM ticket'):
if username:
username = username.strip() # username returned is tuple like: ('phred',)
logging.debug("Trac ticket owner: %s" % username)
# Get GitHub labels; we'll merge Trac components and other values into them
logging.info("Getting existing GitHub labels...")
labels = {}
for label in github.labels():
labels[label['name']] = label['url'] # ignoring 'color'
logging.debug("label name=%s" % label['name'])
# Get any existing GitHub milestones so we can merge Trac into them.
# We need to reference them by numeric ID in tickets.
# API returns only 'open' issues by default, have to ask for closed like:
# curl -u 'USER:PASS' https://api.github.com/repos/USERNAME/REPONAME/milestones?state=closed
logging.info("Getting existing GitHub milestones...")
milestone_id = {}
for m in github.milestones():
milestone_id[m['title']] = m['number']
logging.debug("milestone (open) title=%s" % m['title'])
for m in github.milestones(query='state=closed'):
milestone_id[m['title']] = m['number']
示例2: Trac
# 需要导入模块: from github import GitHub [as 别名]
# 或者: from github.GitHub import labels [as 别名]
trac = Trac(trac_db_path)
github = GitHub(github_username, github_password, github_repo)
# Show the Trac usernames assigned to tickets as an FYI
logging.info("Getting Trac ticket owners (will NOT be mapped to GitHub username)...")
for (username,) in trac.sql('SELECT DISTINCT owner FROM ticket WHERE component="%s"' % trac_component):
if username:
username = username.strip() # username returned is tuple like: ('phred',)
logging.debug("Trac ticket owner: %s" % username)
# Get GitHub labels; we'll merge Trac priorities and types into them
logging.info("Getting existing GitHub labels...")
gh_labels = {}
for label in github.labels():
gh_labels[label["name"]] = True
logging.debug("label name=%s" % label["name"])
if options.milestones:
# Get any existing GitHub milestones so we can merge Trac into them.
# We need to reference them by numeric ID in tickets.
# API returns only 'open' issues by default, have to ask for closed like:
# curl -u 'USER:PASS' https://api.github.com/repos/USERNAME/REPONAME/milestones?state=closed
logging.info("Getting existing GitHub milestones...")
milestone_id = {}
for m in github.milestones():
milestone_id[m["title"]] = m["number"]
logging.debug("milestone (open) title=%s" % m["title"])
for m in github.milestones(query="state=closed"):
示例3: GitHub
# 需要导入模块: from github import GitHub [as 别名]
# 或者: from github.GitHub import labels [as 别名]
github = GitHub(github_username, github_password, github_repo)
# Show the Trac usernames assigned to tickets as an FYI
logging.info("Getting Trac ticket owners (will NOT be mapped to GitHub username)...")
for (username,) in trac.sql('SELECT DISTINCT owner FROM ticket'):
if username:
username = username.strip() # username returned is tuple like: ('phred',)
logging.debug("Trac ticket owner: %s" % username)
# Get GitHub labels; we'll merge Trac components into them
logging.info("Getting existing GitHub labels...")
labels = {}
for label in github.labels():
labels[label['name']] = label['url'] # ignoring 'color'
logging.debug("label name=%s" % label['name'])
# Get any existing GitHub milestones so we can merge Trac into them.
# We need to reference them by numeric ID in tickets.
# API returns only 'open' issues by default, have to ask for closed like:
# curl -u 'USER:PASS' https://api.github.com/repos/USERNAME/REPONAME/milestones?state=closed
logging.info("Getting existing GitHub milestones...")
milestone_id = {}
for m in github.milestones():
milestone_id[m['title']] = m['number']
logging.debug("milestone (open) title=%s" % m['title'])
for m in github.milestones(query='state=closed'):
milestone_id[m['title']] = m['number']
示例4: Trac
# 需要导入模块: from github import GitHub [as 别名]
# 或者: from github.GitHub import labels [as 别名]
trac = Trac(trac_db_path)
github = GitHub(github_username, github_password, github_repo)
# Show the Trac usernames assigned to tickets as an FYI
logging.info("Getting Trac ticket owners (will NOT be mapped to GitHub username)...")
for (username,) in trac.sql('SELECT DISTINCT owner FROM ticket WHERE component="%s"' % trac_component):
if username:
username = username.strip() # username returned is tuple like: ('phred',)
logging.debug("Trac ticket owner: %s" % username)
# Get GitHub labels; we'll merge Trac priorities and types into them
logging.info("Getting existing GitHub labels...")
gh_labels = {}
for label in github.labels():
gh_labels[label['name']] = True
logging.debug("label name=%s" % label['name'])
if options.milestones:
# Get any existing GitHub milestones so we can merge Trac into them.
# We need to reference them by numeric ID in tickets.
# API returns only 'open' issues by default, have to ask for closed like:
# curl -u 'USER:PASS' https://api.github.com/repos/USERNAME/REPONAME/milestones?state=closed
logging.info("Getting existing GitHub milestones...")
milestone_id = {}
for m in github.milestones():
milestone_id[m['title']] = m['number']
logging.debug("milestone (open) title=%s" % m['title'])
for m in github.milestones(query='state=closed'):