Set line length to 120 characters (#2599)

This commit is contained in:
Jirka Borovec
2023-07-13 17:37:20 +02:00
committed by GitHub
parent de80ff4b91
commit 13e178a3ab
192 changed files with 1455 additions and 4433 deletions
+21 -65
View File
@@ -78,11 +78,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
return hash((self.id, self.login))
def __eq__(self, other):
return (
isinstance(other, type(self))
and self.login == other.login
and self.id == other.id
)
return isinstance(other, type(self)) and self.login == other.login and self.id == other.id
@property
def avatar_url(self):
@@ -433,27 +429,21 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
:calls: `GET /users/{user}/events <https://docs.github.com/en/rest/reference/activity#events>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
"""
return github.PaginatedList.PaginatedList(
github.Event.Event, self._requester, f"{self.url}/events", None
)
return github.PaginatedList.PaginatedList(github.Event.Event, self._requester, f"{self.url}/events", None)
def get_followers(self):
"""
:calls: `GET /users/{user}/followers <https://docs.github.com/en/rest/reference/users#followers>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
"""
return github.PaginatedList.PaginatedList(
NamedUser, self._requester, f"{self.url}/followers", None
)
return github.PaginatedList.PaginatedList(NamedUser, self._requester, f"{self.url}/followers", None)
def get_following(self):
"""
:calls: `GET /users/{user}/following <https://docs.github.com/en/rest/reference/users#followers>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
"""
return github.PaginatedList.PaginatedList(
NamedUser, self._requester, f"{self.url}/following", None
)
return github.PaginatedList.PaginatedList(NamedUser, self._requester, f"{self.url}/following", None)
def get_gists(self, since=github.GithubObject.NotSet):
"""
@@ -474,9 +464,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
:calls: `GET /users/{user}/keys <https://docs.github.com/en/rest/reference/users#create-a-public-ssh-key-for-the-authenticated-user>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.UserKey.UserKey`
"""
return github.PaginatedList.PaginatedList(
github.UserKey.UserKey, self._requester, f"{self.url}/keys", None
)
return github.PaginatedList.PaginatedList(github.UserKey.UserKey, self._requester, f"{self.url}/keys", None)
def get_orgs(self):
"""
@@ -540,12 +528,8 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
:rtype: :class:`github.Repository.Repository`
"""
assert isinstance(name, str), name
headers, data = self._requester.requestJsonAndCheck(
"GET", f"/repos/{self.login}/{name}"
)
return github.Repository.Repository(
self._requester, headers, data, completed=True
)
headers, data = self._requester.requestJsonAndCheck("GET", f"/repos/{self.login}/{name}")
return github.Repository.Repository(self._requester, headers, data, completed=True)
def get_repos(
self,
@@ -562,9 +546,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
"""
assert type is github.GithubObject.NotSet or isinstance(type, str), type
assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort
assert direction is github.GithubObject.NotSet or isinstance(
direction, str
), direction
assert direction is github.GithubObject.NotSet or isinstance(direction, str), direction
url_parameters = dict()
if type is not github.GithubObject.NotSet:
url_parameters["type"] = type
@@ -616,9 +598,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
:rtype: bool
"""
assert isinstance(following, github.NamedUser.NamedUser), following
status, headers, data = self._requester.requestJson(
"GET", f"{self.url}/following/{following._identity}"
)
status, headers, data = self._requester.requestJson("GET", f"{self.url}/following/{following._identity}")
return status == 204
@property
@@ -631,17 +611,11 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
:param org: string or :class:`github.Organization.Organization`
:rtype: :class:`github.Membership.Membership`
"""
assert isinstance(org, str) or isinstance(
org, github.Organization.Organization
), org
assert isinstance(org, str) or isinstance(org, github.Organization.Organization), org
if isinstance(org, github.Organization.Organization):
org = org.login
headers, data = self._requester.requestJsonAndCheck(
"GET", f"/orgs/{org}/memberships/{self.login}"
)
return github.Membership.Membership(
self._requester, headers, data, completed=True
)
headers, data = self._requester.requestJsonAndCheck("GET", f"/orgs/{org}/memberships/{self.login}")
return github.Membership.Membership(self._requester, headers, data, completed=True)
def _initAttributes(self):
self._avatar_url = github.GithubObject.NotSet
@@ -730,13 +704,9 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
if "id" in attributes: # pragma no branch
self._id = self._makeIntAttribute(attributes["id"])
if "invitation_teams_url" in attributes: # pragma no branch
self._invitation_teams_url = self._makeStringAttribute(
attributes["invitation_teams_url"]
)
self._invitation_teams_url = self._makeStringAttribute(attributes["invitation_teams_url"])
if "inviter" in attributes: # pragma no branch
self._inviter = self._makeClassAttribute(
github.NamedUser.NamedUser, attributes["inviter"]
)
self._inviter = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["inviter"])
if "location" in attributes: # pragma no branch
self._location = self._makeStringAttribute(attributes["location"])
if "login" in attributes: # pragma no branch
@@ -746,17 +716,11 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
if "node_id" in attributes: # pragma no branch
self._node_id = self._makeStringAttribute(attributes["node_id"])
if "organizations_url" in attributes: # pragma no branch
self._organizations_url = self._makeStringAttribute(
attributes["organizations_url"]
)
self._organizations_url = self._makeStringAttribute(attributes["organizations_url"])
if "owned_private_repos" in attributes: # pragma no branch
self._owned_private_repos = self._makeIntAttribute(
attributes["owned_private_repos"]
)
self._owned_private_repos = self._makeIntAttribute(attributes["owned_private_repos"])
if "permissions" in attributes: # pragma no branch
self._permissions = self._makeClassAttribute(
github.Permissions.Permissions, attributes["permissions"]
)
self._permissions = self._makeClassAttribute(github.Permissions.Permissions, attributes["permissions"])
if "plan" in attributes: # pragma no branch
self._plan = self._makeClassAttribute(github.Plan.Plan, attributes["plan"])
if "private_gists" in attributes: # pragma no branch
@@ -766,9 +730,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
if "public_repos" in attributes: # pragma no branch
self._public_repos = self._makeIntAttribute(attributes["public_repos"])
if "received_events_url" in attributes: # pragma no branch
self._received_events_url = self._makeStringAttribute(
attributes["received_events_url"]
)
self._received_events_url = self._makeStringAttribute(attributes["received_events_url"])
if "repos_url" in attributes: # pragma no branch
self._repos_url = self._makeStringAttribute(attributes["repos_url"])
if "role" in attributes: # pragma no branch
@@ -778,21 +740,15 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
if "starred_url" in attributes: # pragma no branch
self._starred_url = self._makeStringAttribute(attributes["starred_url"])
if "subscriptions_url" in attributes: # pragma no branch
self._subscriptions_url = self._makeStringAttribute(
attributes["subscriptions_url"]
)
self._subscriptions_url = self._makeStringAttribute(attributes["subscriptions_url"])
if "suspended_at" in attributes: # pragma no branch
self._suspended_at = self._makeDatetimeAttribute(attributes["suspended_at"])
if "team_count" in attributes:
self._team_count = self._makeIntAttribute(attributes["team_count"])
if "total_private_repos" in attributes: # pragma no branch
self._total_private_repos = self._makeIntAttribute(
attributes["total_private_repos"]
)
self._total_private_repos = self._makeIntAttribute(attributes["total_private_repos"])
if "twitter_username" in attributes: # pragma no branch
self._twitter_username = self._makeStringAttribute(
attributes["twitter_username"]
)
self._twitter_username = self._makeStringAttribute(attributes["twitter_username"])
if "type" in attributes: # pragma no branch
self._type = self._makeStringAttribute(attributes["type"])
if "updated_at" in attributes: # pragma no branch