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


Python GitHub.openPulls方法代码示例

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


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

示例1: main

# 需要导入模块: from github import GitHub [as 别名]
# 或者: from github.GitHub import openPulls [as 别名]
def main():
	parser = OptionParser(usage="usage: %prog [options]")
	parser.add_option("-g", "--github-user", dest="gituser",
			type="string", help="github user, if not supplied no auth is used", metavar="USER")
	
	(options, args) = parser.parse_args()
	
	jrepo = JiraRepo("https://issues.apache.org/jira/rest/api/2")
	github = GitHub(options)
	
	openPullRequests = github.openPulls("apache","storm")
	stormJiraNumber = re.compile("STORM-[0-9]+")
	openJiras = jrepo.openJiras("STORM")
	
	jira2Pulls = {}
	pullWithoutJira = []
	pullWithBadJira = []
	
	for pull in openPullRequests:
		found = stormJiraNumber.search(pull.title())
		if found:
			jiraNum = found.group(0)
			if not (jiraNum in openJiras):
				pullWithBadJira.append(pull)
			else:
				if jira2Pulls.get(jiraNum) == None:
					jira2Pulls[jiraNum] = []
				jira2Pulls[jiraNum].append(pull)
		else:
			pullWithoutJira.append(pull);
	
	now = datetime.utcnow()
	print "Pull requests that need a JIRA:"
	print "Pull URL\tPull Title\tPull Age\tPull Update Age"
	for pull in pullWithoutJira:
		print ("%s\t%s\t%s\t%s"%(pull.html_url(), pull.title(), daydiff(now, pull.created_at()), daydiff(now, pull.updated_at()))).encode("UTF-8")
	
	print "\nPull with bad or closed JIRA:"
	print "Pull URL\tPull Title\tPull Age\tPull Update Age"
	for pull in pullWithBadJira:
		print ("%s\t%s\t%s\t%s"%(pull.html_url(), pull.title(), daydiff(now, pull.created_at()), daydiff(now, pull.updated_at()))).encode("UTF-8")
	
	print "\nOpen JIRA to Pull Requests and Possible Votes, vote detection is very approximate:"
	print "JIRA\tPull Requests\tJira Summary\tJIRA Age\tPull Age\tJIRA Update Age\tPull Update Age"
	print "\tComment Vote\tComment Author\tPull URL\tComment Age"
	for key, value in jira2Pulls.items():
		print ("%s\t%s\t%s\t%s\t%s\t%s\t%s"%(key, mstr(value), openJiras[key].getSummary(),
			 daydiff(now, openJiras[key].getCreated()), daydiff(now, value[0].created_at()),
			 daydiff(now, openJiras[key].getUpdated()), daydiff(now, value[0].updated_at()))).encode("UTF-8")
		for comment in openJiras[key].getComments():
			#print comment.raw()
			if comment.hasVote():
				print (("\t%s\t%s\t%s\t%s")%(comment.getVote(), comment.getAuthor(), comment.getPull(), daydiff(now, comment.getCreated()))).encode("UTF-8")
开发者ID:100Mbps,项目名称:storm,代码行数:55,代码来源:jira-github-join.py


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