Skip to content

Commit 0b51a66

Browse files
committed
Reformat changes with black
1 parent c8b93cd commit 0b51a66

File tree

9 files changed

+224
-199
lines changed

9 files changed

+224
-199
lines changed

src/github3/__init__.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -60,43 +60,43 @@
6060
from .exceptions import GitHubError
6161

6262
__all__ = (
63-
'GitHub',
64-
'GitHubEnterprise',
65-
'GitHubError',
66-
'GitHubStatus',
67-
'authorize',
68-
'login',
69-
'enterprise_login',
70-
'emojis',
71-
'gist',
72-
'gitignore_template',
73-
'create_gist',
74-
'issue',
75-
'markdown',
76-
'octocat',
77-
'organization',
78-
'pull_request',
79-
'followers_of',
80-
'followed_by',
81-
'public_gists',
82-
'gists_by',
83-
'issues_on',
84-
'gitignore_templates',
85-
'all_repositories',
86-
'all_users',
87-
'all_events',
88-
'organizations_with',
89-
'repositories_by',
90-
'starred_by',
91-
'subscriptions_for',
92-
'rate_limit',
93-
'repository',
94-
'search_code',
95-
'search_repositories',
96-
'search_users',
97-
'search_issues',
98-
'user',
99-
'zen',
63+
"GitHub",
64+
"GitHubEnterprise",
65+
"GitHubError",
66+
"GitHubStatus",
67+
"authorize",
68+
"login",
69+
"enterprise_login",
70+
"emojis",
71+
"gist",
72+
"gitignore_template",
73+
"create_gist",
74+
"issue",
75+
"markdown",
76+
"octocat",
77+
"organization",
78+
"pull_request",
79+
"followers_of",
80+
"followed_by",
81+
"public_gists",
82+
"gists_by",
83+
"issues_on",
84+
"gitignore_templates",
85+
"all_repositories",
86+
"all_users",
87+
"all_events",
88+
"organizations_with",
89+
"repositories_by",
90+
"starred_by",
91+
"subscriptions_for",
92+
"rate_limit",
93+
"repository",
94+
"search_code",
95+
"search_repositories",
96+
"search_users",
97+
"search_issues",
98+
"user",
99+
"zen",
100100
# Metadata attributes
101101
"__package_name__",
102102
"__title__",

src/github3/checks.py

Lines changed: 91 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ class CheckPullRequest(models.GitHubCore):
3939
"""
4040

4141
def _update_attributes(self, pull):
42-
self.id = pull['id']
43-
self.number = pull['number']
44-
self.base = pull['base']
45-
self.head = pull['head']
46-
self._api = self.url = pull['url']
42+
self.id = pull["id"]
43+
self.number = pull["number"]
44+
self.base = pull["base"]
45+
self.head = pull["head"]
46+
self._api = self.url = pull["url"]
4747

4848
def _repr(self):
49-
return '<CheckPullRequest [#{0}]>'.format(self.number)
49+
return "<CheckPullRequest [#{0}]>".format(self.number)
5050

5151
def to_pull(self):
5252
"""Retrieve a full PullRequest object for this CheckPullRequest.
@@ -57,6 +57,7 @@ def to_pull(self):
5757
:class:`~github3.pulls.PullRequest`
5858
"""
5959
from . import pulls
60+
6061
json = self._json(self._get(self.url), 200)
6162
return self._instance_or_null(pulls.PullRequest, json)
6263

@@ -103,16 +104,17 @@ class CheckApp(models.GitHubCore):
103104
"""
104105

105106
def _update_attributes(self, app):
106-
self.description = app['description']
107-
self.external_url = app['external_url']
108-
self.html_url = app['html_url']
109-
self.id = app['id']
110-
self.name = app['name']
111-
self.owner = app['owner']
107+
self.description = app["description"]
108+
self.external_url = app["external_url"]
109+
self.html_url = app["html_url"]
110+
self.id = app["id"]
111+
self.name = app["name"]
112+
self.owner = app["owner"]
112113

113114
def _repr(self):
114-
return '<App ["{}" by {}]>'.format(self.name,
115-
str(self.owner['login']))
115+
return '<App ["{}" by {}]>'.format(
116+
self.name, str(self.owner["login"])
117+
)
116118

117119
def to_app(self):
118120
"""Retrieve a full App object for this CheckApp.
@@ -123,6 +125,7 @@ def to_app(self):
123125
:class:`~github3.apps.App`
124126
"""
125127
from . import apps
128+
126129
json = self._json(self._get(self.url), 200)
127130
return self._instance_or_null(apps.App, json)
128131

@@ -189,31 +192,30 @@ class CheckSuite(models.GitHubCore):
189192
http://developer.github.com/v3/checks/suites/
190193
"""
191194

192-
class_name = 'CheckSuite'
193-
CUSTOM_HEADERS = {
194-
'Accept': 'application/vnd.github.antiope-preview+json'
195-
}
195+
class_name = "CheckSuite"
196+
CUSTOM_HEADERS = {"Accept": "application/vnd.github.antiope-preview+json"}
196197

197198
def _update_attributes(self, suite):
198199
# Import here, because a toplevel import causes an import loop
199200
from . import repos
200-
self._api = suite['url']
201-
self.status = suite['status']
202-
self.conclusion = suite['conclusion']
203-
self.head_branch = suite['head_branch']
204-
self.head_sha = suite['head_sha']
205-
self.before = suite['before']
206-
self.after = suite['after']
207-
prs = suite.get('pull_requests', [])
201+
202+
self._api = suite["url"]
203+
self.status = suite["status"]
204+
self.conclusion = suite["conclusion"]
205+
self.head_branch = suite["head_branch"]
206+
self.head_sha = suite["head_sha"]
207+
self.before = suite["before"]
208+
self.after = suite["after"]
209+
prs = suite.get("pull_requests", [])
208210
self.origional_pull_requests = [
209211
CheckPullRequest(p, self) for p in prs
210212
]
211-
self.repository = repos.ShortRepository(suite['repository'], self)
212-
self.id = suite['id']
213-
self.app = CheckApp(suite['app'], self)
213+
self.repository = repos.ShortRepository(suite["repository"], self)
214+
self.id = suite["id"]
215+
self.app = CheckApp(suite["app"], self)
214216

215217
def _repr(self):
216-
return '<{s.class_name} [{s.id}:{s.status}]>'.format(s=self)
218+
return "<{s.class_name} [{s.id}:{s.status}]>".format(s=self)
217219

218220
@decorators.requires_app_installation_auth
219221
def rerequest(self):
@@ -224,9 +226,10 @@ def rerequest(self):
224226
:rtype:
225227
bool
226228
"""
227-
url = self._build_url('rerequest', base_url=self._api)
228-
return self._boolean(self._post(
229-
url, headers=CheckSuite.CUSTOM_HEADERS), 201, 404)
229+
url = self._build_url("rerequest", base_url=self._api)
230+
return self._boolean(
231+
self._post(url, headers=CheckSuite.CUSTOM_HEADERS), 201, 404
232+
)
230233

231234
@decorators.requires_app_installation_auth
232235
def check_runs(self):
@@ -237,9 +240,10 @@ def check_runs(self):
237240
:rtype:
238241
:class:`~github3.checks.CheckRun`
239242
"""
240-
url = self._build_url('check-runs', base_url=self._api)
241-
return self._iter(-1, url, CheckRun,
242-
headers=CheckSuite.CUSTOM_HEADERS)
243+
url = self._build_url("check-runs", base_url=self._api)
244+
return self._iter(
245+
-1, url, CheckRun, headers=CheckSuite.CUSTOM_HEADERS
246+
)
243247

244248

245249
class CheckRun(models.GitHubCore):
@@ -317,38 +321,45 @@ class CheckRun(models.GitHubCore):
317321
http://developer.github.com/v3/checks/runs/
318322
"""
319323

320-
class_name = 'CheckRun'
321-
CUSTOM_HEADERS = {
322-
'Accept': 'application/vnd.github.antiope-preview+json'
323-
}
324+
class_name = "CheckRun"
325+
CUSTOM_HEADERS = {"Accept": "application/vnd.github.antiope-preview+json"}
324326

325327
def _update_attributes(self, run):
326-
self._api = run['url']
327-
self.html_url = run['html_url']
328-
self.status = run['status']
329-
self.conclusion = run['conclusion']
330-
self.started_at = self._strptime(run['started_at'])
331-
self.completed_at = self._strptime(run['completed_at'])
332-
self.head_sha = run['head_sha']
333-
self.name = run['name']
334-
prs = run.get('pull_requests', [])
328+
self._api = run["url"]
329+
self.html_url = run["html_url"]
330+
self.status = run["status"]
331+
self.conclusion = run["conclusion"]
332+
self.started_at = self._strptime(run["started_at"])
333+
self.completed_at = self._strptime(run["completed_at"])
334+
self.head_sha = run["head_sha"]
335+
self.name = run["name"]
336+
prs = run.get("pull_requests", [])
335337
self.origional_pull_requests = [
336338
CheckPullRequest(p, self) for p in prs
337339
]
338-
self.id = run['id']
339-
self.external_id = run['external_id']
340-
self.app = CheckApp(run['app'], self)
341-
self.check_suite = run['check_suite']['id']
340+
self.id = run["id"]
341+
self.external_id = run["external_id"]
342+
self.app = CheckApp(run["app"], self)
343+
self.check_suite = run["check_suite"]["id"]
342344
# self.output = CheckRunOutput(run['output'], self)
343-
self.output = run['output'] # TODO: turn into an object
345+
self.output = run["output"] # TODO: turn into an object
344346

345347
def _repr(self):
346-
return '<{s.class_name} [{s.name}:{s.status}]>'.format(s=self)
348+
return "<{s.class_name} [{s.name}:{s.status}]>".format(s=self)
347349

348350
@decorators.requires_app_installation_auth
349-
def update(self, name=None, details_url=None, external_id=None,
350-
started_at=None, status=None, conclusion=None,
351-
completed_at=None, output=None, actions=None):
351+
def update(
352+
self,
353+
name=None,
354+
details_url=None,
355+
external_id=None,
356+
started_at=None,
357+
status=None,
358+
conclusion=None,
359+
completed_at=None,
360+
output=None,
361+
actions=None,
362+
):
352363
"""Update this check run.
353364
354365
All parameters are optional.
@@ -385,17 +396,28 @@ def update(self, name=None, details_url=None, external_id=None,
385396
bool
386397
"""
387398
# TODO: Clean output dict, actions array. Need a deep recursive clean
388-
data = {'name': name, 'details_url': details_url, 'external_id':
389-
external_id, 'started_at': started_at, 'status': status,
390-
'conclusion': conclusion, 'completed_at': completed_at,
391-
'output': output, 'actions': actions}
399+
data = {
400+
"name": name,
401+
"details_url": details_url,
402+
"external_id": external_id,
403+
"started_at": started_at,
404+
"status": status,
405+
"conclusion": conclusion,
406+
"completed_at": completed_at,
407+
"output": output,
408+
"actions": actions,
409+
}
392410
self._remove_none(data)
393411
json = None
394412

395413
if data:
396-
json = self._json(self._patch(
397-
self._api, data=dumps(data),
398-
headers=CheckSuite.CUSTOM_HEADERS), 200
414+
json = self._json(
415+
self._patch(
416+
self._api,
417+
data=dumps(data),
418+
headers=CheckSuite.CUSTOM_HEADERS,
419+
),
420+
200,
399421
)
400422
if json:
401423
self._update_attributes(json)
@@ -411,6 +433,7 @@ def rerequest(self):
411433
:rtype:
412434
bool
413435
"""
414-
url = self._build_url('rerequest', base_url=self._api)
415-
return self._boolean(self._post(
416-
url, headers=CheckSuite.CUSTOM_HEADERS), 201, 404)
436+
url = self._build_url("rerequest", base_url=self._api)
437+
return self._boolean(
438+
self._post(url, headers=CheckSuite.CUSTOM_HEADERS), 201, 404
439+
)

src/github3/repos/commit.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ def check_runs(self):
4747
:rtype:
4848
:class:`~github3.checks.CheckRun`
4949
"""
50-
url = self._build_url('check-runs', base_url=self._api)
51-
return self._iter(-1, url, checks.CheckRun,
52-
headers=checks.CheckRun.CUSTOM_HEADERS)
50+
url = self._build_url("check-runs", base_url=self._api)
51+
return self._iter(
52+
-1, url, checks.CheckRun, headers=checks.CheckRun.CUSTOM_HEADERS
53+
)
5354

5455
@decorators.requires_app_installation_auth
5556
def check_suites(self):
@@ -62,9 +63,13 @@ def check_suites(self):
6263
:rtype:
6364
:class:`~github3.checks.CheckSuite`
6465
"""
65-
url = self._build_url('check-suites', base_url=self._api)
66-
return self._iter(-1, url, checks.CheckSuite,
67-
headers=checks.CheckSuite.CUSTOM_HEADERS)
66+
url = self._build_url("check-suites", base_url=self._api)
67+
return self._iter(
68+
-1,
69+
url,
70+
checks.CheckSuite,
71+
headers=checks.CheckSuite.CUSTOM_HEADERS,
72+
)
6873

6974
def diff(self):
7075
"""Retrieve the diff for this commit.

0 commit comments

Comments
 (0)