diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 588d5aea43..8f51c6197e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: stable + rev: 20.8b1 hooks: - id: black language_version: python3.6 diff --git a/github/AuthenticatedUser.py b/github/AuthenticatedUser.py index 35cbb22bb0..2bfdf80350 100644 --- a/github/AuthenticatedUser.py +++ b/github/AuthenticatedUser.py @@ -479,7 +479,10 @@ def create_authorization( else: request_header = None headers, data = self._requester.requestJsonAndCheck( - "POST", "/authorizations", input=post_parameters, headers=request_header, + "POST", + "/authorizations", + input=post_parameters, + headers=request_header, ) return github.Authorization.Authorization( self._requester, headers, data, completed=True diff --git a/github/Branch.py b/github/Branch.py index 095a423e82..298b40b329 100644 --- a/github/Branch.py +++ b/github/Branch.py @@ -163,7 +163,7 @@ def edit_protection( assert ( required_approving_review_count is github.GithubObject.NotSet or isinstance(required_approving_review_count, int) - ), required_approving_review_count + ), (required_approving_review_count) post_parameters = {} if ( @@ -250,7 +250,8 @@ def remove_protection(self): :calls: `DELETE /repos/:owner/:repo/branches/:branch/protection `_ """ headers, data = self._requester.requestJsonAndCheck( - "DELETE", self.protection_url, + "DELETE", + self.protection_url, ) def get_required_status_checks(self): @@ -342,7 +343,7 @@ def edit_required_pull_request_reviews( assert ( required_approving_review_count is github.GithubObject.NotSet or isinstance(required_approving_review_count, int) - ), required_approving_review_count + ), (required_approving_review_count) post_parameters = {} if dismissal_users is not github.GithubObject.NotSet: diff --git a/github/Deployment.py b/github/Deployment.py index 287a8f211a..a8fec06562 100644 --- a/github/Deployment.py +++ b/github/Deployment.py @@ -194,7 +194,9 @@ def create_status( if description is not github.GithubObject.NotSet: post_parameters["description"] = description headers, data = self._requester.requestJsonAndCheck( - "POST", self.url + "/statuses", input=post_parameters, + "POST", + self.url + "/statuses", + input=post_parameters, ) return github.DeploymentStatus.DeploymentStatus( self._requester, headers, data, completed=True diff --git a/github/Notification.py b/github/Notification.py index 8c4cb9b49a..6497d7078f 100644 --- a/github/Notification.py +++ b/github/Notification.py @@ -118,7 +118,10 @@ def mark_as_read(self): """ :calls: `PATCH /notifications/threads/:id `_ """ - headers, data = self._requester.requestJsonAndCheck("PATCH", self.url,) + headers, data = self._requester.requestJsonAndCheck( + "PATCH", + self.url, + ) def get_pull_request(self): """ diff --git a/github/ProjectCard.py b/github/ProjectCard.py index f09d191717..9e9109a945 100644 --- a/github/ProjectCard.py +++ b/github/ProjectCard.py @@ -168,7 +168,9 @@ def delete(self): :rtype: bool """ status, _, _ = self._requester.requestJson( - "DELETE", self.url, headers={"Accept": Consts.mediaTypeProjectsPreview}, + "DELETE", + self.url, + headers={"Accept": Consts.mediaTypeProjectsPreview}, ) return status == 204 diff --git a/github/ProjectColumn.py b/github/ProjectColumn.py index 33217eed21..024632dde4 100644 --- a/github/ProjectColumn.py +++ b/github/ProjectColumn.py @@ -170,7 +170,9 @@ def delete(self): :rtype: bool """ status, _, _ = self._requester.requestJson( - "DELETE", self.url, headers={"Accept": Consts.mediaTypeProjectsPreview}, + "DELETE", + self.url, + headers={"Accept": Consts.mediaTypeProjectsPreview}, ) return status == 204 diff --git a/github/PullRequest.py b/github/PullRequest.py index b5d12073be..1fd67c30d3 100644 --- a/github/PullRequest.py +++ b/github/PullRequest.py @@ -713,7 +713,8 @@ def get_review(self, id): """ assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( - "GET", self.url + "/reviews/" + str(id), + "GET", + self.url + "/reviews/" + str(id), ) return github.PullRequestReview.PullRequestReview( self._requester, headers, data, completed=True diff --git a/github/Repository.py b/github/Repository.py index 19b92394e4..17a46fa1a9 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -844,7 +844,8 @@ def get_collaborator_permission(self, collaborator): if isinstance(collaborator, github.NamedUser.NamedUser): collaborator = collaborator._identity headers, data = self._requester.requestJsonAndCheck( - "GET", self.url + "/collaborators/" + collaborator + "/permission", + "GET", + self.url + "/collaborators/" + collaborator + "/permission", ) return data["permission"] @@ -1876,7 +1877,9 @@ def create_deployment( if description is not github.GithubObject.NotSet: post_parameters["description"] = description headers, data = self._requester.requestJsonAndCheck( - "POST", self.url + "/deployments", input=post_parameters, + "POST", + self.url + "/deployments", + input=post_parameters, ) return github.Deployment.Deployment( self._requester, headers, data, completed=True @@ -2245,7 +2248,9 @@ def create_fork(self, organization=github.GithubObject.NotSet): if organization is not github.GithubObject.NotSet: post_parameters["organization"] = organization headers, data = self._requester.requestJsonAndCheck( - "POST", self.url + "/forks", input=post_parameters, + "POST", + self.url + "/forks", + input=post_parameters, ) return Repository(self._requester, headers, data, completed=True) @@ -2790,7 +2795,9 @@ def get_source_import(self): """ import_header = {"Accept": Consts.mediaTypeImportPreview} headers, data = self._requester.requestJsonAndCheck( - "GET", self.url + "/import", headers=import_header, + "GET", + self.url + "/import", + headers=import_header, ) if not data: return None diff --git a/github/Team.py b/github/Team.py index e57a7d4eba..8b75faf468 100644 --- a/github/Team.py +++ b/github/Team.py @@ -319,7 +319,10 @@ def get_teams(self): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Team.Team` """ return github.PaginatedList.PaginatedList( - github.Team.Team, self._requester, self.url + "/teams", None, + github.Team.Team, + self._requester, + self.url + "/teams", + None, ) def get_discussions(self): diff --git a/tests/Commit.py b/tests/Commit.py index 2feba6cdf0..779f4f2399 100644 --- a/tests/Commit.py +++ b/tests/Commit.py @@ -85,7 +85,8 @@ def testAttributes(self): self.commit.commit.tree.sha, "4c6bd50994f0f9823f898b1c6c964ad7d4fa11ab" ) self.assertEqual( - repr(self.commit), 'Commit(sha="1292bf0e22c796e91cc3d6e24b544aece8c21f2a")', + repr(self.commit), + 'Commit(sha="1292bf0e22c796e91cc3d6e24b544aece8c21f2a")', ) def testGetComments(self): diff --git a/tests/DeploymentStatus.py b/tests/DeploymentStatus.py index 9d92f3c56e..b6d722b80f 100644 --- a/tests/DeploymentStatus.py +++ b/tests/DeploymentStatus.py @@ -58,7 +58,8 @@ def testAttributes(self): "https://api.github.com/repos/colbygallup/PyGithub/deployments/242997115/statuses/344110026", ) self.assertEqual( - self.status.node_id, "MDE2OkRlcGxveW1lbnRTdGF0dXMzNDQxMTAwMjY=", + self.status.node_id, + "MDE2OkRlcGxveW1lbnRTdGF0dXMzNDQxMTAwMjY=", ) self.assertEqual( repr(self.status), diff --git a/tests/GitBlob.py b/tests/GitBlob.py index 03ff8f9618..fcd9aa8cd8 100644 --- a/tests/GitBlob.py +++ b/tests/GitBlob.py @@ -61,5 +61,6 @@ def testAttributes(self): "https://api.github.com/repos/jacquev6/PyGithub/git/blobs/53bce9fa919b4544e67275089b3ec5b44be20667", ) self.assertEqual( - repr(self.blob), 'GitBlob(sha="53bce9fa919b4544e67275089b3ec5b44be20667")', + repr(self.blob), + 'GitBlob(sha="53bce9fa919b4544e67275089b3ec5b44be20667")', ) diff --git a/tests/GitTree.py b/tests/GitTree.py index d46317a58a..b39bcb4b59 100644 --- a/tests/GitTree.py +++ b/tests/GitTree.py @@ -72,7 +72,8 @@ def testAttributes(self): ) self.assertEqual( - repr(self.tree), 'GitTree(sha="f492784d8ca837779650d1fb406a1a3587a764ad")', + repr(self.tree), + 'GitTree(sha="f492784d8ca837779650d1fb406a1a3587a764ad")', ) self.assertEqual( repr(self.tree.tree[0]), diff --git a/tests/GithubApp.py b/tests/GithubApp.py index ea9ab6b366..4eb8865331 100644 --- a/tests/GithubApp.py +++ b/tests/GithubApp.py @@ -110,7 +110,8 @@ def testGetAuthenticatedApp(self): self.assertEqual(app.created_at, datetime(2020, 8, 1, 17, 23, 46)) self.assertEqual(app.description, "Sample App to test PyGithub") self.assertListEqual( - app.events, ["check_run", "check_suite", "label", "member", "public"], + app.events, + ["check_run", "check_suite", "label", "member", "public"], ) self.assertEqual(app.external_url, "https://pygithub.readthedocs.io") self.assertEqual(app.html_url, "https://github.com/apps/pygithubtest") diff --git a/tests/GithubIntegration.py b/tests/GithubIntegration.py index 8f9b426995..3d941d1d2a 100644 --- a/tests/GithubIntegration.py +++ b/tests/GithubIntegration.py @@ -135,7 +135,10 @@ def testCreateJWT(self): integration = GithubIntegration(25216, private_key) token = integration.create_jwt() payload = jwt.decode( - token, key=public_key, algorithms=["RS256"], options={"verify_exp": False}, + token, + key=public_key, + algorithms=["RS256"], + options={"verify_exp": False}, ) self.assertDictEqual( payload, {"iat": 1550055331, "exp": 1550055391, "iss": 25216} diff --git a/tests/NamedUser1430.py b/tests/NamedUser1430.py index 33f8e833aa..a265d9df29 100644 --- a/tests/NamedUser1430.py +++ b/tests/NamedUser1430.py @@ -32,5 +32,7 @@ def setUp(self): def testGetProjects(self): self.assertListKeyBegin( - self.user.get_projects(state="all"), lambda e: e.id, [4083095], + self.user.get_projects(state="all"), + lambda e: e.id, + [4083095], ) diff --git a/tests/Organization.py b/tests/Organization.py index 418d530c30..47c33265f5 100644 --- a/tests/Organization.py +++ b/tests/Organization.py @@ -239,10 +239,14 @@ def testGetRepos(self): def testGetReposSorted(self): repos = self.org.get_repos(sort="updated", direction="desc") self.assertListKeyEqual( - repos, lambda r: r.name, ["TestPyGithub", "FatherBeaver"], + repos, + lambda r: r.name, + ["TestPyGithub", "FatherBeaver"], ) self.assertListKeyEqual( - repos, lambda r: r.has_pages, [False, True], + repos, + lambda r: r.has_pages, + [False, True], ) def testGetReposWithType(self): diff --git a/tests/Project.py b/tests/Project.py index c76bca7499..fcc64dc78e 100644 --- a/tests/Project.py +++ b/tests/Project.py @@ -171,14 +171,18 @@ def testCreateColumn(self): project = self.repo.create_project( "Project created by PyGithub", "Project Body" ) - column = project.create_column("Project Column created by PyGithub",) + column = project.create_column( + "Project Column created by PyGithub", + ) self.assertEqual(column.id, 3999333) def testCreateCardWithNote(self): project = self.repo.create_project( "Project created by PyGithub", "Project Body" ) - column = project.create_column("Project Column created by PyGithub",) + column = project.create_column( + "Project Column created by PyGithub", + ) card1 = column.create_card(note="Project Card") self.assertEqual(card1.id, 16039019) @@ -186,7 +190,9 @@ def testCreateCardFromIssue(self): project = self.repo.create_project( "Project created by PyGithub", "Project Body" ) - column = project.create_column("Project Column created by PyGithub",) + column = project.create_column( + "Project Column created by PyGithub", + ) issue = self.repo.create_issue(title="Issue created by PyGithub") card2 = column.create_card(content_id=issue.id, content_type="Issue") self.assertEqual(card2.id, 16039106) diff --git a/tests/PullRequest.py b/tests/PullRequest.py index e5eb803901..b1bd12ebe7 100644 --- a/tests/PullRequest.py +++ b/tests/PullRequest.py @@ -139,7 +139,8 @@ def testAttributes(self): self.assertEqual(self.pull.draft, None) self.assertEqual(self.pull.maintainer_can_modify, None) self.assertEqual( - repr(self.pull), 'PullRequest(title="Title edited by PyGithub", number=31)', + repr(self.pull), + 'PullRequest(title="Title edited by PyGithub", number=31)', ) self.assertEqual( repr(self.pull.base), diff --git a/tests/Repository.py b/tests/Repository.py index 14fb4740a5..876b9cd666 100644 --- a/tests/Repository.py +++ b/tests/Repository.py @@ -300,7 +300,14 @@ def testCreateGitTreeWithSha(self): def testCreateGitTreeWithNullSha(self): tree = self.repo.create_git_tree( - [github.InputGitTreeElement("Baz.bar", "100644", "blob", sha=None,)] + [ + github.InputGitTreeElement( + "Baz.bar", + "100644", + "blob", + sha=None, + ) + ] ) self.assertEqual(tree.sha, "9b8166fc80d0f0fe9192d4bf1dbaa87f194e012f") diff --git a/tests/UserKey.py b/tests/UserKey.py index 6fc6752d28..cce0e00c10 100644 --- a/tests/UserKey.py +++ b/tests/UserKey.py @@ -47,7 +47,8 @@ def testAttributes(self): self.assertEqual(self.key.url, "https://api.github.com/user/keys/2626650") self.assertTrue(self.key.verified) self.assertEqual( - repr(self.key), 'UserKey(title="Key added through PyGithub", id=2626650)', + repr(self.key), + 'UserKey(title="Key added through PyGithub", id=2626650)', ) def testDelete(self):