Skip to content

Commit

Permalink
Upgrade github3.py to v1, click to v6, bump version to 0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
tedivm committed Apr 2, 2018
1 parent b9aef99 commit 61f75e6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
24 changes: 16 additions & 8 deletions gitconsensus/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def getPullRequest(self, number):

def isContributor(self, username):
if not self.contributors:
contributor_list = self.repository.iter_contributors()
contributor_list = self.repository.contributors()
self.contributors = [str(contributor) for contributor in contributor_list]
return username in self.contributors

Expand All @@ -106,14 +106,22 @@ def getConsensus(self):
return Consensus(self.rules)

def setLabelColor(self, name, color):
try:
labels = self.get_labels()
if name not in labels:
self.repository.create_label(name, color)
except:
self.repository.update_label(name, color)
elif color != labels[name].color:
labels[name].update(name, color)

def get_labels(self):
labels = {}
for label in self.repository.labels():
labels[label.name] = label
return labels


class PullRequest:
labels = False

def __init__(self, repository, number):
self.repository = repository
self.consensus = repository.getConsensus()
Expand Down Expand Up @@ -148,7 +156,7 @@ def __init__(self, repository, number):
continue

if 'collaborators_only' in self.repository.rules and self.repository.rules['collaborators_only']:
if not isCollaborator(username):
if not self.repository.isCollaborator(username):
continue

if 'contributors_only' in self.repository.rules and self.repository.rules['contributors_only']:
Expand Down Expand Up @@ -195,7 +203,7 @@ def __init__(self, repository, number):
if self.repository.isContributor(user['login']):
self.contributors_abstain.append(user['login'])

files = self.pr.iter_files()
files = self.pr.files()
self.changes_consensus = False
self.changes_license = False
for changed_file in files:
Expand All @@ -205,7 +213,7 @@ def __init__(self, repository, number):
self.changes_license = True

def hoursSinceLastCommit(self):
commits = self.pr.iter_commits()
commits = self.pr.commits()

for commit in commits:
commit_date_string = commit._json_data['commit']['author']['date']
Expand Down Expand Up @@ -366,7 +374,7 @@ def addComment(self, comment_string):
def getLabelList(self):
if not self.labels:
issue = self.getIssue()
self.labels = [item.name for item in issue.labels]
self.labels = [item.name for item in issue.labels()]
return self.labels

def isBlocked(self):
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
long_description = open('README.md').read()


version = '0.6.1'
version = '0.7.0'
setup(

name = 'gitconsensus',
Expand Down Expand Up @@ -44,8 +44,8 @@
],

install_requires=[
'click>=5.0,<6.0',
'github3.py>=0.9.6,<0.10',
'click>=6.0,<7.0',
'github3.py>=1,<2',
'PyYAML>=3.12,<3.13',
'requests>=2.18.0,<2.19',
],
Expand Down

0 comments on commit 61f75e6

Please sign in to comment.