Skip to content

Commit 4bb1f50

Browse files
committed
More silly little PEP-8 fixes.
This is what pre-commit hooks supposed to be used for ;)
1 parent 405dbed commit 4bb1f50

File tree

9 files changed

+33
-17
lines changed

9 files changed

+33
-17
lines changed

github2/bin/manage_collaborators.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,14 @@ def parse_commandline():
5858
if len(args) not in [1, 2]:
5959
parser.error('wrong number of arguments')
6060
if (len(args) == 1 and args[0] in ['add', 'remove']):
61-
parser.error('%r needs a collaborator name as second parameter\n' % args[0])
61+
parser.error('%r needs a collaborator name as second parameter\n'
62+
% args[0])
6263
elif (len(args) == 1 and args[0] != 'list'):
63-
parser.error('unknown command %r. Try "list", "add" or "remove"\n' % args[0])
64+
parser.error('unknown command %r. Try "list", "add" or "remove"\n'
65+
% args[0])
6466
if (len(args) == 2 and args[0] not in ['add', 'remove']):
65-
parser.error('unknown command %r. Try "list", "add" or "remove"\n' % args[0])
67+
parser.error('unknown command %r. Try "list", "add" or "remove"\n'
68+
% args[0])
6669
if not options.login:
6770
parser.error('you must provide --login information\n')
6871

@@ -88,12 +91,15 @@ def main():
8891
datefmt="%Y-%m-%dT%H:%M:%S")
8992
if len(args) == 1:
9093
for repos in github.repos.list(options.account):
91-
fullreposname = github.project_for_user_repo(options.account, repos.name)
92-
print_("%s: %s" % (repos.name, ' '.join(github.repos.list_collaborators(fullreposname))))
94+
fullreposname = github.project_for_user_repo(options.account,
95+
repos.name)
96+
collabs = github.repos.list_collaborators(fullreposname)
97+
print_("%s: %s" % (repos.name, ' '.join(collabs)))
9398
elif len(args) == 2:
9499
command, collaborator = args
95100
for repos in github.repos.list(options.account):
96-
fullreposname = github.project_for_user_repo(options.account, repos.name)
101+
fullreposname = github.project_for_user_repo(options.account,
102+
repos.name)
97103
if collaborator in github.repos.list_collaborators(fullreposname):
98104
if command == 'remove':
99105
github.repos.remove_collaborator(repos.name, collaborator)

github2/core.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ def get_value(self, *args, **kwargs):
167167
# unicode keys are not accepted as kwargs by python, until 2.7:
168168
# http://bugs.python.org/issue2646
169169
# So we make a local dict with the same keys but as strings:
170-
return datatype(**dict((str(k), v) for (k, v) in value.items()))
170+
return datatype(**dict((str(k), v)
171+
for (k, v) in value.items()))
171172
else:
172173
return datatype(**value)
173174
return value
@@ -177,9 +178,10 @@ def get_values(self, *args, **kwargs):
177178
values = self.make_request(*args, **kwargs)
178179
if datatype:
179180
if not PY27:
180-
# Same as above, unicode keys will blow up in **args, so we need to
181-
# create a new 'values' dict with string keys
182-
return [datatype(**dict((str(k), v) for (k, v) in value.items()))
181+
# Same as above, unicode keys will blow up in **args, so we
182+
# need to create a new 'values' dict with string keys
183+
return [datatype(**dict((str(k), v)
184+
for (k, v) in value.items()))
183185
for value in values]
184186
else:
185187
return [datatype(**value) for value in values]

tests/test_charset_header.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ def no_match_test():
77
d = {}
88
assert_equals("ascii", charset_from_headers(d))
99

10+
1011
def utf_test():
1112
d = {'content-type': 'application/json; charset=utf-8'}
1213
assert_equals("utf-8", charset_from_headers(d))

tests/test_commits.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
class CommitProperties(utils.HttpMockTestCase):
99
"""Test commit property handling"""
1010
commit_id = '1c83cde9b5a7c396a01af1007fb7b88765b9ae45'
11+
1112
def test_commit(self):
1213
commit = self.client.commits.show('ask/python-github2', self.commit_id)
1314
assert_equals(commit.message,
@@ -25,8 +26,8 @@ def test_commit(self):
2526
assert_equals(commit.committer['login'], 'JNRowe')
2627
assert_equals(commit.added, None)
2728
assert_equals(commit.removed, None)
28-
assert_equals(commit.modified[0]['filename'], 'github2/bin/manage_collaborators.py')
29-
29+
assert_equals(commit.modified[0]['filename'],
30+
'github2/bin/manage_collaborators.py')
3031

3132
def test_repr(self):
3233
commit = self.client.commits.show('ask/python-github2', self.commit_id)
@@ -36,6 +37,7 @@ def test_repr(self):
3637

3738
class CommitsQueries(utils.HttpMockTestCase):
3839
"""Test commit querying"""
40+
3941
def test_list(self):
4042
commits = self.client.commits.list('JNRowe/misc-overlay')
4143
assert_equals(len(commits), 35)

tests/test_date_handling.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def test_datetime_to_commitdate():
114114
assert_equals(datetime_to_commitdate(dt(2011, 4, 9, 9, 53, 0)),
115115
'2011-04-09T09:53:00-07:00')
116116

117+
117118
def test_isodate_to_datetime():
118119
assert_equals(string_to_datetime('2011-05-22T00:24:15Z'),
119120
dt(2011, 5, 22, 0, 24, 15))

tests/test_organizations.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ def test_add_team(self):
6363
def test_add_team_with_repos(self):
6464
projects = ['JNRowe-test-org/test1', 'JNRowe-test-org/test2']
6565
team = self.client.organizations.add_team('JNRowe-test-org',
66-
'test_push', 'push', projects)
66+
'test_push', 'push',
67+
projects)
6768

6869
team_repos = self.client.teams.repositories(team.id)
6970
assert_equals(['/'.join([x.organization, x.name]) for x in team_repos],

tests/test_pull_requests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ class PullRequestQueries(utils.HttpMockTestCase):
5252
def test_list(self):
5353
pull_requests = self.client.pull_requests.list('ask/python-github2')
5454
assert_equals(len(pull_requests), 1)
55-
assert_equals(pull_requests[0].title, 'Pagination support for commits.')
55+
assert_equals(pull_requests[0].title,
56+
'Pagination support for commits.')
5657

5758
def test_list_with_page(self):
5859
pull_requests = self.client.pull_requests.list('robbyrussell/oh-my-zsh',

tests/test_repositories.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,14 @@ def test_languages(self):
9595
def test_tags(self):
9696
tags = self.client.repos.tags('ask/python-github2')
9797
assert_equals(len(tags), 7)
98-
assert_equals(tags['0.4.1'], '96b0a41dd249c521323700bc11a0a721a7c9e642')
98+
assert_equals(tags['0.4.1'],
99+
'96b0a41dd249c521323700bc11a0a721a7c9e642')
99100

100101
def test_branches(self):
101102
branches = self.client.repos.branches('ask/python-github2')
102103
assert_equals(len(branches), 1)
103-
assert_equals(branches['master'], '1c83cde9b5a7c396a01af1007fb7b88765b9ae45')
104+
assert_equals(branches['master'],
105+
'1c83cde9b5a7c396a01af1007fb7b88765b9ae45')
104106

105107
def test_watchers(self):
106108
watchers = self.client.repos.watchers('ask/python-github2')

tests/test_tz_aware_date_handling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def setup_module():
1616

1717

1818
def teardown_module():
19-
"""Disable timezone-aware datetime handling when finished with this module"""
19+
"""Disable timezone-aware datetime handling when tests have completed"""
2020
core.NAIVE = True
2121

2222

0 commit comments

Comments
 (0)