From b5415773b8738e407d34783f08e4dbc6f687bc3a Mon Sep 17 00:00:00 2001 From: jmeridth Date: Thu, 21 Mar 2024 04:20:18 -0500 Subject: [PATCH 1/5] chore: switch to isort from reorder python imports - [x] keep it simple with just `--profile black` argument - [x] update pull_request_template when asking for python-dateutil version - some engineers don't know to prefix `dateutil` with `python-` This is a premptive strike on #1172 fix Signed-off-by: jmeridth --- .github/pull_request_template.md | 2 +- .pre-commit-config.yaml | 8 +-- pyproject.toml | 3 + src/github3/__init__.py | 26 ++++----- src/github3/api.py | 3 +- src/github3/apps.py | 3 +- src/github3/checks.py | 3 +- src/github3/gists/__init__.py | 3 +- src/github3/gists/comment.py | 4 +- src/github3/gists/gist.py | 5 +- src/github3/gists/history.py | 3 +- src/github3/github.py | 44 +++++++-------- src/github3/issues/__init__.py | 3 +- src/github3/issues/comment.py | 5 +- src/github3/issues/issue.py | 8 +-- src/github3/issues/milestone.py | 2 +- src/github3/models.py | 4 +- src/github3/orgs.py | 6 +- src/github3/projects.py | 5 +- src/github3/pulls.py | 3 +- src/github3/repos/__init__.py | 4 +- src/github3/repos/branch.py | 5 +- src/github3/repos/comment.py | 3 +- src/github3/repos/commit.py | 5 +- src/github3/repos/comparison.py | 2 +- src/github3/repos/contents.py | 3 +- src/github3/repos/invitation.py | 3 +- src/github3/repos/release.py | 4 +- src/github3/repos/repo.py | 65 +++++++++++----------- src/github3/repos/stats.py | 3 +- src/github3/repos/status.py | 3 +- src/github3/repos/tag.py | 2 +- src/github3/search/__init__.py | 1 - src/github3/search/code.py | 3 +- src/github3/search/commit.py | 5 +- src/github3/search/repository.py | 3 +- src/github3/structs.py | 6 +- src/github3/users.py | 3 +- tests/integration/test_api.py | 1 + tests/integration/test_auths.py | 1 + tests/integration/test_checks.py | 1 + tests/integration/test_gists.py | 1 + tests/integration/test_git.py | 1 + tests/integration/test_github.py | 4 +- tests/integration/test_issue.py | 1 + tests/integration/test_issues_milestone.py | 1 + tests/integration/test_notifications.py | 1 + tests/integration/test_orgs.py | 1 + tests/integration/test_orgs_team.py | 1 + tests/integration/test_projects.py | 1 + tests/integration/test_pulls.py | 3 +- tests/integration/test_repos_commit.py | 1 + tests/integration/test_repos_deployment.py | 1 + tests/integration/test_repos_invitation.py | 1 + tests/integration/test_repos_pages.py | 1 + tests/integration/test_repos_release.py | 1 + tests/integration/test_repos_repo.py | 1 + tests/integration/test_session.py | 1 + tests/integration/test_structs.py | 1 + tests/integration/test_users.py | 3 +- tests/unit/test_auths.py | 1 + tests/unit/test_checks.py | 18 +++--- tests/unit/test_events.py | 4 +- tests/unit/test_gists.py | 1 + tests/unit/test_git.py | 5 +- tests/unit/test_github.py | 6 +- tests/unit/test_github_enterprise.py | 4 +- tests/unit/test_github_session.py | 1 - tests/unit/test_issues_issue.py | 3 +- tests/unit/test_issues_milestone.py | 1 + tests/unit/test_licenses.py | 5 +- tests/unit/test_models.py | 9 ++- tests/unit/test_notifications.py | 5 +- tests/unit/test_orgs.py | 6 +- tests/unit/test_orgs_team.py | 3 +- tests/unit/test_projects.py | 7 +-- tests/unit/test_pulls.py | 4 +- tests/unit/test_repos_branch.py | 1 + tests/unit/test_repos_branch_protection.py | 1 + tests/unit/test_repos_commit.py | 1 + tests/unit/test_repos_deployment.py | 5 +- tests/unit/test_repos_invitation.py | 1 + tests/unit/test_repos_release.py | 14 +++-- tests/unit/test_repos_repo.py | 6 +- tests/unit/test_repos_status.py | 4 +- tests/unit/test_structs.py | 3 +- tests/unit/test_subscription.py | 5 +- tests/unit/test_users.py | 1 + tests/unit/test_utils.py | 3 +- tox.ini | 3 + 90 files changed, 207 insertions(+), 219 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index d6a6675ff..a324494a9 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -12,7 +12,7 @@ Please provide: - The version of pip you used to install github3.py -- The version of github3.py, requests, uritemplate, and dateutil installed +- The version of github3.py, requests, uritemplate, and python-dateutil installed ## Minimum Reproducible Example diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 79425fd3a..dd82b3cf7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,11 +13,11 @@ repos: - id: trailing-whitespace types: [text] stages: [commit, push, manual] - - repo: https://github.com/asottile/reorder-python-imports - rev: v3.12.0 + - repo: https://github.com/PyCQA/isort + rev: 5.13.2 hooks: - - id: reorder-python-imports - args: [--application-directories, '.:src', --py37-plus] + - id: isort + args: [--profile, black] - repo: https://github.com/psf/black rev: 23.12.1 hooks: diff --git a/pyproject.toml b/pyproject.toml index c6cdb1835..40d99b0f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -93,3 +93,6 @@ exclude = [ "^docs/", "^tests/", ] + +[tool.isort] +profile = "black" diff --git a/src/github3/__init__.py b/src/github3/__init__.py index 78ff6a96f..dec7284a6 100644 --- a/src/github3/__init__.py +++ b/src/github3/__init__.py @@ -8,20 +8,20 @@ :license: Modified BSD, see LICENSE for more details """ -from .__about__ import __author__ -from .__about__ import __author_email__ -from .__about__ import __copyright__ -from .__about__ import __license__ -from .__about__ import __package_name__ -from .__about__ import __title__ -from .__about__ import __url__ -from .__about__ import __version__ -from .__about__ import __version_info__ -from .api import enterprise_login -from .api import login +from .__about__ import ( + __author__, + __author_email__, + __copyright__, + __license__, + __package_name__, + __title__, + __url__, + __version__, + __version_info__, +) +from .api import enterprise_login, login from .exceptions import GitHubError -from .github import GitHub -from .github import GitHubEnterprise +from .github import GitHub, GitHubEnterprise __all__ = ( "GitHub", diff --git a/src/github3/api.py b/src/github3/api.py index 624da092c..e1134cf64 100644 --- a/src/github3/api.py +++ b/src/github3/api.py @@ -6,8 +6,7 @@ :license: Modified BSD, see LICENSE for more details """ -from .github import GitHub -from .github import GitHubEnterprise +from .github import GitHub, GitHubEnterprise gh = GitHub() diff --git a/src/github3/apps.py b/src/github3/apps.py index a1cd6f08c..18a8a0f52 100644 --- a/src/github3/apps.py +++ b/src/github3/apps.py @@ -6,8 +6,7 @@ import jwt -from . import models -from . import users +from . import models, users TEN_MINUTES_AS_SECONDS = 10 * 60 DEFAULT_JWT_TOKEN_EXPIRATION = TEN_MINUTES_AS_SECONDS diff --git a/src/github3/checks.py b/src/github3/checks.py index f6974beb0..872c770c5 100644 --- a/src/github3/checks.py +++ b/src/github3/checks.py @@ -1,8 +1,7 @@ """This module contains all the classes relating to Checks.""" from json import dumps -from . import decorators -from . import models +from . import decorators, models class CheckPullRequest(models.GitHubCore): diff --git a/src/github3/gists/__init__.py b/src/github3/gists/__init__.py index 73b64fd35..d550bcce9 100644 --- a/src/github3/gists/__init__.py +++ b/src/github3/gists/__init__.py @@ -12,7 +12,6 @@ See also: http://developer.github.com/v3/gists/ """ -from .gist import Gist -from .gist import ShortGist +from .gist import Gist, ShortGist __all__ = ("Gist", "ShortGist") diff --git a/src/github3/gists/comment.py b/src/github3/gists/comment.py index c0d1a3907..a9d8c3426 100644 --- a/src/github3/gists/comment.py +++ b/src/github3/gists/comment.py @@ -1,7 +1,5 @@ """Module containing the logic for a GistComment.""" -from .. import decorators -from .. import models -from .. import users +from .. import decorators, models, users class GistComment(models.GitHubCore): diff --git a/src/github3/gists/gist.py b/src/github3/gists/gist.py index 740277f64..93eebd8e7 100644 --- a/src/github3/gists/gist.py +++ b/src/github3/gists/gist.py @@ -2,12 +2,11 @@ import typing as t from json import dumps +from .. import models, users +from ..decorators import requires_auth from . import comment from . import file as gistfile from . import history -from .. import models -from .. import users -from ..decorators import requires_auth class _Gist(models.GitHubCore): diff --git a/src/github3/gists/history.py b/src/github3/gists/history.py index 61a81a69c..98e22a786 100644 --- a/src/github3/gists/history.py +++ b/src/github3/gists/history.py @@ -1,6 +1,5 @@ """Module containing the GistHistory object.""" -from .. import models -from .. import users +from .. import models, users class GistHistory(models.GitHubCore): diff --git a/src/github3/github.py b/src/github3/github.py index c759b021c..d092a9a27 100644 --- a/src/github3/github.py +++ b/src/github3/github.py @@ -5,29 +5,27 @@ import uritemplate # type: ignore -from . import apps -from . import auths -from . import decorators -from . import events -from . import gists -from . import issues -from . import licenses -from . import models -from . import notifications -from . import orgs -from . import projects -from . import pulls -from . import search -from . import session -from . import structs -from . import users -from . import utils -from .decorators import requires_app_credentials -from .decorators import requires_auth -from .decorators import requires_basic_auth -from .repos import invitation -from .repos import repo - +from . import ( + apps, + auths, + decorators, + events, + gists, + issues, + licenses, + models, + notifications, + orgs, + projects, + pulls, + search, + session, + structs, + users, + utils, +) +from .decorators import requires_app_credentials, requires_auth, requires_basic_auth +from .repos import invitation, repo _pubsub_re = re.compile( r"https?://[\w\d\-\.\:]+/\w[\w-]+\w/[\w\._-]+/events/\w+" diff --git a/src/github3/issues/__init__.py b/src/github3/issues/__init__.py index a58f86e6a..116b36a5c 100644 --- a/src/github3/issues/__init__.py +++ b/src/github3/issues/__init__.py @@ -7,8 +7,7 @@ See also: http://developer.github.com/v3/issues/ """ from ..utils import timestamp_parameter -from .issue import Issue -from .issue import ShortIssue +from .issue import Issue, ShortIssue __all__ = ["Issue", "ShortIssue"] diff --git a/src/github3/issues/comment.py b/src/github3/issues/comment.py index 149dc815f..53249d3ef 100644 --- a/src/github3/issues/comment.py +++ b/src/github3/issues/comment.py @@ -1,8 +1,5 @@ """Module with class(es) representing issue comments.""" -from .. import decorators -from .. import models -from .. import users -from .. import utils +from .. import decorators, models, users, utils class IssueComment(models.GitHubCore): diff --git a/src/github3/issues/issue.py b/src/github3/issues/issue.py index ef96d9f39..30b17d093 100644 --- a/src/github3/issues/issue.py +++ b/src/github3/issues/issue.py @@ -3,13 +3,9 @@ from uritemplate import URITemplate # type: ignore -from . import comment -from . import event -from . import label -from . import milestone -from .. import models -from .. import users +from .. import models, users from ..decorators import requires_auth +from . import comment, event, label, milestone class _Issue(models.GitHubCore): diff --git a/src/github3/issues/milestone.py b/src/github3/issues/milestone.py index f13fde365..76d9d9a90 100644 --- a/src/github3/issues/milestone.py +++ b/src/github3/issues/milestone.py @@ -1,9 +1,9 @@ from json import dumps -from . import label from .. import users from ..decorators import requires_auth from ..models import GitHubCore +from . import label class Milestone(GitHubCore): diff --git a/src/github3/models.py b/src/github3/models.py index fc4635eea..2ca79b1e3 100644 --- a/src/github3/models.py +++ b/src/github3/models.py @@ -6,9 +6,7 @@ import dateutil.parser import requests.compat -from . import exceptions -from . import session - +from . import exceptions, session if t.TYPE_CHECKING: from . import structs diff --git a/src/github3/orgs.py b/src/github3/orgs.py index 96fcc8390..40504f6cb 100644 --- a/src/github3/orgs.py +++ b/src/github3/orgs.py @@ -4,13 +4,11 @@ from uritemplate import URITemplate # type: ignore -from . import models -from . import users +from . import models, users from .decorators import requires_auth from .events import Event from .projects import Project -from .repos import Repository -from .repos import ShortRepository +from .repos import Repository, ShortRepository if t.TYPE_CHECKING: from . import users as _users diff --git a/src/github3/projects.py b/src/github3/projects.py index 0275fde97..022212618 100644 --- a/src/github3/projects.py +++ b/src/github3/projects.py @@ -1,10 +1,7 @@ """This module contains all the classes relating to projects.""" from json import dumps -from . import exceptions -from . import models -from . import pulls -from . import users +from . import exceptions, models, pulls, users from .decorators import requires_auth from .issues import issue diff --git a/src/github3/pulls.py b/src/github3/pulls.py index 8c6f91d54..cc537036e 100644 --- a/src/github3/pulls.py +++ b/src/github3/pulls.py @@ -3,8 +3,7 @@ from uritemplate import URITemplate # type: ignore -from . import models -from . import users +from . import models, users from .decorators import requires_auth from .issues import Issue from .issues.comment import IssueComment diff --git a/src/github3/repos/__init__.py b/src/github3/repos/__init__.py index c453e6bae..d2f6bcd9c 100644 --- a/src/github3/repos/__init__.py +++ b/src/github3/repos/__init__.py @@ -6,8 +6,6 @@ See also: http://developer.github.com/v3/repos/ """ -from .repo import Repository -from .repo import ShortRepository -from .repo import StarredRepository +from .repo import Repository, ShortRepository, StarredRepository __all__ = ("Repository", "ShortRepository", "StarredRepository") diff --git a/src/github3/repos/branch.py b/src/github3/repos/branch.py index e0668fc78..096f77cf6 100644 --- a/src/github3/repos/branch.py +++ b/src/github3/repos/branch.py @@ -1,14 +1,13 @@ """Implementation of a branch on a repository.""" import typing as t +from .. import decorators, models from . import commit -from .. import decorators -from .. import models if t.TYPE_CHECKING: from .. import apps as tapps - from .. import users as tusers from .. import orgs + from .. import users as tusers class _Branch(models.GitHubCore): diff --git a/src/github3/repos/comment.py b/src/github3/repos/comment.py index d03799262..e176d6203 100644 --- a/src/github3/repos/comment.py +++ b/src/github3/repos/comment.py @@ -1,6 +1,5 @@ """This module contains the RepoComment class.""" -from .. import models -from .. import users +from .. import models, users from ..decorators import requires_auth diff --git a/src/github3/repos/commit.py b/src/github3/repos/commit.py index ba79092e8..dc58838b4 100644 --- a/src/github3/repos/commit.py +++ b/src/github3/repos/commit.py @@ -1,9 +1,6 @@ """This module contains the RepoCommit classes.""" +from .. import checks, git, models, users from . import status -from .. import checks -from .. import git -from .. import models -from .. import users from .comment import RepoComment diff --git a/src/github3/repos/comparison.py b/src/github3/repos/comparison.py index 0406c4ea9..7552f5be3 100644 --- a/src/github3/repos/comparison.py +++ b/src/github3/repos/comparison.py @@ -1,6 +1,6 @@ """This module contains the Comparison object.""" -from . import commit from .. import models +from . import commit class Comparison(models.GitHubCore): diff --git a/src/github3/repos/contents.py b/src/github3/repos/contents.py index 4ebaa42d5..6381d03ed 100644 --- a/src/github3/repos/contents.py +++ b/src/github3/repos/contents.py @@ -1,6 +1,5 @@ """This module contains the Contents object.""" -from base64 import b64decode -from base64 import b64encode +from base64 import b64decode, b64encode from json import dumps from .. import models diff --git a/src/github3/repos/invitation.py b/src/github3/repos/invitation.py index 3ea646115..324ae5b04 100644 --- a/src/github3/repos/invitation.py +++ b/src/github3/repos/invitation.py @@ -1,8 +1,7 @@ """Invitation related logic.""" from json import dumps -from .. import models -from .. import users +from .. import models, users from ..decorators import requires_auth diff --git a/src/github3/repos/release.py b/src/github3/repos/release.py index c731052c7..e488c8307 100644 --- a/src/github3/repos/release.py +++ b/src/github3/repos/release.py @@ -3,9 +3,7 @@ from uritemplate import URITemplate # type: ignore -from .. import models -from .. import users -from .. import utils +from .. import models, users, utils from ..decorators import requires_auth from ..exceptions import error_for diff --git a/src/github3/repos/repo.py b/src/github3/repos/repo.py index 12fa01cbd..61aedd845 100644 --- a/src/github3/repos/repo.py +++ b/src/github3/repos/repo.py @@ -9,38 +9,41 @@ import uritemplate as urit # type: ignore -from . import branch -from . import comment -from . import commit -from . import comparison -from . import contents -from . import deployment -from . import hook -from . import invitation -from . import issue_import -from . import pages -from . import release -from . import stats -from . import status -from . import tag -from . import topics -from . import traffic -from .. import checks -from .. import decorators -from .. import events -from .. import exceptions -from .. import git -from .. import issues -from .. import licenses -from .. import models -from .. import notifications -from .. import projects -from .. import pulls -from .. import users -from .. import utils +from .. import ( + checks, + decorators, + events, + exceptions, + git, + issues, + licenses, + models, + notifications, + projects, + pulls, + users, + utils, +) from ..issues import event as ievent -from ..issues import label -from ..issues import milestone +from ..issues import label, milestone +from . import ( + branch, + comment, + commit, + comparison, + contents, + deployment, + hook, + invitation, + issue_import, + pages, + release, + stats, + status, + tag, + topics, + traffic, +) class _Repository(models.GitHubCore): diff --git a/src/github3/repos/stats.py b/src/github3/repos/stats.py index 588c24847..7d473d445 100644 --- a/src/github3/repos/stats.py +++ b/src/github3/repos/stats.py @@ -3,8 +3,7 @@ import dateutil.tz -from .. import models -from .. import users +from .. import models, users def alternate_week(week): diff --git a/src/github3/repos/status.py b/src/github3/repos/status.py index ae39019d9..945657eb1 100644 --- a/src/github3/repos/status.py +++ b/src/github3/repos/status.py @@ -1,6 +1,5 @@ """This module contains the Status object for GitHub's commit status API.""" -from .. import models -from .. import users +from .. import models, users from ..models import GitHubCore diff --git a/src/github3/repos/tag.py b/src/github3/repos/tag.py index 9f093bbf7..d0feec098 100644 --- a/src/github3/repos/tag.py +++ b/src/github3/repos/tag.py @@ -1,6 +1,6 @@ """This module contains the RepoTag object for GitHub's tag API.""" -from . import commit from .. import models +from . import commit class RepoTag(models.GitHubCore): diff --git a/src/github3/search/__init__.py b/src/github3/search/__init__.py index 6fe99b61f..33531d52e 100644 --- a/src/github3/search/__init__.py +++ b/src/github3/search/__init__.py @@ -4,7 +4,6 @@ from .repository import RepositorySearchResult from .user import UserSearchResult - __all__ = ( "CodeSearchResult", "CommitSearchResult", diff --git a/src/github3/search/code.py b/src/github3/search/code.py index e60eb4bd4..2bfc1f31f 100644 --- a/src/github3/search/code.py +++ b/src/github3/search/code.py @@ -1,6 +1,5 @@ """Code search results implementation.""" -from .. import models -from .. import repos +from .. import models, repos class CodeSearchResult(models.GitHubCore): diff --git a/src/github3/search/commit.py b/src/github3/search/commit.py index c80adf6ee..cc4a8bcd0 100644 --- a/src/github3/search/commit.py +++ b/src/github3/search/commit.py @@ -1,8 +1,5 @@ """Commit search results implementation.""" -from .. import git -from .. import models -from .. import repos -from .. import users +from .. import git, models, repos, users class CommitSearchResult(models.GitHubCore): diff --git a/src/github3/search/repository.py b/src/github3/search/repository.py index e2711da63..f57ce8d8c 100644 --- a/src/github3/search/repository.py +++ b/src/github3/search/repository.py @@ -1,6 +1,5 @@ """Repository search results implementation.""" -from .. import models -from .. import repos +from .. import models, repos class RepositorySearchResult(models.GitHubCore): diff --git a/src/github3/structs.py b/src/github3/structs.py index 362844d79..a415bd811 100644 --- a/src/github3/structs.py +++ b/src/github3/structs.py @@ -2,11 +2,9 @@ import functools import typing as t -from requests.compat import urlencode -from requests.compat import urlparse +from requests.compat import urlencode, urlparse -from . import exceptions -from . import models +from . import exceptions, models if t.TYPE_CHECKING: import requests.models diff --git a/src/github3/users.py b/src/github3/users.py index dc47fcb6f..cb8894c7d 100644 --- a/src/github3/users.py +++ b/src/github3/users.py @@ -4,10 +4,11 @@ from uritemplate import URITemplate # type: ignore +from github3.auths import Authorization + from . import models from .decorators import requires_auth from .events import Event -from github3.auths import Authorization class GPGKey(models.GitHubCore): diff --git a/tests/integration/test_api.py b/tests/integration/test_api.py index 76e04d83a..26b117dec 100644 --- a/tests/integration/test_api.py +++ b/tests/integration/test_api.py @@ -1,4 +1,5 @@ import github3 + from .helper import IntegrationHelper diff --git a/tests/integration/test_auths.py b/tests/integration/test_auths.py index ed0b52fb3..c9edff5ac 100644 --- a/tests/integration/test_auths.py +++ b/tests/integration/test_auths.py @@ -1,5 +1,6 @@ """Integration tests for the github3.auths module.""" import github3 + from .helper import IntegrationHelper diff --git a/tests/integration/test_checks.py b/tests/integration/test_checks.py index 0b211d30a..6043d78bd 100644 --- a/tests/integration/test_checks.py +++ b/tests/integration/test_checks.py @@ -5,6 +5,7 @@ import pytest import github3 + from .helper import IntegrationHelper diff --git a/tests/integration/test_gists.py b/tests/integration/test_gists.py index 2e76cc6d4..4ddeba6d2 100644 --- a/tests/integration/test_gists.py +++ b/tests/integration/test_gists.py @@ -1,5 +1,6 @@ """Integration tests for methods implemented on Gist.""" import github3 + from .helper import IntegrationHelper diff --git a/tests/integration/test_git.py b/tests/integration/test_git.py index 95084e3d6..4a9cacda0 100644 --- a/tests/integration/test_git.py +++ b/tests/integration/test_git.py @@ -1,5 +1,6 @@ """Integration tests for Git.""" import github3 + from .helper import IntegrationHelper diff --git a/tests/integration/test_github.py b/tests/integration/test_github.py index 443576d64..d280f6094 100644 --- a/tests/integration/test_github.py +++ b/tests/integration/test_github.py @@ -5,8 +5,8 @@ import uritemplate import github3 -from .helper import GitHubEnterpriseHelper -from .helper import IntegrationHelper + +from .helper import GitHubEnterpriseHelper, IntegrationHelper GPG_KEY = ( # Generated for this alone then deleted diff --git a/tests/integration/test_issue.py b/tests/integration/test_issue.py index fe4166101..82b881834 100644 --- a/tests/integration/test_issue.py +++ b/tests/integration/test_issue.py @@ -3,6 +3,7 @@ import github3 import github3.exceptions as exc + from .helper import IntegrationHelper diff --git a/tests/integration/test_issues_milestone.py b/tests/integration/test_issues_milestone.py index b3790ea10..fd29dcb43 100644 --- a/tests/integration/test_issues_milestone.py +++ b/tests/integration/test_issues_milestone.py @@ -1,4 +1,5 @@ import github3 + from .helper import IntegrationHelper diff --git a/tests/integration/test_notifications.py b/tests/integration/test_notifications.py index a942db0d3..a093da6ac 100644 --- a/tests/integration/test_notifications.py +++ b/tests/integration/test_notifications.py @@ -1,5 +1,6 @@ """Integration test for Notifications.""" import github3 + from .helper import IntegrationHelper diff --git a/tests/integration/test_orgs.py b/tests/integration/test_orgs.py index 06a3852ca..293f6a274 100644 --- a/tests/integration/test_orgs.py +++ b/tests/integration/test_orgs.py @@ -2,6 +2,7 @@ import pytest import github3 + from .helper import IntegrationHelper diff --git a/tests/integration/test_orgs_team.py b/tests/integration/test_orgs_team.py index abc45ecad..08ed6b375 100644 --- a/tests/integration/test_orgs_team.py +++ b/tests/integration/test_orgs_team.py @@ -1,5 +1,6 @@ """Integration tests for methods implemented on Team.""" import github3 + from .helper import IntegrationHelper diff --git a/tests/integration/test_projects.py b/tests/integration/test_projects.py index db65f1faf..b280f4b87 100644 --- a/tests/integration/test_projects.py +++ b/tests/integration/test_projects.py @@ -1,5 +1,6 @@ """Integration tests for methods implemented on Project.""" import github3 + from .helper import IntegrationHelper diff --git a/tests/integration/test_pulls.py b/tests/integration/test_pulls.py index d8f393de8..079cdda52 100644 --- a/tests/integration/test_pulls.py +++ b/tests/integration/test_pulls.py @@ -1,8 +1,9 @@ """Integration tests for methods implemented on PullRequest.""" import github3 -from .helper import IntegrationHelper from github3 import repos +from .helper import IntegrationHelper + class TestPullRequest(IntegrationHelper): """PullRequest integration tests.""" diff --git a/tests/integration/test_repos_commit.py b/tests/integration/test_repos_commit.py index de0e9ddea..e95bc6483 100644 --- a/tests/integration/test_repos_commit.py +++ b/tests/integration/test_repos_commit.py @@ -1,5 +1,6 @@ """Integration tests for Repository Commit objects.""" import github3 + from . import helper diff --git a/tests/integration/test_repos_deployment.py b/tests/integration/test_repos_deployment.py index bcb0af7d2..e770927d3 100644 --- a/tests/integration/test_repos_deployment.py +++ b/tests/integration/test_repos_deployment.py @@ -1,5 +1,6 @@ """Deployment integration tests.""" import github3 + from .helper import IntegrationHelper diff --git a/tests/integration/test_repos_invitation.py b/tests/integration/test_repos_invitation.py index c90a4e1b7..224f10161 100644 --- a/tests/integration/test_repos_invitation.py +++ b/tests/integration/test_repos_invitation.py @@ -1,5 +1,6 @@ """Integration tests for Repository Invitation objects.""" import github3 + from . import helper diff --git a/tests/integration/test_repos_pages.py b/tests/integration/test_repos_pages.py index 25cd345af..b9cc668f6 100644 --- a/tests/integration/test_repos_pages.py +++ b/tests/integration/test_repos_pages.py @@ -1,4 +1,5 @@ import github3 + from .helper import IntegrationHelper diff --git a/tests/integration/test_repos_release.py b/tests/integration/test_repos_release.py index 88e6f27c1..b49a1bbcb 100644 --- a/tests/integration/test_repos_release.py +++ b/tests/integration/test_repos_release.py @@ -4,6 +4,7 @@ import pytest import github3 + from .helper import IntegrationHelper diff --git a/tests/integration/test_repos_repo.py b/tests/integration/test_repos_repo.py index b392db67b..b141eadeb 100644 --- a/tests/integration/test_repos_repo.py +++ b/tests/integration/test_repos_repo.py @@ -6,6 +6,7 @@ import github3 import github3.exceptions as exc + from . import helper diff --git a/tests/integration/test_session.py b/tests/integration/test_session.py index e2fd06383..2cf16a282 100644 --- a/tests/integration/test_session.py +++ b/tests/integration/test_session.py @@ -1,4 +1,5 @@ import github3 + from .helper import IntegrationHelper diff --git a/tests/integration/test_structs.py b/tests/integration/test_structs.py index 020ec8270..933c3987a 100644 --- a/tests/integration/test_structs.py +++ b/tests/integration/test_structs.py @@ -1,6 +1,7 @@ import pytest import github3 + from .helper import IntegrationHelper diff --git a/tests/integration/test_users.py b/tests/integration/test_users.py index ab7ffea10..b9f25cf68 100644 --- a/tests/integration/test_users.py +++ b/tests/integration/test_users.py @@ -4,9 +4,10 @@ import pytest import github3 -from .helper import IntegrationHelper from github3.exceptions import MethodNotAllowed +from .helper import IntegrationHelper + GPG_KEY = ( # Generated for this alone then deleted "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" diff --git a/tests/unit/test_auths.py b/tests/unit/test_auths.py index 38836a8e0..528cc1754 100644 --- a/tests/unit/test_auths.py +++ b/tests/unit/test_auths.py @@ -1,5 +1,6 @@ """Unit tests for the auths module.""" import github3 + from . import helper url_for = helper.create_url_helper("https://api.github.com/authorizations/1") diff --git a/tests/unit/test_checks.py b/tests/unit/test_checks.py index b5931f709..debbc42a3 100644 --- a/tests/unit/test_checks.py +++ b/tests/unit/test_checks.py @@ -4,16 +4,18 @@ import pytest import github3 -from .helper import create_example_data_helper -from .helper import create_url_helper -from .helper import UnitAppInstallHelper -from .helper import UnitHelper -from .helper import UnitIteratorHelper -from .helper import UnitRequiresAuthenticationHelper -from github3.checks import CheckRun -from github3.checks import CheckSuite +from github3.checks import CheckRun, CheckSuite from github3.exceptions import GitHubException +from .helper import ( + UnitAppInstallHelper, + UnitHelper, + UnitIteratorHelper, + UnitRequiresAuthenticationHelper, + create_example_data_helper, + create_url_helper, +) + url_for = create_url_helper("https://api.github.com/repos/github/hello-world") check_run_example_data = create_example_data_helper("check_run_example") diff --git a/tests/unit/test_events.py b/tests/unit/test_events.py index e8d6320fc..923437be4 100644 --- a/tests/unit/test_events.py +++ b/tests/unit/test_events.py @@ -1,8 +1,8 @@ from unittest import TestCase import github3 -from .helper import create_example_data_helper -from .helper import UnitHelper + +from .helper import UnitHelper, create_example_data_helper get_example_data = create_example_data_helper("event_example") get_org_example_data = create_example_data_helper("org_example") diff --git a/tests/unit/test_gists.py b/tests/unit/test_gists.py index 5379caa09..22af067ff 100644 --- a/tests/unit/test_gists.py +++ b/tests/unit/test_gists.py @@ -2,6 +2,7 @@ import pytest import github3 + from . import helper gist_example_data = helper.create_example_data_helper("gist_example") diff --git a/tests/unit/test_git.py b/tests/unit/test_git.py index be589b87c..079e8a542 100644 --- a/tests/unit/test_git.py +++ b/tests/unit/test_git.py @@ -1,7 +1,6 @@ import github3 -from .helper import create_example_data_helper -from .helper import create_url_helper -from .helper import UnitHelper + +from .helper import UnitHelper, create_example_data_helper, create_url_helper get_example_data = create_example_data_helper("tree_example") url_for = create_url_helper( diff --git a/tests/unit/test_github.py b/tests/unit/test_github.py index dab91fb41..79e7b1b2a 100644 --- a/tests/unit/test_github.py +++ b/tests/unit/test_github.py @@ -2,12 +2,12 @@ import pytest -from . import helper -from github3 import GitHubEnterprise -from github3 import GitHubError +from github3 import GitHubEnterprise, GitHubError from github3.github import GitHub from github3.projects import Project +from . import helper + def url_for(path=""): """Simple function to generate URLs with the base GitHub URL.""" diff --git a/tests/unit/test_github_enterprise.py b/tests/unit/test_github_enterprise.py index 8e07ffccd..dd3a5d18d 100644 --- a/tests/unit/test_github_enterprise.py +++ b/tests/unit/test_github_enterprise.py @@ -1,8 +1,8 @@ import github3 -from .helper import create_example_data_helper -from .helper import UnitHelper from github3.github import GitHubEnterprise +from .helper import UnitHelper, create_example_data_helper + get_example_user = create_example_data_helper("user_example") example_data = get_example_user() diff --git a/tests/unit/test_github_session.py b/tests/unit/test_github_session.py index bfb6e6933..d57e9b41a 100644 --- a/tests/unit/test_github_session.py +++ b/tests/unit/test_github_session.py @@ -6,7 +6,6 @@ import pickle import pytest - import requests from github3 import session diff --git a/tests/unit/test_issues_issue.py b/tests/unit/test_issues_issue.py index 65bbf6d06..090da1f17 100644 --- a/tests/unit/test_issues_issue.py +++ b/tests/unit/test_issues_issue.py @@ -4,10 +4,11 @@ import dateutil.parser import github3 -from . import helper from github3.issues import Issue from github3.issues.label import Label +from . import helper + comment_url_for = helper.create_url_helper( "https://api.github.com/repos/octocat/Hello-World/issues/comments" ) diff --git a/tests/unit/test_issues_milestone.py b/tests/unit/test_issues_milestone.py index 8ebb2cf64..665a488f6 100644 --- a/tests/unit/test_issues_milestone.py +++ b/tests/unit/test_issues_milestone.py @@ -2,6 +2,7 @@ import datetime import github3 + from . import helper get_milestone_example_data = helper.create_example_data_helper( diff --git a/tests/unit/test_licenses.py b/tests/unit/test_licenses.py index c3b654f47..1471cd377 100644 --- a/tests/unit/test_licenses.py +++ b/tests/unit/test_licenses.py @@ -1,7 +1,6 @@ import github3 -from .helper import create_example_data_helper -from .helper import create_url_helper -from .helper import UnitHelper + +from .helper import UnitHelper, create_example_data_helper, create_url_helper get_example_data = create_example_data_helper("license_example") url_for = create_url_helper("https://api.github.com/licenses/mit") diff --git a/tests/unit/test_models.py b/tests/unit/test_models.py index 5212c4c09..8b5d303ab 100644 --- a/tests/unit/test_models.py +++ b/tests/unit/test_models.py @@ -1,18 +1,17 @@ import io import json from copy import copy -from datetime import datetime -from datetime import timedelta +from datetime import datetime, timedelta from unittest import TestCase import pytest import requests -from . import helper -from github3 import exceptions -from github3 import GitHubError +from github3 import GitHubError, exceptions from github3.models import GitHubCore +from . import helper + class MyTestRefreshClass(GitHubCore): """Subclass for testing refresh on GitHubCore.""" diff --git a/tests/unit/test_notifications.py b/tests/unit/test_notifications.py index 3d0f6435d..1443a60f7 100644 --- a/tests/unit/test_notifications.py +++ b/tests/unit/test_notifications.py @@ -1,8 +1,7 @@ """Unit tests around the Thread class.""" import github3 -from .helper import create_example_data_helper -from .helper import create_url_helper -from .helper import UnitHelper + +from .helper import UnitHelper, create_example_data_helper, create_url_helper get_example_data = create_example_data_helper("notification_example") url_for = create_url_helper("https://api.github.com/notifications/threads/1") diff --git a/tests/unit/test_orgs.py b/tests/unit/test_orgs.py index 9a34f3b01..cdc13397f 100644 --- a/tests/unit/test_orgs.py +++ b/tests/unit/test_orgs.py @@ -1,12 +1,12 @@ """Organization unit tests.""" import pytest -from . import helper from github3 import GitHubError -from github3.orgs import Organization -from github3.orgs import OrganizationHook +from github3.orgs import Organization, OrganizationHook from github3.projects import Project +from . import helper + url_for = helper.create_url_helper("https://api.github.com/orgs/github") hook_url_for = helper.create_url_helper( "https://api.github.com/orgs/octocat/hooks/1" diff --git a/tests/unit/test_orgs_team.py b/tests/unit/test_orgs_team.py index 4ca0cc3d3..51086d28f 100644 --- a/tests/unit/test_orgs_team.py +++ b/tests/unit/test_orgs_team.py @@ -1,9 +1,10 @@ import pytest -from . import helper from github3 import GitHubError from github3.orgs import Team +from . import helper + url_for = helper.create_url_helper( "https://api.github.com/organizations/1/team/1" ) diff --git a/tests/unit/test_projects.py b/tests/unit/test_projects.py index 9bee8e9ce..2dbc225cd 100644 --- a/tests/unit/test_projects.py +++ b/tests/unit/test_projects.py @@ -1,12 +1,9 @@ """Unit tests for the github3.projects module.""" import pytest -from . import helper -from github3 import exceptions -from github3 import GitHubError -from github3 import issues -from github3 import projects +from github3 import GitHubError, exceptions, issues, projects +from . import helper get_project_example_data = helper.create_example_data_helper( "project_example" diff --git a/tests/unit/test_pulls.py b/tests/unit/test_pulls.py index 88ddd6f92..f7a24f353 100644 --- a/tests/unit/test_pulls.py +++ b/tests/unit/test_pulls.py @@ -1,9 +1,9 @@ """Unit tests for the github3.pulls module.""" import pytest +from github3 import GitHubError, pulls + from . import helper -from github3 import GitHubError -from github3 import pulls get_pr_example_data = helper.create_example_data_helper( "pull_request_example" diff --git a/tests/unit/test_repos_branch.py b/tests/unit/test_repos_branch.py index d9116f13c..03ff1ce0e 100644 --- a/tests/unit/test_repos_branch.py +++ b/tests/unit/test_repos_branch.py @@ -1,5 +1,6 @@ """Unit tests for methods implemented on Branch.""" import github3 + from . import helper get_example_data = helper.create_example_data_helper("repos_branch_example") diff --git a/tests/unit/test_repos_branch_protection.py b/tests/unit/test_repos_branch_protection.py index 5725c1add..86aac04f6 100644 --- a/tests/unit/test_repos_branch_protection.py +++ b/tests/unit/test_repos_branch_protection.py @@ -1,5 +1,6 @@ """Unit tests for methods implemented on Branch Protection.""" import github3 + from . import helper protection_example_data = helper.create_example_data_helper( diff --git a/tests/unit/test_repos_commit.py b/tests/unit/test_repos_commit.py index 379eefcbc..577f43379 100644 --- a/tests/unit/test_repos_commit.py +++ b/tests/unit/test_repos_commit.py @@ -1,5 +1,6 @@ """Unit tests for Repository Commits.""" import github3 + from . import helper get_commit_example_data = helper.create_example_data_helper("commit_example") diff --git a/tests/unit/test_repos_deployment.py b/tests/unit/test_repos_deployment.py index f8c6a5710..c6d66a750 100644 --- a/tests/unit/test_repos_deployment.py +++ b/tests/unit/test_repos_deployment.py @@ -1,8 +1,7 @@ """Unit tests for Deployment methods.""" import github3 -from .helper import create_example_data_helper -from .helper import create_url_helper -from .helper import UnitIteratorHelper + +from .helper import UnitIteratorHelper, create_example_data_helper, create_url_helper url_for = create_url_helper( "https://api.github.com/repos/octocat/example/deployments/1" diff --git a/tests/unit/test_repos_invitation.py b/tests/unit/test_repos_invitation.py index 38e46c8d4..2f1b81d70 100644 --- a/tests/unit/test_repos_invitation.py +++ b/tests/unit/test_repos_invitation.py @@ -1,5 +1,6 @@ """Unit tests for Repository Invitation objects.""" import github3 + from . import helper get_invitation_example_data = helper.create_example_data_helper( diff --git a/tests/unit/test_repos_release.py b/tests/unit/test_repos_release.py index 5656f4d56..5ea337b70 100644 --- a/tests/unit/test_repos_release.py +++ b/tests/unit/test_repos_release.py @@ -4,14 +4,16 @@ import pytest import github3 -from .helper import create_example_data_helper -from .helper import create_url_helper -from .helper import UnitHelper -from .helper import UnitIteratorHelper -from github3.repos.release import Asset -from github3.repos.release import Release +from github3.repos.release import Asset, Release from github3.users import ShortUser +from .helper import ( + UnitHelper, + UnitIteratorHelper, + create_example_data_helper, + create_url_helper, +) + url_for = create_url_helper( "https://api.github.com/repos/sigmavirus24/github3.py/releases" ) diff --git a/tests/unit/test_repos_repo.py b/tests/unit/test_repos_repo.py index e834514a9..f75053fb1 100644 --- a/tests/unit/test_repos_repo.py +++ b/tests/unit/test_repos_repo.py @@ -5,7 +5,6 @@ import pytest -from . import helper from github3 import GitHubError from github3.exceptions import GitHubException from github3.models import GitHubCore @@ -15,8 +14,9 @@ from github3.repos.comparison import Comparison from github3.repos.contents import Contents from github3.repos.hook import Hook -from github3.repos.repo import Repository -from github3.repos.repo import ShortRepository +from github3.repos.repo import Repository, ShortRepository + +from . import helper comment_url_for = helper.create_url_helper( "https://api.github.com/repos/octocat/Hello-World/comments/1" diff --git a/tests/unit/test_repos_status.py b/tests/unit/test_repos_status.py index cc2f2cf9c..b256e24f9 100644 --- a/tests/unit/test_repos_status.py +++ b/tests/unit/test_repos_status.py @@ -1,6 +1,6 @@ import github3 -from .helper import create_example_data_helper -from .helper import UnitHelper + +from .helper import UnitHelper, create_example_data_helper get_combined_status_example_data = create_example_data_helper( "repos_combined_status_example" diff --git a/tests/unit/test_structs.py b/tests/unit/test_structs.py index 285799db2..589418560 100644 --- a/tests/unit/test_structs.py +++ b/tests/unit/test_structs.py @@ -1,8 +1,9 @@ import unittest.mock -from .helper import UnitHelper from github3.structs import GitHubIterator +from .helper import UnitHelper + class TestGitHubIterator(UnitHelper): described_class = GitHubIterator diff --git a/tests/unit/test_subscription.py b/tests/unit/test_subscription.py index 914ec0666..e0e3fd1de 100644 --- a/tests/unit/test_subscription.py +++ b/tests/unit/test_subscription.py @@ -1,8 +1,7 @@ """Unit tests around github3's Subscription classes.""" import github3 -from .helper import create_example_data_helper -from .helper import create_url_helper -from .helper import UnitHelper + +from .helper import UnitHelper, create_example_data_helper, create_url_helper get_example_data = create_example_data_helper("subscription_example") url_for = create_url_helper( diff --git a/tests/unit/test_users.py b/tests/unit/test_users.py index b7f84c6e8..d425c5d5b 100644 --- a/tests/unit/test_users.py +++ b/tests/unit/test_users.py @@ -1,6 +1,7 @@ import pytest import github3 + from . import helper url_for = helper.create_url_helper("https://api.github.com/users/octocat") diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index a9a52284d..e64c5d0d3 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -5,8 +5,7 @@ import pytest import requests -from github3.utils import stream_response_to_file -from github3.utils import timestamp_parameter +from github3.utils import stream_response_to_file, timestamp_parameter class TestTimestampConverter: diff --git a/tox.ini b/tox.ini index 4654e0cce..0124dabe4 100644 --- a/tox.ini +++ b/tox.ini @@ -119,3 +119,6 @@ ignore-path-errors = docs/source/release-notes/1.0.0.rst;D001 extend-ignore = E203,W503 max-line-length = 80 exclude = src/github3/_version.py + +[isort] +profile = black From 47d514bb0cbcb5454bf809f55d02b37de24fa383 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 21 Mar 2024 09:30:10 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/github3/github.py | 6 +++++- tests/unit/test_repos_deployment.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/github3/github.py b/src/github3/github.py index d092a9a27..cc82952a1 100644 --- a/src/github3/github.py +++ b/src/github3/github.py @@ -24,7 +24,11 @@ users, utils, ) -from .decorators import requires_app_credentials, requires_auth, requires_basic_auth +from .decorators import ( + requires_app_credentials, + requires_auth, + requires_basic_auth, +) from .repos import invitation, repo _pubsub_re = re.compile( diff --git a/tests/unit/test_repos_deployment.py b/tests/unit/test_repos_deployment.py index c6d66a750..2a9ef40b5 100644 --- a/tests/unit/test_repos_deployment.py +++ b/tests/unit/test_repos_deployment.py @@ -1,7 +1,11 @@ """Unit tests for Deployment methods.""" import github3 -from .helper import UnitIteratorHelper, create_example_data_helper, create_url_helper +from .helper import ( + UnitIteratorHelper, + create_example_data_helper, + create_url_helper, +) url_for = create_url_helper( "https://api.github.com/repos/octocat/example/deployments/1" From e5991a159904a70afc1d00fa3b035c02b49fc460 Mon Sep 17 00:00:00 2001 From: jmeridth Date: Thu, 21 Mar 2024 06:47:31 -0500 Subject: [PATCH 3/5] fix: add line-length to isort to match black re-run black, hopefully get us to a non-conflict Signed-off-by: jmeridth --- .pre-commit-config.yaml | 1 - pyproject.toml | 1 + src/github3/__about__.py | 1 + src/github3/__init__.py | 1 + src/github3/api.py | 1 + src/github3/apps.py | 1 + src/github3/auths.py | 1 + src/github3/checks.py | 1 + src/github3/decorators.py | 1 + src/github3/events.py | 1 + src/github3/gists/__init__.py | 1 + src/github3/gists/comment.py | 1 + src/github3/gists/file.py | 1 + src/github3/gists/gist.py | 1 + src/github3/gists/history.py | 1 + src/github3/git.py | 1 + src/github3/github.py | 1 + src/github3/issues/__init__.py | 1 + src/github3/issues/comment.py | 1 + src/github3/issues/event.py | 1 + src/github3/issues/issue.py | 1 + src/github3/issues/label.py | 1 + src/github3/licenses.py | 1 + src/github3/models.py | 1 + src/github3/notifications.py | 1 + src/github3/orgs.py | 1 + src/github3/projects.py | 1 + src/github3/pulls.py | 1 + src/github3/repos/__init__.py | 1 + src/github3/repos/branch.py | 7 ++++--- src/github3/repos/comment.py | 1 + src/github3/repos/commit.py | 1 + src/github3/repos/comparison.py | 1 + src/github3/repos/contents.py | 1 + src/github3/repos/deployment.py | 1 + src/github3/repos/hook.py | 1 + src/github3/repos/invitation.py | 1 + src/github3/repos/issue_import.py | 1 + src/github3/repos/pages.py | 1 + src/github3/repos/release.py | 1 + src/github3/repos/repo.py | 1 + src/github3/repos/stats.py | 1 + src/github3/repos/status.py | 1 + src/github3/repos/tag.py | 1 + src/github3/repos/topics.py | 1 + src/github3/repos/traffic.py | 1 + src/github3/search/code.py | 1 + src/github3/search/commit.py | 1 + src/github3/search/issue.py | 1 + src/github3/search/repository.py | 1 + src/github3/session.py | 1 + src/github3/structs.py | 1 - src/github3/users.py | 1 + src/github3/utils.py | 1 + tests/integration/test_auths.py | 2 +- tests/integration/test_checks.py | 1 + tests/integration/test_gists.py | 2 +- tests/integration/test_git.py | 3 +-- tests/integration/test_github.py | 1 + tests/integration/test_issue.py | 2 +- tests/integration/test_notifications.py | 1 + tests/integration/test_orgs.py | 3 +-- tests/integration/test_orgs_team.py | 2 +- tests/integration/test_projects.py | 1 + tests/integration/test_pulls.py | 1 + tests/integration/test_repos_branch.py | 1 + tests/integration/test_repos_commit.py | 1 + tests/integration/test_repos_deployment.py | 2 +- tests/integration/test_repos_invitation.py | 1 + tests/integration/test_repos_repo.py | 7 +------ tests/integration/test_users.py | 3 +-- tests/unit/helper.py | 4 +--- tests/unit/test_api.py | 2 +- tests/unit/test_auths.py | 3 +-- tests/unit/test_checks.py | 1 + tests/unit/test_gists.py | 2 +- tests/unit/test_git.py | 3 --- tests/unit/test_github.py | 2 -- tests/unit/test_issues_issue.py | 1 + tests/unit/test_issues_milestone.py | 2 +- tests/unit/test_notifications.py | 1 + tests/unit/test_orgs.py | 1 + tests/unit/test_projects.py | 1 + tests/unit/test_pulls.py | 1 + tests/unit/test_repos_branch.py | 2 +- tests/unit/test_repos_branch_protection.py | 1 + tests/unit/test_repos_commit.py | 3 +-- tests/unit/test_repos_deployment.py | 2 +- tests/unit/test_repos_invitation.py | 1 + tests/unit/test_repos_release.py | 1 - tests/unit/test_repos_repo.py | 13 +------------ tests/unit/test_repos_status.py | 1 - tests/unit/test_subscription.py | 1 + tests/unit/test_users.py | 9 --------- 94 files changed, 90 insertions(+), 62 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dd82b3cf7..24f9180c9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,6 @@ repos: rev: 5.13.2 hooks: - id: isort - args: [--profile, black] - repo: https://github.com/psf/black rev: 23.12.1 hooks: diff --git a/pyproject.toml b/pyproject.toml index 40d99b0f0..40a8272fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -96,3 +96,4 @@ exclude = [ [tool.isort] profile = "black" +line_length = 78 diff --git a/src/github3/__about__.py b/src/github3/__about__.py index e2101047d..e7e6dd25a 100644 --- a/src/github3/__about__.py +++ b/src/github3/__about__.py @@ -1,4 +1,5 @@ """The module that holds much of the metadata about github3.py.""" + __package_name__ = "github3.py" __title__ = "github3" __author__ = "Ian Stapleton Cordasco" diff --git a/src/github3/__init__.py b/src/github3/__init__.py index dec7284a6..c059b47e9 100644 --- a/src/github3/__init__.py +++ b/src/github3/__init__.py @@ -8,6 +8,7 @@ :license: Modified BSD, see LICENSE for more details """ + from .__about__ import ( __author__, __author_email__, diff --git a/src/github3/api.py b/src/github3/api.py index e1134cf64..73449ca87 100644 --- a/src/github3/api.py +++ b/src/github3/api.py @@ -6,6 +6,7 @@ :license: Modified BSD, see LICENSE for more details """ + from .github import GitHub, GitHubEnterprise gh = GitHub() diff --git a/src/github3/apps.py b/src/github3/apps.py index 18a8a0f52..d72a56219 100644 --- a/src/github3/apps.py +++ b/src/github3/apps.py @@ -2,6 +2,7 @@ https://developer.github.com/apps/building-github-apps/ """ + import time import jwt diff --git a/src/github3/auths.py b/src/github3/auths.py index 9a2898c09..fceb2bdd5 100644 --- a/src/github3/auths.py +++ b/src/github3/auths.py @@ -1,4 +1,5 @@ """This module contains the Authorization object.""" + from .decorators import requires_basic_auth from .models import GitHubCore diff --git a/src/github3/checks.py b/src/github3/checks.py index 872c770c5..4e501f65b 100644 --- a/src/github3/checks.py +++ b/src/github3/checks.py @@ -1,4 +1,5 @@ """This module contains all the classes relating to Checks.""" + from json import dumps from . import decorators, models diff --git a/src/github3/decorators.py b/src/github3/decorators.py index 4c8a081ef..ad06a60e8 100644 --- a/src/github3/decorators.py +++ b/src/github3/decorators.py @@ -1,4 +1,5 @@ """This module provides decorators to the rest of the library.""" + import os from functools import wraps from io import BytesIO as StringIO diff --git a/src/github3/events.py b/src/github3/events.py index d97d2faaf..60ed0315b 100644 --- a/src/github3/events.py +++ b/src/github3/events.py @@ -1,4 +1,5 @@ """This module contains the classes related to Events.""" + import copy from . import models diff --git a/src/github3/gists/__init__.py b/src/github3/gists/__init__.py index d550bcce9..9df63bf00 100644 --- a/src/github3/gists/__init__.py +++ b/src/github3/gists/__init__.py @@ -12,6 +12,7 @@ See also: http://developer.github.com/v3/gists/ """ + from .gist import Gist, ShortGist __all__ = ("Gist", "ShortGist") diff --git a/src/github3/gists/comment.py b/src/github3/gists/comment.py index a9d8c3426..4c12a7923 100644 --- a/src/github3/gists/comment.py +++ b/src/github3/gists/comment.py @@ -1,4 +1,5 @@ """Module containing the logic for a GistComment.""" + from .. import decorators, models, users diff --git a/src/github3/gists/file.py b/src/github3/gists/file.py index 820d56e99..1afbb6fe3 100644 --- a/src/github3/gists/file.py +++ b/src/github3/gists/file.py @@ -1,4 +1,5 @@ """Module containing the GistFile object.""" + from .. import models diff --git a/src/github3/gists/gist.py b/src/github3/gists/gist.py index 93eebd8e7..5bca50940 100644 --- a/src/github3/gists/gist.py +++ b/src/github3/gists/gist.py @@ -1,4 +1,5 @@ """This module contains the Gist, ShortGist, and GistFork objects.""" + import typing as t from json import dumps diff --git a/src/github3/gists/history.py b/src/github3/gists/history.py index 98e22a786..bc661062f 100644 --- a/src/github3/gists/history.py +++ b/src/github3/gists/history.py @@ -1,4 +1,5 @@ """Module containing the GistHistory object.""" + from .. import models, users diff --git a/src/github3/git.py b/src/github3/git.py index 150ac9182..f46c6d4a5 100644 --- a/src/github3/git.py +++ b/src/github3/git.py @@ -3,6 +3,7 @@ See also: http://developer.github.com/v3/git/ """ + import base64 from json import dumps diff --git a/src/github3/github.py b/src/github3/github.py index cc82952a1..a1e07e23c 100644 --- a/src/github3/github.py +++ b/src/github3/github.py @@ -1,4 +1,5 @@ """This module contains the main interfaces to the API.""" + import json import re import typing as t diff --git a/src/github3/issues/__init__.py b/src/github3/issues/__init__.py index 116b36a5c..4a71f5cc3 100644 --- a/src/github3/issues/__init__.py +++ b/src/github3/issues/__init__.py @@ -6,6 +6,7 @@ See also: http://developer.github.com/v3/issues/ """ + from ..utils import timestamp_parameter from .issue import Issue, ShortIssue diff --git a/src/github3/issues/comment.py b/src/github3/issues/comment.py index 53249d3ef..ecee234be 100644 --- a/src/github3/issues/comment.py +++ b/src/github3/issues/comment.py @@ -1,4 +1,5 @@ """Module with class(es) representing issue comments.""" + from .. import decorators, models, users, utils diff --git a/src/github3/issues/event.py b/src/github3/issues/event.py index 356afb945..68cb5ea6d 100644 --- a/src/github3/issues/event.py +++ b/src/github3/issues/event.py @@ -1,4 +1,5 @@ """Issue events logic.""" + from .. import users from ..models import GitHubCore diff --git a/src/github3/issues/issue.py b/src/github3/issues/issue.py index 30b17d093..43f193ebc 100644 --- a/src/github3/issues/issue.py +++ b/src/github3/issues/issue.py @@ -1,4 +1,5 @@ """Module containing the Issue logic.""" + from json import dumps from uritemplate import URITemplate # type: ignore diff --git a/src/github3/issues/label.py b/src/github3/issues/label.py index 065a1e481..93d2d98d8 100644 --- a/src/github3/issues/label.py +++ b/src/github3/issues/label.py @@ -1,4 +1,5 @@ """Module containing the logic for labels.""" + from json import dumps from ..decorators import requires_auth diff --git a/src/github3/licenses.py b/src/github3/licenses.py index 044950e23..89fc49f26 100644 --- a/src/github3/licenses.py +++ b/src/github3/licenses.py @@ -3,6 +3,7 @@ See also: https://developer.github.com/v3/licenses/ """ + import base64 from . import models diff --git a/src/github3/models.py b/src/github3/models.py index 2ca79b1e3..ecfc62ac7 100644 --- a/src/github3/models.py +++ b/src/github3/models.py @@ -1,4 +1,5 @@ """This module provides the basic models used in github3.py.""" + import json as jsonlib import logging import typing as t diff --git a/src/github3/notifications.py b/src/github3/notifications.py index 11ddbf07a..0cd17f75d 100644 --- a/src/github3/notifications.py +++ b/src/github3/notifications.py @@ -3,6 +3,7 @@ See also: http://developer.github.com/v3/activity/notifications/ """ + from json import dumps from . import models diff --git a/src/github3/orgs.py b/src/github3/orgs.py index 40504f6cb..926921d39 100644 --- a/src/github3/orgs.py +++ b/src/github3/orgs.py @@ -1,4 +1,5 @@ """This module contains all of the classes related to organizations.""" + import typing as t from json import dumps diff --git a/src/github3/projects.py b/src/github3/projects.py index 022212618..a2cce1f48 100644 --- a/src/github3/projects.py +++ b/src/github3/projects.py @@ -1,4 +1,5 @@ """This module contains all the classes relating to projects.""" + from json import dumps from . import exceptions, models, pulls, users diff --git a/src/github3/pulls.py b/src/github3/pulls.py index cc537036e..2e0fe58b1 100644 --- a/src/github3/pulls.py +++ b/src/github3/pulls.py @@ -1,4 +1,5 @@ """This module contains all the classes relating to pull requests.""" + from json import dumps from uritemplate import URITemplate # type: ignore diff --git a/src/github3/repos/__init__.py b/src/github3/repos/__init__.py index d2f6bcd9c..b30f3742e 100644 --- a/src/github3/repos/__init__.py +++ b/src/github3/repos/__init__.py @@ -6,6 +6,7 @@ See also: http://developer.github.com/v3/repos/ """ + from .repo import Repository, ShortRepository, StarredRepository __all__ = ("Repository", "ShortRepository", "StarredRepository") diff --git a/src/github3/repos/branch.py b/src/github3/repos/branch.py index 096f77cf6..8c6c11b77 100644 --- a/src/github3/repos/branch.py +++ b/src/github3/repos/branch.py @@ -1,4 +1,5 @@ """Implementation of a branch on a repository.""" + import typing as t from .. import decorators, models @@ -152,9 +153,9 @@ def protect( if allow_deletions is not None: edit["allow_deletions"] = allow_deletions if required_conversation_resolution is not None: - edit[ - "required_conversation_resolution" - ] = required_conversation_resolution + edit["required_conversation_resolution"] = ( + required_conversation_resolution + ) url = self._build_url("protection", base_url=self._api) resp = self._put(url, json=edit) json = self._json(resp, 200) diff --git a/src/github3/repos/comment.py b/src/github3/repos/comment.py index e176d6203..fb29f2266 100644 --- a/src/github3/repos/comment.py +++ b/src/github3/repos/comment.py @@ -1,4 +1,5 @@ """This module contains the RepoComment class.""" + from .. import models, users from ..decorators import requires_auth diff --git a/src/github3/repos/commit.py b/src/github3/repos/commit.py index dc58838b4..9295bd935 100644 --- a/src/github3/repos/commit.py +++ b/src/github3/repos/commit.py @@ -1,4 +1,5 @@ """This module contains the RepoCommit classes.""" + from .. import checks, git, models, users from . import status from .comment import RepoComment diff --git a/src/github3/repos/comparison.py b/src/github3/repos/comparison.py index 7552f5be3..4dd46ee77 100644 --- a/src/github3/repos/comparison.py +++ b/src/github3/repos/comparison.py @@ -1,4 +1,5 @@ """This module contains the Comparison object.""" + from .. import models from . import commit diff --git a/src/github3/repos/contents.py b/src/github3/repos/contents.py index 6381d03ed..c950367ba 100644 --- a/src/github3/repos/contents.py +++ b/src/github3/repos/contents.py @@ -1,4 +1,5 @@ """This module contains the Contents object.""" + from base64 import b64decode, b64encode from json import dumps diff --git a/src/github3/repos/deployment.py b/src/github3/repos/deployment.py index a8ec52544..3c8bc39af 100644 --- a/src/github3/repos/deployment.py +++ b/src/github3/repos/deployment.py @@ -1,4 +1,5 @@ """The module containing deployment logic.""" + from .. import users from ..models import GitHubCore diff --git a/src/github3/repos/hook.py b/src/github3/repos/hook.py index 4cc032360..aae36f8c9 100644 --- a/src/github3/repos/hook.py +++ b/src/github3/repos/hook.py @@ -1,4 +1,5 @@ """This module contains only the Hook object for GitHub's Hook API.""" + from json import dumps from ..decorators import requires_auth diff --git a/src/github3/repos/invitation.py b/src/github3/repos/invitation.py index 324ae5b04..0ed93966e 100644 --- a/src/github3/repos/invitation.py +++ b/src/github3/repos/invitation.py @@ -1,4 +1,5 @@ """Invitation related logic.""" + from json import dumps from .. import models, users diff --git a/src/github3/repos/issue_import.py b/src/github3/repos/issue_import.py index a1827246a..d85081ea7 100644 --- a/src/github3/repos/issue_import.py +++ b/src/github3/repos/issue_import.py @@ -1,4 +1,5 @@ """This module contains the logic for GitHub's import issue API.""" + from .. import models diff --git a/src/github3/repos/pages.py b/src/github3/repos/pages.py index d0b40586f..369f22377 100644 --- a/src/github3/repos/pages.py +++ b/src/github3/repos/pages.py @@ -1,4 +1,5 @@ """GitHub Pages related logic.""" + from .. import models diff --git a/src/github3/repos/release.py b/src/github3/repos/release.py index e488c8307..7c442e6f2 100644 --- a/src/github3/repos/release.py +++ b/src/github3/repos/release.py @@ -1,4 +1,5 @@ """Release logic for the GitHub API.""" + import json from uritemplate import URITemplate # type: ignore diff --git a/src/github3/repos/repo.py b/src/github3/repos/repo.py index 61aedd845..1ca7a3fc9 100644 --- a/src/github3/repos/repo.py +++ b/src/github3/repos/repo.py @@ -4,6 +4,7 @@ returned by GitHub. """ + import base64 import json as jsonlib diff --git a/src/github3/repos/stats.py b/src/github3/repos/stats.py index 7d473d445..5924c8308 100644 --- a/src/github3/repos/stats.py +++ b/src/github3/repos/stats.py @@ -1,4 +1,5 @@ """Repository and contributor stats logic.""" + import datetime import dateutil.tz diff --git a/src/github3/repos/status.py b/src/github3/repos/status.py index 945657eb1..bc32a0dc6 100644 --- a/src/github3/repos/status.py +++ b/src/github3/repos/status.py @@ -1,4 +1,5 @@ """This module contains the Status object for GitHub's commit status API.""" + from .. import models, users from ..models import GitHubCore diff --git a/src/github3/repos/tag.py b/src/github3/repos/tag.py index d0feec098..d6618e190 100644 --- a/src/github3/repos/tag.py +++ b/src/github3/repos/tag.py @@ -1,4 +1,5 @@ """This module contains the RepoTag object for GitHub's tag API.""" + from .. import models from . import commit diff --git a/src/github3/repos/topics.py b/src/github3/repos/topics.py index 3ed884c37..06240e85b 100644 --- a/src/github3/repos/topics.py +++ b/src/github3/repos/topics.py @@ -1,4 +1,5 @@ """Topics related logic.""" + from .. import models diff --git a/src/github3/repos/traffic.py b/src/github3/repos/traffic.py index e2a200b27..2ed41f663 100644 --- a/src/github3/repos/traffic.py +++ b/src/github3/repos/traffic.py @@ -1,4 +1,5 @@ """Repository traffic stats logic.""" + from .. import models diff --git a/src/github3/search/code.py b/src/github3/search/code.py index 2bfc1f31f..49e6ec407 100644 --- a/src/github3/search/code.py +++ b/src/github3/search/code.py @@ -1,4 +1,5 @@ """Code search results implementation.""" + from .. import models, repos diff --git a/src/github3/search/commit.py b/src/github3/search/commit.py index cc4a8bcd0..1357a88bb 100644 --- a/src/github3/search/commit.py +++ b/src/github3/search/commit.py @@ -1,4 +1,5 @@ """Commit search results implementation.""" + from .. import git, models, repos, users diff --git a/src/github3/search/issue.py b/src/github3/search/issue.py index 111f24e15..963488e60 100644 --- a/src/github3/search/issue.py +++ b/src/github3/search/issue.py @@ -1,4 +1,5 @@ """Issue search results implementation.""" + from ..issues import ShortIssue from ..models import GitHubCore diff --git a/src/github3/search/repository.py b/src/github3/search/repository.py index f57ce8d8c..85f4cbe0d 100644 --- a/src/github3/search/repository.py +++ b/src/github3/search/repository.py @@ -1,4 +1,5 @@ """Repository search results implementation.""" + from .. import models, repos diff --git a/src/github3/session.py b/src/github3/session.py index e51345f4a..1d4a70ec6 100644 --- a/src/github3/session.py +++ b/src/github3/session.py @@ -1,4 +1,5 @@ """Module containing session and auth logic.""" + import collections.abc as abc_collections import datetime from contextlib import contextmanager diff --git a/src/github3/structs.py b/src/github3/structs.py index a415bd811..16f3f3239 100644 --- a/src/github3/structs.py +++ b/src/github3/structs.py @@ -155,7 +155,6 @@ def next(self) -> models.GitHubCore: class SearchIterator(GitHubIterator): - """This is a special-cased class for returning iterable search results. It inherits from :class:`GitHubIterator `. diff --git a/src/github3/users.py b/src/github3/users.py index cb8894c7d..16f58c57b 100644 --- a/src/github3/users.py +++ b/src/github3/users.py @@ -1,4 +1,5 @@ """This module contains everything relating to Users.""" + import typing as t from json import dumps diff --git a/src/github3/utils.py b/src/github3/utils.py index 8bbb3ee4c..9027d9f81 100644 --- a/src/github3/utils.py +++ b/src/github3/utils.py @@ -1,4 +1,5 @@ """A collection of useful utilities.""" + import collections.abc as abc_collections import datetime import re diff --git a/tests/integration/test_auths.py b/tests/integration/test_auths.py index c9edff5ac..3780a988f 100644 --- a/tests/integration/test_auths.py +++ b/tests/integration/test_auths.py @@ -1,11 +1,11 @@ """Integration tests for the github3.auths module.""" + import github3 from .helper import IntegrationHelper class TestAuthorization(IntegrationHelper): - """Integration tests for the Authorization class.""" def test_add_scopes(self): diff --git a/tests/integration/test_checks.py b/tests/integration/test_checks.py index 6043d78bd..1c0a6d294 100644 --- a/tests/integration/test_checks.py +++ b/tests/integration/test_checks.py @@ -1,4 +1,5 @@ """Integration tests for methods implemented on Check* classes.""" + import datetime import dateutil diff --git a/tests/integration/test_gists.py b/tests/integration/test_gists.py index 4ddeba6d2..d1e685b9e 100644 --- a/tests/integration/test_gists.py +++ b/tests/integration/test_gists.py @@ -1,11 +1,11 @@ """Integration tests for methods implemented on Gist.""" + import github3 from .helper import IntegrationHelper class TestGist(IntegrationHelper): - """Gist integration tests.""" def test_comments(self): diff --git a/tests/integration/test_git.py b/tests/integration/test_git.py index 4a9cacda0..2978613c4 100644 --- a/tests/integration/test_git.py +++ b/tests/integration/test_git.py @@ -1,11 +1,11 @@ """Integration tests for Git.""" + import github3 from .helper import IntegrationHelper class TestTree(IntegrationHelper): - """Integration tests for methods on the Test class.""" def test_inequality(self): @@ -30,7 +30,6 @@ def test_recurse(self): class TestReference(IntegrationHelper): - """Integration tests for methods on the Reference class.""" def test_update(self): diff --git a/tests/integration/test_github.py b/tests/integration/test_github.py index d280f6094..e2f0495df 100644 --- a/tests/integration/test_github.py +++ b/tests/integration/test_github.py @@ -1,4 +1,5 @@ """Integration tests for methods implemented on GitHub.""" + from datetime import datetime import pytest diff --git a/tests/integration/test_issue.py b/tests/integration/test_issue.py index 82b881834..7b87879f2 100644 --- a/tests/integration/test_issue.py +++ b/tests/integration/test_issue.py @@ -1,4 +1,5 @@ """Integration tests for Issues.""" + import pytest import github3 @@ -8,7 +9,6 @@ class TestIssue(IntegrationHelper): - """Integration tests for methods on the Issue class.""" def test_add_assignees(self): diff --git a/tests/integration/test_notifications.py b/tests/integration/test_notifications.py index a093da6ac..f62ccc3e5 100644 --- a/tests/integration/test_notifications.py +++ b/tests/integration/test_notifications.py @@ -1,4 +1,5 @@ """Integration test for Notifications.""" + import github3 from .helper import IntegrationHelper diff --git a/tests/integration/test_orgs.py b/tests/integration/test_orgs.py index 293f6a274..0870d2d8e 100644 --- a/tests/integration/test_orgs.py +++ b/tests/integration/test_orgs.py @@ -1,4 +1,5 @@ """Integration tests for methods implemented on Organization.""" + import pytest import github3 @@ -7,7 +8,6 @@ class TestOrganization(IntegrationHelper): - """Organization integration tests.""" betamax_kwargs = {"match_requests_on": ["method", "uri", "json-body"]} @@ -421,7 +421,6 @@ def test_hooks(self): class TestOrganizationHook(IntegrationHelper): - """Integration tests for OrganizationHook object.""" def test_delete(self): diff --git a/tests/integration/test_orgs_team.py b/tests/integration/test_orgs_team.py index 08ed6b375..2672ecce1 100644 --- a/tests/integration/test_orgs_team.py +++ b/tests/integration/test_orgs_team.py @@ -1,11 +1,11 @@ """Integration tests for methods implemented on Team.""" + import github3 from .helper import IntegrationHelper class TestTeam(IntegrationHelper): - """Team integration tests.""" betamax_kwargs = {"match_requests_on": ["method", "uri", "json-body"]} diff --git a/tests/integration/test_projects.py b/tests/integration/test_projects.py index b280f4b87..0ca795b6d 100644 --- a/tests/integration/test_projects.py +++ b/tests/integration/test_projects.py @@ -1,4 +1,5 @@ """Integration tests for methods implemented on Project.""" + import github3 from .helper import IntegrationHelper diff --git a/tests/integration/test_pulls.py b/tests/integration/test_pulls.py index 079cdda52..e779d9ea4 100644 --- a/tests/integration/test_pulls.py +++ b/tests/integration/test_pulls.py @@ -1,4 +1,5 @@ """Integration tests for methods implemented on PullRequest.""" + import github3 from github3 import repos diff --git a/tests/integration/test_repos_branch.py b/tests/integration/test_repos_branch.py index b2196b8f9..63aef8055 100644 --- a/tests/integration/test_repos_branch.py +++ b/tests/integration/test_repos_branch.py @@ -1,4 +1,5 @@ """Integration tests for methods implemented on Branch.""" + from .helper import IntegrationHelper diff --git a/tests/integration/test_repos_commit.py b/tests/integration/test_repos_commit.py index e95bc6483..c14ee930e 100644 --- a/tests/integration/test_repos_commit.py +++ b/tests/integration/test_repos_commit.py @@ -1,4 +1,5 @@ """Integration tests for Repository Commit objects.""" + import github3 from . import helper diff --git a/tests/integration/test_repos_deployment.py b/tests/integration/test_repos_deployment.py index e770927d3..35f16ff3c 100644 --- a/tests/integration/test_repos_deployment.py +++ b/tests/integration/test_repos_deployment.py @@ -1,4 +1,5 @@ """Deployment integration tests.""" + import github3 from .helper import IntegrationHelper @@ -10,7 +11,6 @@ def find(func, iterable): class TestDeployment(IntegrationHelper): - """Integration tests for the Deployment class.""" def test_create_status(self): diff --git a/tests/integration/test_repos_invitation.py b/tests/integration/test_repos_invitation.py index 224f10161..9bb36f052 100644 --- a/tests/integration/test_repos_invitation.py +++ b/tests/integration/test_repos_invitation.py @@ -1,4 +1,5 @@ """Integration tests for Repository Invitation objects.""" + import github3 from . import helper diff --git a/tests/integration/test_repos_repo.py b/tests/integration/test_repos_repo.py index b141eadeb..f0d1c52d4 100644 --- a/tests/integration/test_repos_repo.py +++ b/tests/integration/test_repos_repo.py @@ -1,4 +1,5 @@ """Integration tests for Repositories.""" + import datetime import itertools @@ -11,7 +12,6 @@ class TestRepository(helper.IntegrationHelper): - """Integration tests for the Repository object.""" def test_add_collaborator(self): @@ -1426,7 +1426,6 @@ def test_traffic_clones(self): class TestContents(helper.IntegrationHelper): - """Integration test for Contents object.""" def test_delete(self): @@ -1463,7 +1462,6 @@ def test_update(self): class TestHook(helper.IntegrationHelper): - """Integration tests for Hook object.""" def test_delete(self): @@ -1545,7 +1543,6 @@ def test_test(self): class TestRepoComment(helper.IntegrationHelper): - """Integration tests for RepoComment object.""" def test_delete(self): @@ -1578,7 +1575,6 @@ def test_edit(self): class TestRepoCommit(helper.IntegrationHelper): - """Integration tests for RepoCommit object.""" @pytest.mark.xfail @@ -1609,7 +1605,6 @@ def test_patch(self): class TestComparison(helper.IntegrationHelper): - """Integration test for Comparison object.""" @pytest.mark.xfail diff --git a/tests/integration/test_users.py b/tests/integration/test_users.py index b9f25cf68..15fabcd4b 100644 --- a/tests/integration/test_users.py +++ b/tests/integration/test_users.py @@ -1,4 +1,5 @@ """Integration tests for the User class.""" + import datetime import pytest @@ -35,7 +36,6 @@ class TestGPGKey(IntegrationHelper): - """Integration tests for methods of the GPGKey class.""" def test_delete(self): @@ -80,7 +80,6 @@ def test_update(self): class TestUser(IntegrationHelper): - """Integration tests for methods on the User class.""" def test_events(self): diff --git a/tests/unit/helper.py b/tests/unit/helper.py index df9b477f2..6da14b7e9 100644 --- a/tests/unit/helper.py +++ b/tests/unit/helper.py @@ -1,4 +1,5 @@ """Base classes and helpers for unit tests.""" + import json import os.path import sys @@ -194,7 +195,6 @@ def after_setup(self): class UnitIteratorHelper(UnitHelper): - """Base class for iterator based unit tests.""" def create_session_mock(self, *args): @@ -255,7 +255,6 @@ def after_setup(self): class UnitSearchIteratorHelper(UnitIteratorHelper): - """Base class for search iterator based unit tests.""" def patch_get_json(self): @@ -284,7 +283,6 @@ def after_setup(self): class UnitRequiresAuthenticationHelper(UnitHelper): - """Helper for unit tests that demonstrate authentication is required.""" def after_setup(self): diff --git a/tests/unit/test_api.py b/tests/unit/test_api.py index 6203863b1..95e304ed9 100644 --- a/tests/unit/test_api.py +++ b/tests/unit/test_api.py @@ -1,11 +1,11 @@ """Unit tests for github3.api.""" + import unittest.mock import github3 class TestAPI(unittest.TestCase): - """All tests for the github3.api module.""" def test_enterprise_login(self): diff --git a/tests/unit/test_auths.py b/tests/unit/test_auths.py index 528cc1754..1532ead94 100644 --- a/tests/unit/test_auths.py +++ b/tests/unit/test_auths.py @@ -1,4 +1,5 @@ """Unit tests for the auths module.""" + import github3 from . import helper @@ -7,7 +8,6 @@ class TestAuthorization(helper.UnitHelper): - """Authorization unit tests.""" described_class = github3.auths.Authorization @@ -52,7 +52,6 @@ def test_replace_scopes(self): class TestAuthorizationRequiresAuth(helper.UnitRequiresAuthenticationHelper): - """Test methods that require authentication on Authorization.""" described_class = github3.auths.Authorization diff --git a/tests/unit/test_checks.py b/tests/unit/test_checks.py index debbc42a3..6857d3084 100644 --- a/tests/unit/test_checks.py +++ b/tests/unit/test_checks.py @@ -1,4 +1,5 @@ """Unit tests around github3's Checks classes.""" + from json import dumps import pytest diff --git a/tests/unit/test_gists.py b/tests/unit/test_gists.py index 22af067ff..e0594da4e 100644 --- a/tests/unit/test_gists.py +++ b/tests/unit/test_gists.py @@ -1,4 +1,5 @@ """Unit tests for the github3.gists module.""" + import pytest import github3 @@ -108,7 +109,6 @@ def test_to_str(self): class TestGistIssue883(helper.UnitHelper): - """Unit tests for the Gist object about issue 883.""" described_class = github3.gists.Gist diff --git a/tests/unit/test_git.py b/tests/unit/test_git.py index 079e8a542..2b4af7fab 100644 --- a/tests/unit/test_git.py +++ b/tests/unit/test_git.py @@ -50,7 +50,6 @@ def test_recurse(self): class TestCommit(UnitHelper): - """Commit unit test.""" described_class = github3.git.Commit @@ -61,7 +60,6 @@ def test_repr(self): class TestGitTag(UnitHelper): - """Git Tag unit test.""" described_class = github3.git.Tag @@ -72,7 +70,6 @@ def test_repr(self): class TestReference(UnitHelper): - """Reference unit test.""" described_class = github3.git.Reference diff --git a/tests/unit/test_github.py b/tests/unit/test_github.py index 79e7b1b2a..27635ff47 100644 --- a/tests/unit/test_github.py +++ b/tests/unit/test_github.py @@ -1308,7 +1308,6 @@ def test_repositories_by_with_type(self): class TestGitHubSearchIterators(helper.UnitSearchIteratorHelper): - """Test GitHub methods that return search iterators.""" described_class = GitHub @@ -1418,7 +1417,6 @@ def test_api_version_header_not_defined(_): class TestGitHubRequiresAuthentication( helper.UnitRequiresAuthenticationHelper ): - """Test methods that require authentication.""" described_class = GitHub diff --git a/tests/unit/test_issues_issue.py b/tests/unit/test_issues_issue.py index 090da1f17..e1b12256a 100644 --- a/tests/unit/test_issues_issue.py +++ b/tests/unit/test_issues_issue.py @@ -1,4 +1,5 @@ """Unit tests for the Issue class.""" + import unittest.mock import dateutil.parser diff --git a/tests/unit/test_issues_milestone.py b/tests/unit/test_issues_milestone.py index 665a488f6..4765baf9c 100644 --- a/tests/unit/test_issues_milestone.py +++ b/tests/unit/test_issues_milestone.py @@ -1,4 +1,5 @@ """Unit tests for the Milestone class.""" + import datetime import github3 @@ -93,7 +94,6 @@ def test_update_no_parameters(self): class TestMilestoneIterator(helper.UnitIteratorHelper): - """Test Milestone methods that return iterators.""" described_class = github3.issues.milestone.Milestone diff --git a/tests/unit/test_notifications.py b/tests/unit/test_notifications.py index 1443a60f7..de35a8d71 100644 --- a/tests/unit/test_notifications.py +++ b/tests/unit/test_notifications.py @@ -1,4 +1,5 @@ """Unit tests around the Thread class.""" + import github3 from .helper import UnitHelper, create_example_data_helper, create_url_helper diff --git a/tests/unit/test_orgs.py b/tests/unit/test_orgs.py index cdc13397f..65cdcb997 100644 --- a/tests/unit/test_orgs.py +++ b/tests/unit/test_orgs.py @@ -1,4 +1,5 @@ """Organization unit tests.""" + import pytest from github3 import GitHubError diff --git a/tests/unit/test_projects.py b/tests/unit/test_projects.py index 2dbc225cd..892696169 100644 --- a/tests/unit/test_projects.py +++ b/tests/unit/test_projects.py @@ -1,4 +1,5 @@ """Unit tests for the github3.projects module.""" + import pytest from github3 import GitHubError, exceptions, issues, projects diff --git a/tests/unit/test_pulls.py b/tests/unit/test_pulls.py index f7a24f353..3ea709d40 100644 --- a/tests/unit/test_pulls.py +++ b/tests/unit/test_pulls.py @@ -1,4 +1,5 @@ """Unit tests for the github3.pulls module.""" + import pytest from github3 import GitHubError, pulls diff --git a/tests/unit/test_repos_branch.py b/tests/unit/test_repos_branch.py index 03ff1ce0e..f381e200c 100644 --- a/tests/unit/test_repos_branch.py +++ b/tests/unit/test_repos_branch.py @@ -1,4 +1,5 @@ """Unit tests for methods implemented on Branch.""" + import github3 from . import helper @@ -38,7 +39,6 @@ def test_unprotect(self): class TestBranchRequiresAuth(helper.UnitRequiresAuthenticationHelper): - """Unit tests for Branch methods that require authentication.""" described_class = github3.repos.branch.Branch diff --git a/tests/unit/test_repos_branch_protection.py b/tests/unit/test_repos_branch_protection.py index 86aac04f6..fb9f61588 100644 --- a/tests/unit/test_repos_branch_protection.py +++ b/tests/unit/test_repos_branch_protection.py @@ -1,4 +1,5 @@ """Unit tests for methods implemented on Branch Protection.""" + import github3 from . import helper diff --git a/tests/unit/test_repos_commit.py b/tests/unit/test_repos_commit.py index 577f43379..6061ddce0 100644 --- a/tests/unit/test_repos_commit.py +++ b/tests/unit/test_repos_commit.py @@ -1,4 +1,5 @@ """Unit tests for Repository Commits.""" + import github3 from . import helper @@ -10,7 +11,6 @@ class TestRepoCommitIterator(helper.UnitIteratorHelper): - """Unit tests for RepoCommit iterator methods.""" described_class = github3.repos.commit.RepoCommit @@ -47,7 +47,6 @@ def test_associated_pull_requests(self): class TestRepoCommitIteratorAppInstAuth(helper.UnitIteratorAppInstHelper): - """Unit tests for RepoCommit iterator methods.""" described_class = github3.repos.commit.RepoCommit diff --git a/tests/unit/test_repos_deployment.py b/tests/unit/test_repos_deployment.py index 2a9ef40b5..12de84288 100644 --- a/tests/unit/test_repos_deployment.py +++ b/tests/unit/test_repos_deployment.py @@ -1,4 +1,5 @@ """Unit tests for Deployment methods.""" + import github3 from .helper import ( @@ -17,7 +18,6 @@ class TestDeploymentIterators(UnitIteratorHelper): - """Test Deployment methods that return iterators.""" described_class = github3.repos.deployment.Deployment diff --git a/tests/unit/test_repos_invitation.py b/tests/unit/test_repos_invitation.py index 2f1b81d70..0ffe17f67 100644 --- a/tests/unit/test_repos_invitation.py +++ b/tests/unit/test_repos_invitation.py @@ -1,4 +1,5 @@ """Unit tests for Repository Invitation objects.""" + import github3 from . import helper diff --git a/tests/unit/test_repos_release.py b/tests/unit/test_repos_release.py index 5ea337b70..ea6fcaf57 100644 --- a/tests/unit/test_repos_release.py +++ b/tests/unit/test_repos_release.py @@ -110,7 +110,6 @@ def test_upload_asset_with_a_label(self): class TestReleaseIterators(UnitIteratorHelper): - """Test iterator methods on the Release class.""" described_class = Release diff --git a/tests/unit/test_repos_repo.py b/tests/unit/test_repos_repo.py index f75053fb1..9fe67ac9a 100644 --- a/tests/unit/test_repos_repo.py +++ b/tests/unit/test_repos_repo.py @@ -1,4 +1,5 @@ """Unit tests for Repositories.""" + import datetime import unittest.mock from base64 import b64encode @@ -67,7 +68,6 @@ class TestRepository(helper.UnitHelper): - """Unit test for regular Repository methods.""" described_class = Repository @@ -1026,7 +1026,6 @@ def test_clones_invalid_per(self): class TestRepositoryIterator(helper.UnitIteratorHelper): - """Unit tests for Repository methods that return iterators.""" described_class = Repository @@ -1468,7 +1467,6 @@ def test_teams(self): class TestRepositoryWithAppInstAuth(helper.UnitAppInstallHelper): - """Unit test for regular Repository methods.""" described_class = Repository @@ -1507,7 +1505,6 @@ def test_create_check_suite(self): class TestRepositoryRequiresAuth(helper.UnitRequiresAuthenticationHelper): - """Unit test for regular Repository methods.""" described_class = Repository @@ -1768,7 +1765,6 @@ def test_update_required_content(self): class TestContentsRequiresAuth(helper.UnitRequiresAuthenticationHelper): - """Unit test for Content methods that require Auth.""" described_class = Contents @@ -1789,7 +1785,6 @@ def test_update(self): class TestHook(helper.UnitHelper): - """Test methods on Hook class.""" described_class = Hook @@ -1843,7 +1838,6 @@ def test_test(self): class TestHookRequiresAuth(helper.UnitRequiresAuthenticationHelper): - """Test methods on Hook object that require authentication.""" described_class = Hook @@ -1876,7 +1870,6 @@ def test_test(self): class TestRepoComment(helper.UnitHelper): - """Unit test for methods on RepoComment object.""" example_data = comment_example_data @@ -1901,7 +1894,6 @@ def test_update(self): class TestRepoCommentRequiresAuth(helper.UnitRequiresAuthenticationHelper): - """ Unit test for methods that require authentication on RepoCommment object. @@ -1926,7 +1918,6 @@ def test_update(self): class TestRepoCommit(helper.UnitHelper): - """Unit tests for RepoCommit object.""" described_class = RepoCommit @@ -1959,7 +1950,6 @@ def test_str(self): class TestComparison(helper.UnitHelper): - """Unit test for Comparison object.""" described_class = Comparison @@ -1989,7 +1979,6 @@ def test_str(self): class TestRepositoryCompatibility_2_12(helper.UnitIteratorHelper): - """Unit tests for Repository from Github Enterprise 2.12""" described_class = Repository diff --git a/tests/unit/test_repos_status.py b/tests/unit/test_repos_status.py index b256e24f9..6ce44d849 100644 --- a/tests/unit/test_repos_status.py +++ b/tests/unit/test_repos_status.py @@ -8,7 +8,6 @@ class TestCombinedStatus(UnitHelper): - """Commit unit test.""" described_class = github3.repos.status.CombinedStatus diff --git a/tests/unit/test_subscription.py b/tests/unit/test_subscription.py index e0e3fd1de..eb74baee8 100644 --- a/tests/unit/test_subscription.py +++ b/tests/unit/test_subscription.py @@ -1,4 +1,5 @@ """Unit tests around github3's Subscription classes.""" + import github3 from .helper import UnitHelper, create_example_data_helper, create_url_helper diff --git a/tests/unit/test_users.py b/tests/unit/test_users.py index d425c5d5b..a9de6bb87 100644 --- a/tests/unit/test_users.py +++ b/tests/unit/test_users.py @@ -34,7 +34,6 @@ class TestUser(helper.UnitHelper): - """Test methods on User class.""" described_class = github3.users.User @@ -69,7 +68,6 @@ def test_is_following(self): class TestUserGPGKeyRequiresAuth(helper.UnitRequiresAuthenticationHelper): - """Unit tests that demonstrate which GPGKey methods require auth.""" described_class = github3.users.GPGKey @@ -81,7 +79,6 @@ def test_delete(self): class TestUserGPGKey(helper.UnitHelper): - """Unit tests for the GPGKey object.""" described_class = github3.users.GPGKey @@ -95,7 +92,6 @@ def test_delete(self): class TestUserKeyRequiresAuth(helper.UnitRequiresAuthenticationHelper): - """Test that ensure certain methods on Key class requires auth.""" described_class = github3.users.Key @@ -113,7 +109,6 @@ def test_delete(self): class TestUserKey(helper.UnitHelper): - """Test methods on Key class.""" described_class = github3.users.Key @@ -145,7 +140,6 @@ def test_update(self): class TestUserIterators(helper.UnitIteratorHelper): - """Test User methods that return iterators.""" described_class = github3.users.User @@ -265,7 +259,6 @@ def test_subscriptions(self): class TestUsersRequiresAuth(helper.UnitRequiresAuthenticationHelper): - """Test that ensure certain methods on the User class requires auth.""" described_class = github3.users.User @@ -278,7 +271,6 @@ def test_organization_events(self): class TestPlan(helper.UnitHelper): - """Test for methods on Plan class.""" described_class = github3.users.Plan @@ -295,7 +287,6 @@ def test_is_free(self): class TestAuthenticatedUserCompatibility_2_12(helper.UnitHelper): - """Test methods on AuthenticatedUser from Github Enterprise 2.12.""" described_class = github3.users.AuthenticatedUser From 8f2d8a103fd552094bec224753eebf1ea8edda2c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 21 Mar 2024 11:49:15 +0000 Subject: [PATCH 4/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/github3/repos/branch.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/github3/repos/branch.py b/src/github3/repos/branch.py index 8c6c11b77..94c90494b 100644 --- a/src/github3/repos/branch.py +++ b/src/github3/repos/branch.py @@ -153,9 +153,9 @@ def protect( if allow_deletions is not None: edit["allow_deletions"] = allow_deletions if required_conversation_resolution is not None: - edit["required_conversation_resolution"] = ( - required_conversation_resolution - ) + edit[ + "required_conversation_resolution" + ] = required_conversation_resolution url = self._build_url("protection", base_url=self._api) resp = self._put(url, json=edit) json = self._json(resp, 200) From c730ba7c4399b666ca52794688f042cb50e6a3ab Mon Sep 17 00:00:00 2001 From: Ian Stapleton Cordasco Date: Thu, 21 Mar 2024 06:53:43 -0500 Subject: [PATCH 5/5] Use isort config to reduce churn --- pyproject.toml | 1 + src/github3/__init__.py | 26 +++++------ src/github3/api.py | 3 +- src/github3/apps.py | 3 +- src/github3/checks.py | 3 +- src/github3/gists/__init__.py | 3 +- src/github3/gists/comment.py | 4 +- src/github3/gists/gist.py | 3 +- src/github3/gists/history.py | 3 +- src/github3/github.py | 47 ++++++++++---------- src/github3/issues/__init__.py | 3 +- src/github3/issues/comment.py | 5 ++- src/github3/issues/issue.py | 8 +++- src/github3/models.py | 3 +- src/github3/orgs.py | 6 ++- src/github3/projects.py | 5 ++- src/github3/pulls.py | 3 +- src/github3/repos/__init__.py | 4 +- src/github3/repos/branch.py | 7 ++- src/github3/repos/comment.py | 3 +- src/github3/repos/commit.py | 5 ++- src/github3/repos/contents.py | 3 +- src/github3/repos/invitation.py | 3 +- src/github3/repos/release.py | 4 +- src/github3/repos/repo.py | 65 +++++++++++++--------------- src/github3/repos/stats.py | 3 +- src/github3/repos/status.py | 3 +- src/github3/search/code.py | 3 +- src/github3/search/commit.py | 5 ++- src/github3/search/repository.py | 3 +- src/github3/structs.py | 6 ++- src/github3/users.py | 3 +- tests/integration/test_github.py | 3 +- tests/unit/test_checks.py | 17 ++++---- tests/unit/test_events.py | 3 +- tests/unit/test_git.py | 4 +- tests/unit/test_github.py | 3 +- tests/unit/test_github_enterprise.py | 3 +- tests/unit/test_licenses.py | 4 +- tests/unit/test_models.py | 6 ++- tests/unit/test_notifications.py | 4 +- tests/unit/test_orgs.py | 3 +- tests/unit/test_projects.py | 5 ++- tests/unit/test_pulls.py | 3 +- tests/unit/test_repos_deployment.py | 8 ++-- tests/unit/test_repos_release.py | 13 +++--- tests/unit/test_repos_repo.py | 3 +- tests/unit/test_repos_status.py | 3 +- tests/unit/test_subscription.py | 4 +- tests/unit/test_utils.py | 3 +- 50 files changed, 200 insertions(+), 141 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 40a8272fd..c0c72c713 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,3 +97,4 @@ exclude = [ [tool.isort] profile = "black" line_length = 78 +force_single_line = true diff --git a/src/github3/__init__.py b/src/github3/__init__.py index c059b47e9..f8cb24a11 100644 --- a/src/github3/__init__.py +++ b/src/github3/__init__.py @@ -9,20 +9,20 @@ """ -from .__about__ import ( - __author__, - __author_email__, - __copyright__, - __license__, - __package_name__, - __title__, - __url__, - __version__, - __version_info__, -) -from .api import enterprise_login, login +from .__about__ import __author__ +from .__about__ import __author_email__ +from .__about__ import __copyright__ +from .__about__ import __license__ +from .__about__ import __package_name__ +from .__about__ import __title__ +from .__about__ import __url__ +from .__about__ import __version__ +from .__about__ import __version_info__ +from .api import enterprise_login +from .api import login from .exceptions import GitHubError -from .github import GitHub, GitHubEnterprise +from .github import GitHub +from .github import GitHubEnterprise __all__ = ( "GitHub", diff --git a/src/github3/api.py b/src/github3/api.py index 73449ca87..55059ad50 100644 --- a/src/github3/api.py +++ b/src/github3/api.py @@ -7,7 +7,8 @@ """ -from .github import GitHub, GitHubEnterprise +from .github import GitHub +from .github import GitHubEnterprise gh = GitHub() diff --git a/src/github3/apps.py b/src/github3/apps.py index d72a56219..fc24a9c95 100644 --- a/src/github3/apps.py +++ b/src/github3/apps.py @@ -7,7 +7,8 @@ import jwt -from . import models, users +from . import models +from . import users TEN_MINUTES_AS_SECONDS = 10 * 60 DEFAULT_JWT_TOKEN_EXPIRATION = TEN_MINUTES_AS_SECONDS diff --git a/src/github3/checks.py b/src/github3/checks.py index 4e501f65b..402d93b90 100644 --- a/src/github3/checks.py +++ b/src/github3/checks.py @@ -2,7 +2,8 @@ from json import dumps -from . import decorators, models +from . import decorators +from . import models class CheckPullRequest(models.GitHubCore): diff --git a/src/github3/gists/__init__.py b/src/github3/gists/__init__.py index 9df63bf00..b10f2a41d 100644 --- a/src/github3/gists/__init__.py +++ b/src/github3/gists/__init__.py @@ -13,6 +13,7 @@ See also: http://developer.github.com/v3/gists/ """ -from .gist import Gist, ShortGist +from .gist import Gist +from .gist import ShortGist __all__ = ("Gist", "ShortGist") diff --git a/src/github3/gists/comment.py b/src/github3/gists/comment.py index 4c12a7923..9f6a18359 100644 --- a/src/github3/gists/comment.py +++ b/src/github3/gists/comment.py @@ -1,6 +1,8 @@ """Module containing the logic for a GistComment.""" -from .. import decorators, models, users +from .. import decorators +from .. import models +from .. import users class GistComment(models.GitHubCore): diff --git a/src/github3/gists/gist.py b/src/github3/gists/gist.py index 5bca50940..15b6b90e1 100644 --- a/src/github3/gists/gist.py +++ b/src/github3/gists/gist.py @@ -3,7 +3,8 @@ import typing as t from json import dumps -from .. import models, users +from .. import models +from .. import users from ..decorators import requires_auth from . import comment from . import file as gistfile diff --git a/src/github3/gists/history.py b/src/github3/gists/history.py index bc661062f..915ffd4ba 100644 --- a/src/github3/gists/history.py +++ b/src/github3/gists/history.py @@ -1,6 +1,7 @@ """Module containing the GistHistory object.""" -from .. import models, users +from .. import models +from .. import users class GistHistory(models.GitHubCore): diff --git a/src/github3/github.py b/src/github3/github.py index a1e07e23c..99a501214 100644 --- a/src/github3/github.py +++ b/src/github3/github.py @@ -6,31 +6,28 @@ import uritemplate # type: ignore -from . import ( - apps, - auths, - decorators, - events, - gists, - issues, - licenses, - models, - notifications, - orgs, - projects, - pulls, - search, - session, - structs, - users, - utils, -) -from .decorators import ( - requires_app_credentials, - requires_auth, - requires_basic_auth, -) -from .repos import invitation, repo +from . import apps +from . import auths +from . import decorators +from . import events +from . import gists +from . import issues +from . import licenses +from . import models +from . import notifications +from . import orgs +from . import projects +from . import pulls +from . import search +from . import session +from . import structs +from . import users +from . import utils +from .decorators import requires_app_credentials +from .decorators import requires_auth +from .decorators import requires_basic_auth +from .repos import invitation +from .repos import repo _pubsub_re = re.compile( r"https?://[\w\d\-\.\:]+/\w[\w-]+\w/[\w\._-]+/events/\w+" diff --git a/src/github3/issues/__init__.py b/src/github3/issues/__init__.py index 4a71f5cc3..4be94a912 100644 --- a/src/github3/issues/__init__.py +++ b/src/github3/issues/__init__.py @@ -8,7 +8,8 @@ """ from ..utils import timestamp_parameter -from .issue import Issue, ShortIssue +from .issue import Issue +from .issue import ShortIssue __all__ = ["Issue", "ShortIssue"] diff --git a/src/github3/issues/comment.py b/src/github3/issues/comment.py index ecee234be..bc9727828 100644 --- a/src/github3/issues/comment.py +++ b/src/github3/issues/comment.py @@ -1,6 +1,9 @@ """Module with class(es) representing issue comments.""" -from .. import decorators, models, users, utils +from .. import decorators +from .. import models +from .. import users +from .. import utils class IssueComment(models.GitHubCore): diff --git a/src/github3/issues/issue.py b/src/github3/issues/issue.py index 43f193ebc..6588ad4dd 100644 --- a/src/github3/issues/issue.py +++ b/src/github3/issues/issue.py @@ -4,9 +4,13 @@ from uritemplate import URITemplate # type: ignore -from .. import models, users +from .. import models +from .. import users from ..decorators import requires_auth -from . import comment, event, label, milestone +from . import comment +from . import event +from . import label +from . import milestone class _Issue(models.GitHubCore): diff --git a/src/github3/models.py b/src/github3/models.py index ecfc62ac7..9b6f13884 100644 --- a/src/github3/models.py +++ b/src/github3/models.py @@ -7,7 +7,8 @@ import dateutil.parser import requests.compat -from . import exceptions, session +from . import exceptions +from . import session if t.TYPE_CHECKING: from . import structs diff --git a/src/github3/orgs.py b/src/github3/orgs.py index 926921d39..9ee09fd4b 100644 --- a/src/github3/orgs.py +++ b/src/github3/orgs.py @@ -5,11 +5,13 @@ from uritemplate import URITemplate # type: ignore -from . import models, users +from . import models +from . import users from .decorators import requires_auth from .events import Event from .projects import Project -from .repos import Repository, ShortRepository +from .repos import Repository +from .repos import ShortRepository if t.TYPE_CHECKING: from . import users as _users diff --git a/src/github3/projects.py b/src/github3/projects.py index a2cce1f48..1998cc43a 100644 --- a/src/github3/projects.py +++ b/src/github3/projects.py @@ -2,7 +2,10 @@ from json import dumps -from . import exceptions, models, pulls, users +from . import exceptions +from . import models +from . import pulls +from . import users from .decorators import requires_auth from .issues import issue diff --git a/src/github3/pulls.py b/src/github3/pulls.py index 2e0fe58b1..86f5f2b48 100644 --- a/src/github3/pulls.py +++ b/src/github3/pulls.py @@ -4,7 +4,8 @@ from uritemplate import URITemplate # type: ignore -from . import models, users +from . import models +from . import users from .decorators import requires_auth from .issues import Issue from .issues.comment import IssueComment diff --git a/src/github3/repos/__init__.py b/src/github3/repos/__init__.py index b30f3742e..4638934bb 100644 --- a/src/github3/repos/__init__.py +++ b/src/github3/repos/__init__.py @@ -7,6 +7,8 @@ See also: http://developer.github.com/v3/repos/ """ -from .repo import Repository, ShortRepository, StarredRepository +from .repo import Repository +from .repo import ShortRepository +from .repo import StarredRepository __all__ = ("Repository", "ShortRepository", "StarredRepository") diff --git a/src/github3/repos/branch.py b/src/github3/repos/branch.py index 94c90494b..14d4b4467 100644 --- a/src/github3/repos/branch.py +++ b/src/github3/repos/branch.py @@ -2,7 +2,8 @@ import typing as t -from .. import decorators, models +from .. import decorators +from .. import models from . import commit if t.TYPE_CHECKING: @@ -603,7 +604,9 @@ class ProtectionRestrictions(models.GitHubCore): """ def _update_attributes(self, protection): - from .. import apps, orgs, users + from .. import apps + from .. import orgs + from .. import users self._api = protection["url"] self.users_url = protection["users_url"] diff --git a/src/github3/repos/comment.py b/src/github3/repos/comment.py index fb29f2266..a86f27d58 100644 --- a/src/github3/repos/comment.py +++ b/src/github3/repos/comment.py @@ -1,6 +1,7 @@ """This module contains the RepoComment class.""" -from .. import models, users +from .. import models +from .. import users from ..decorators import requires_auth diff --git a/src/github3/repos/commit.py b/src/github3/repos/commit.py index 9295bd935..5f6a67fd4 100644 --- a/src/github3/repos/commit.py +++ b/src/github3/repos/commit.py @@ -1,6 +1,9 @@ """This module contains the RepoCommit classes.""" -from .. import checks, git, models, users +from .. import checks +from .. import git +from .. import models +from .. import users from . import status from .comment import RepoComment diff --git a/src/github3/repos/contents.py b/src/github3/repos/contents.py index c950367ba..f87b1b91a 100644 --- a/src/github3/repos/contents.py +++ b/src/github3/repos/contents.py @@ -1,6 +1,7 @@ """This module contains the Contents object.""" -from base64 import b64decode, b64encode +from base64 import b64decode +from base64 import b64encode from json import dumps from .. import models diff --git a/src/github3/repos/invitation.py b/src/github3/repos/invitation.py index 0ed93966e..721777f3d 100644 --- a/src/github3/repos/invitation.py +++ b/src/github3/repos/invitation.py @@ -2,7 +2,8 @@ from json import dumps -from .. import models, users +from .. import models +from .. import users from ..decorators import requires_auth diff --git a/src/github3/repos/release.py b/src/github3/repos/release.py index 7c442e6f2..fad130a00 100644 --- a/src/github3/repos/release.py +++ b/src/github3/repos/release.py @@ -4,7 +4,9 @@ from uritemplate import URITemplate # type: ignore -from .. import models, users, utils +from .. import models +from .. import users +from .. import utils from ..decorators import requires_auth from ..exceptions import error_for diff --git a/src/github3/repos/repo.py b/src/github3/repos/repo.py index 1ca7a3fc9..8e9eb30be 100644 --- a/src/github3/repos/repo.py +++ b/src/github3/repos/repo.py @@ -10,41 +10,38 @@ import uritemplate as urit # type: ignore -from .. import ( - checks, - decorators, - events, - exceptions, - git, - issues, - licenses, - models, - notifications, - projects, - pulls, - users, - utils, -) +from .. import checks +from .. import decorators +from .. import events +from .. import exceptions +from .. import git +from .. import issues +from .. import licenses +from .. import models +from .. import notifications +from .. import projects +from .. import pulls +from .. import users +from .. import utils from ..issues import event as ievent -from ..issues import label, milestone -from . import ( - branch, - comment, - commit, - comparison, - contents, - deployment, - hook, - invitation, - issue_import, - pages, - release, - stats, - status, - tag, - topics, - traffic, -) +from ..issues import label +from ..issues import milestone +from . import branch +from . import comment +from . import commit +from . import comparison +from . import contents +from . import deployment +from . import hook +from . import invitation +from . import issue_import +from . import pages +from . import release +from . import stats +from . import status +from . import tag +from . import topics +from . import traffic class _Repository(models.GitHubCore): diff --git a/src/github3/repos/stats.py b/src/github3/repos/stats.py index 5924c8308..ef632657a 100644 --- a/src/github3/repos/stats.py +++ b/src/github3/repos/stats.py @@ -4,7 +4,8 @@ import dateutil.tz -from .. import models, users +from .. import models +from .. import users def alternate_week(week): diff --git a/src/github3/repos/status.py b/src/github3/repos/status.py index bc32a0dc6..8584d8b04 100644 --- a/src/github3/repos/status.py +++ b/src/github3/repos/status.py @@ -1,6 +1,7 @@ """This module contains the Status object for GitHub's commit status API.""" -from .. import models, users +from .. import models +from .. import users from ..models import GitHubCore diff --git a/src/github3/search/code.py b/src/github3/search/code.py index 49e6ec407..c9b1556ff 100644 --- a/src/github3/search/code.py +++ b/src/github3/search/code.py @@ -1,6 +1,7 @@ """Code search results implementation.""" -from .. import models, repos +from .. import models +from .. import repos class CodeSearchResult(models.GitHubCore): diff --git a/src/github3/search/commit.py b/src/github3/search/commit.py index 1357a88bb..79c8c5081 100644 --- a/src/github3/search/commit.py +++ b/src/github3/search/commit.py @@ -1,6 +1,9 @@ """Commit search results implementation.""" -from .. import git, models, repos, users +from .. import git +from .. import models +from .. import repos +from .. import users class CommitSearchResult(models.GitHubCore): diff --git a/src/github3/search/repository.py b/src/github3/search/repository.py index 85f4cbe0d..7a47a2f3e 100644 --- a/src/github3/search/repository.py +++ b/src/github3/search/repository.py @@ -1,6 +1,7 @@ """Repository search results implementation.""" -from .. import models, repos +from .. import models +from .. import repos class RepositorySearchResult(models.GitHubCore): diff --git a/src/github3/structs.py b/src/github3/structs.py index 16f3f3239..4339bdc9f 100644 --- a/src/github3/structs.py +++ b/src/github3/structs.py @@ -2,9 +2,11 @@ import functools import typing as t -from requests.compat import urlencode, urlparse +from requests.compat import urlencode +from requests.compat import urlparse -from . import exceptions, models +from . import exceptions +from . import models if t.TYPE_CHECKING: import requests.models diff --git a/src/github3/users.py b/src/github3/users.py index 16f58c57b..00c05865a 100644 --- a/src/github3/users.py +++ b/src/github3/users.py @@ -504,7 +504,8 @@ def starred_repositories( endpoint :returns: generator of :class:`~github3.repos.repo.StarredRepository` """ - from .repos import Repository, StarredRepository + from .repos import Repository + from .repos import StarredRepository params = {"sort": sort, "direction": direction} self._remove_none(params) diff --git a/tests/integration/test_github.py b/tests/integration/test_github.py index e2f0495df..9a992ee2f 100644 --- a/tests/integration/test_github.py +++ b/tests/integration/test_github.py @@ -7,7 +7,8 @@ import github3 -from .helper import GitHubEnterpriseHelper, IntegrationHelper +from .helper import GitHubEnterpriseHelper +from .helper import IntegrationHelper GPG_KEY = ( # Generated for this alone then deleted diff --git a/tests/unit/test_checks.py b/tests/unit/test_checks.py index 6857d3084..664d43fbf 100644 --- a/tests/unit/test_checks.py +++ b/tests/unit/test_checks.py @@ -5,17 +5,16 @@ import pytest import github3 -from github3.checks import CheckRun, CheckSuite +from github3.checks import CheckRun +from github3.checks import CheckSuite from github3.exceptions import GitHubException -from .helper import ( - UnitAppInstallHelper, - UnitHelper, - UnitIteratorHelper, - UnitRequiresAuthenticationHelper, - create_example_data_helper, - create_url_helper, -) +from .helper import UnitAppInstallHelper +from .helper import UnitHelper +from .helper import UnitIteratorHelper +from .helper import UnitRequiresAuthenticationHelper +from .helper import create_example_data_helper +from .helper import create_url_helper url_for = create_url_helper("https://api.github.com/repos/github/hello-world") diff --git a/tests/unit/test_events.py b/tests/unit/test_events.py index 923437be4..0812faaad 100644 --- a/tests/unit/test_events.py +++ b/tests/unit/test_events.py @@ -2,7 +2,8 @@ import github3 -from .helper import UnitHelper, create_example_data_helper +from .helper import UnitHelper +from .helper import create_example_data_helper get_example_data = create_example_data_helper("event_example") get_org_example_data = create_example_data_helper("org_example") diff --git a/tests/unit/test_git.py b/tests/unit/test_git.py index 2b4af7fab..af93d11c0 100644 --- a/tests/unit/test_git.py +++ b/tests/unit/test_git.py @@ -1,6 +1,8 @@ import github3 -from .helper import UnitHelper, create_example_data_helper, create_url_helper +from .helper import UnitHelper +from .helper import create_example_data_helper +from .helper import create_url_helper get_example_data = create_example_data_helper("tree_example") url_for = create_url_helper( diff --git a/tests/unit/test_github.py b/tests/unit/test_github.py index 27635ff47..49e93ca0e 100644 --- a/tests/unit/test_github.py +++ b/tests/unit/test_github.py @@ -2,7 +2,8 @@ import pytest -from github3 import GitHubEnterprise, GitHubError +from github3 import GitHubEnterprise +from github3 import GitHubError from github3.github import GitHub from github3.projects import Project diff --git a/tests/unit/test_github_enterprise.py b/tests/unit/test_github_enterprise.py index dd3a5d18d..1f5f2447d 100644 --- a/tests/unit/test_github_enterprise.py +++ b/tests/unit/test_github_enterprise.py @@ -1,7 +1,8 @@ import github3 from github3.github import GitHubEnterprise -from .helper import UnitHelper, create_example_data_helper +from .helper import UnitHelper +from .helper import create_example_data_helper get_example_user = create_example_data_helper("user_example") diff --git a/tests/unit/test_licenses.py b/tests/unit/test_licenses.py index 1471cd377..e08ecb70d 100644 --- a/tests/unit/test_licenses.py +++ b/tests/unit/test_licenses.py @@ -1,6 +1,8 @@ import github3 -from .helper import UnitHelper, create_example_data_helper, create_url_helper +from .helper import UnitHelper +from .helper import create_example_data_helper +from .helper import create_url_helper get_example_data = create_example_data_helper("license_example") url_for = create_url_helper("https://api.github.com/licenses/mit") diff --git a/tests/unit/test_models.py b/tests/unit/test_models.py index 8b5d303ab..fb6ebf074 100644 --- a/tests/unit/test_models.py +++ b/tests/unit/test_models.py @@ -1,13 +1,15 @@ import io import json from copy import copy -from datetime import datetime, timedelta +from datetime import datetime +from datetime import timedelta from unittest import TestCase import pytest import requests -from github3 import GitHubError, exceptions +from github3 import GitHubError +from github3 import exceptions from github3.models import GitHubCore from . import helper diff --git a/tests/unit/test_notifications.py b/tests/unit/test_notifications.py index de35a8d71..8d3cff6df 100644 --- a/tests/unit/test_notifications.py +++ b/tests/unit/test_notifications.py @@ -2,7 +2,9 @@ import github3 -from .helper import UnitHelper, create_example_data_helper, create_url_helper +from .helper import UnitHelper +from .helper import create_example_data_helper +from .helper import create_url_helper get_example_data = create_example_data_helper("notification_example") url_for = create_url_helper("https://api.github.com/notifications/threads/1") diff --git a/tests/unit/test_orgs.py b/tests/unit/test_orgs.py index 65cdcb997..e2eda0a8c 100644 --- a/tests/unit/test_orgs.py +++ b/tests/unit/test_orgs.py @@ -3,7 +3,8 @@ import pytest from github3 import GitHubError -from github3.orgs import Organization, OrganizationHook +from github3.orgs import Organization +from github3.orgs import OrganizationHook from github3.projects import Project from . import helper diff --git a/tests/unit/test_projects.py b/tests/unit/test_projects.py index 892696169..ec2a63fea 100644 --- a/tests/unit/test_projects.py +++ b/tests/unit/test_projects.py @@ -2,7 +2,10 @@ import pytest -from github3 import GitHubError, exceptions, issues, projects +from github3 import GitHubError +from github3 import exceptions +from github3 import issues +from github3 import projects from . import helper diff --git a/tests/unit/test_pulls.py b/tests/unit/test_pulls.py index 3ea709d40..378f5634b 100644 --- a/tests/unit/test_pulls.py +++ b/tests/unit/test_pulls.py @@ -2,7 +2,8 @@ import pytest -from github3 import GitHubError, pulls +from github3 import GitHubError +from github3 import pulls from . import helper diff --git a/tests/unit/test_repos_deployment.py b/tests/unit/test_repos_deployment.py index 12de84288..1b32c2c42 100644 --- a/tests/unit/test_repos_deployment.py +++ b/tests/unit/test_repos_deployment.py @@ -2,11 +2,9 @@ import github3 -from .helper import ( - UnitIteratorHelper, - create_example_data_helper, - create_url_helper, -) +from .helper import UnitIteratorHelper +from .helper import create_example_data_helper +from .helper import create_url_helper url_for = create_url_helper( "https://api.github.com/repos/octocat/example/deployments/1" diff --git a/tests/unit/test_repos_release.py b/tests/unit/test_repos_release.py index ea6fcaf57..7ff9e8cc1 100644 --- a/tests/unit/test_repos_release.py +++ b/tests/unit/test_repos_release.py @@ -4,15 +4,14 @@ import pytest import github3 -from github3.repos.release import Asset, Release +from github3.repos.release import Asset +from github3.repos.release import Release from github3.users import ShortUser -from .helper import ( - UnitHelper, - UnitIteratorHelper, - create_example_data_helper, - create_url_helper, -) +from .helper import UnitHelper +from .helper import UnitIteratorHelper +from .helper import create_example_data_helper +from .helper import create_url_helper url_for = create_url_helper( "https://api.github.com/repos/sigmavirus24/github3.py/releases" diff --git a/tests/unit/test_repos_repo.py b/tests/unit/test_repos_repo.py index 9fe67ac9a..d00571060 100644 --- a/tests/unit/test_repos_repo.py +++ b/tests/unit/test_repos_repo.py @@ -15,7 +15,8 @@ from github3.repos.comparison import Comparison from github3.repos.contents import Contents from github3.repos.hook import Hook -from github3.repos.repo import Repository, ShortRepository +from github3.repos.repo import Repository +from github3.repos.repo import ShortRepository from . import helper diff --git a/tests/unit/test_repos_status.py b/tests/unit/test_repos_status.py index 6ce44d849..568c45b8d 100644 --- a/tests/unit/test_repos_status.py +++ b/tests/unit/test_repos_status.py @@ -1,6 +1,7 @@ import github3 -from .helper import UnitHelper, create_example_data_helper +from .helper import UnitHelper +from .helper import create_example_data_helper get_combined_status_example_data = create_example_data_helper( "repos_combined_status_example" diff --git a/tests/unit/test_subscription.py b/tests/unit/test_subscription.py index eb74baee8..d2aeac387 100644 --- a/tests/unit/test_subscription.py +++ b/tests/unit/test_subscription.py @@ -2,7 +2,9 @@ import github3 -from .helper import UnitHelper, create_example_data_helper, create_url_helper +from .helper import UnitHelper +from .helper import create_example_data_helper +from .helper import create_url_helper get_example_data = create_example_data_helper("subscription_example") url_for = create_url_helper( diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index e64c5d0d3..a9a52284d 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -5,7 +5,8 @@ import pytest import requests -from github3.utils import stream_response_to_file, timestamp_parameter +from github3.utils import stream_response_to_file +from github3.utils import timestamp_parameter class TestTimestampConverter: