Add some attributes. (#1468)

* Add some attributes to Repository and Organization

* Format.

* small fix

* Add some test.
This commit is contained in:
ton-katsu
2020-04-21 11:49:32 +10:00
committed by GitHub
parent 7046259832
commit 3ab97d6145
14 changed files with 175 additions and 22 deletions
+74
View File
@@ -111,6 +111,14 @@ class Organization(github.GithubObject.CompletableGithubObject):
self._completeIfNotSet(self._created_at)
return self._created_at.value
@property
def default_repository_permission(self):
"""
:type: string
"""
self._completeIfNotSet(self._default_repository_permission)
return self._default_repository_permission.value
@property
def description(self):
"""
@@ -167,6 +175,30 @@ class Organization(github.GithubObject.CompletableGithubObject):
self._completeIfNotSet(self._gravatar_id)
return self._gravatar_id.value
@property
def has_organization_projects(self):
"""
:type: bool
"""
self._completeIfNotSet(self._has_organization_projects)
return self._has_organization_projects.value
@property
def has_repository_projects(self):
"""
:type: bool
"""
self._completeIfNotSet(self._has_repository_projects)
return self._has_repository_projects.value
@property
def hooks_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._hooks_url)
return self._hooks_url.value
@property
def html_url(self):
"""
@@ -183,6 +215,14 @@ class Organization(github.GithubObject.CompletableGithubObject):
self._completeIfNotSet(self._id)
return self._id.value
@property
def issues_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._issues_url)
return self._issues_url.value
@property
def location(self):
"""
@@ -199,6 +239,14 @@ class Organization(github.GithubObject.CompletableGithubObject):
self._completeIfNotSet(self._login)
return self._login.value
@property
def members_can_create_repositories(self):
"""
:type: bool
"""
self._completeIfNotSet(self._members_can_create_repositories)
return self._members_can_create_repositories.value
@property
def members_url(self):
"""
@@ -1109,6 +1157,12 @@ class Organization(github.GithubObject.CompletableGithubObject):
)
def _initAttributes(self):
self._default_repository_permission = github.GithubObject.NotSet
self._has_organization_projects = github.GithubObject.NotSet
self._has_repository_projects = github.GithubObject.NotSet
self._hooks_url = github.GithubObject.NotSet
self._issues_url = github.GithubObject.NotSet
self._members_can_create_repositories = github.GithubObject.NotSet
self._two_factor_requirement_enabled = github.GithubObject.NotSet
self._avatar_url = github.GithubObject.NotSet
self._billing_email = github.GithubObject.NotSet
@@ -1154,6 +1208,10 @@ class Organization(github.GithubObject.CompletableGithubObject):
self._company = self._makeStringAttribute(attributes["company"])
if "created_at" in attributes: # pragma no branch
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
if "default_repository_permission" in attributes: # pragma no branch
self._default_repository_permission = self._makeStringAttribute(
attributes["default_repository_permission"]
)
if "description" in attributes: # pragma no branch
self._description = self._makeStringAttribute(attributes["description"])
if "disk_usage" in attributes: # pragma no branch
@@ -1168,14 +1226,30 @@ class Organization(github.GithubObject.CompletableGithubObject):
self._following = self._makeIntAttribute(attributes["following"])
if "gravatar_id" in attributes: # pragma no branch
self._gravatar_id = self._makeStringAttribute(attributes["gravatar_id"])
if "has_organization_projects" in attributes: # pragma no branch
self._has_organization_projects = self._makeBoolAttribute(
attributes["has_organization_projects"]
)
if "has_repository_projects" in attributes: # pragma no branch
self._has_repository_projects = self._makeBoolAttribute(
attributes["has_repository_projects"]
)
if "hooks_url" in attributes: # pragma no branch
self._hooks_url = self._makeStringAttribute(attributes["hooks_url"])
if "html_url" in attributes: # pragma no branch
self._html_url = self._makeStringAttribute(attributes["html_url"])
if "id" in attributes: # pragma no branch
self._id = self._makeIntAttribute(attributes["id"])
if "issues_url" in attributes: # pragma no branch
self._issues_url = self._makeStringAttribute(attributes["issues_url"])
if "location" in attributes: # pragma no branch
self._location = self._makeStringAttribute(attributes["location"])
if "login" in attributes: # pragma no branch
self._login = self._makeStringAttribute(attributes["login"])
if "members_can_create_repositories" in attributes: # pragma no branch
self._members_can_create_repositories = self._makeBoolAttribute(
attributes["members_can_create_repositories"]
)
if "members_url" in attributes: # pragma no branch
self._members_url = self._makeStringAttribute(attributes["members_url"])
if "name" in attributes: # pragma no branch
+12
View File
@@ -74,6 +74,8 @@ class Organization:
def created_at(self) -> datetime: ...
def delete_hook(self, id: int) -> None: ...
@property
def default_repository_permission(self) -> str: ...
@property
def description(self) -> str: ...
@property
def disk_usage(self) -> int: ...
@@ -140,9 +142,17 @@ class Organization:
def has_in_members(self, member: NamedUser) -> bool: ...
def has_in_public_members(self, public_member: NamedUser) -> bool: ...
@property
def has_organization_projects(self) -> bool: ...
@property
def has_repository_projects(self) -> bool: ...
@property
def hooks_url(self) -> str: ...
@property
def html_url(self) -> str: ...
@property
def id(self) -> int: ...
@property
def issues_url(self) -> str: ...
def invitations(self) -> PaginatedList: ...
def invite_user(
self,
@@ -156,6 +166,8 @@ class Organization:
@property
def login(self) -> str: ...
@property
def members_can_create_repositories(self) -> bool: ...
@property
def members_url(self) -> str: ...
@property
def name(self) -> Optional[str]: ...
+35
View File
@@ -291,6 +291,14 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._completeIfNotSet(self._delete_branch_on_merge)
return self._delete_branch_on_merge.value
@property
def deployments_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._deployments_url)
return self._deployments_url.value
@property
def description(self):
"""
@@ -403,6 +411,14 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._completeIfNotSet(self._has_issues)
return self._has_issues.value
@property
def has_pages(self):
"""
:type: bool
"""
self._completeIfNotSet(self._has_pages)
return self._has_pages.value
@property
def has_projects(self):
"""
@@ -635,6 +651,14 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._completeIfNotSet(self._pushed_at)
return self._pushed_at.value
@property
def releases_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._releases_url)
return self._releases_url.value
@property
def size(self):
"""
@@ -3273,6 +3297,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._created_at = github.GithubObject.NotSet
self._default_branch = github.GithubObject.NotSet
self._delete_branch_on_merge = github.GithubObject.NotSet
self._deployments_url = github.GithubObject.NotSet
self._description = github.GithubObject.NotSet
self._downloads_url = github.GithubObject.NotSet
self._events_url = github.GithubObject.NotSet
@@ -3287,6 +3312,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._git_url = github.GithubObject.NotSet
self._has_downloads = github.GithubObject.NotSet
self._has_issues = github.GithubObject.NotSet
self._has_pages = github.GithubObject.NotSet
self._has_projects = github.GithubObject.NotSet
self._has_wiki = github.GithubObject.NotSet
self._homepage = github.GithubObject.NotSet
@@ -3316,6 +3342,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._private = github.GithubObject.NotSet
self._pulls_url = github.GithubObject.NotSet
self._pushed_at = github.GithubObject.NotSet
self._releases_url = github.GithubObject.NotSet
self._size = github.GithubObject.NotSet
self._source = github.GithubObject.NotSet
self._ssh_url = github.GithubObject.NotSet
@@ -3386,6 +3413,10 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._delete_branch_on_merge = self._makeBoolAttribute(
attributes["delete_branch_on_merge"]
)
if "deployments_url" in attributes: # pragma no branch
self._deployments_url = self._makeStringAttribute(
attributes["deployments_url"]
)
if "description" in attributes: # pragma no branch
self._description = self._makeStringAttribute(attributes["description"])
if "downloads_url" in attributes: # pragma no branch
@@ -3416,6 +3447,8 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._has_downloads = self._makeBoolAttribute(attributes["has_downloads"])
if "has_issues" in attributes: # pragma no branch
self._has_issues = self._makeBoolAttribute(attributes["has_issues"])
if "has_pages" in attributes: # pragma no branch
self._has_pages = self._makeBoolAttribute(attributes["has_pages"])
if "has_projects" in attributes: # pragma no branch
self._has_projects = self._makeBoolAttribute(attributes["has_projects"])
if "has_wiki" in attributes: # pragma no branch
@@ -3490,6 +3523,8 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._pulls_url = self._makeStringAttribute(attributes["pulls_url"])
if "pushed_at" in attributes: # pragma no branch
self._pushed_at = self._makeDatetimeAttribute(attributes["pushed_at"])
if "releases_url" in attributes: # pragma no branch
self._releases_url = self._makeStringAttribute(attributes["releases_url"])
if "size" in attributes: # pragma no branch
self._size = self._makeIntAttribute(attributes["size"])
if "source" in attributes: # pragma no branch
+6
View File
@@ -193,6 +193,8 @@ class Repository:
author: Union[InputGitAuthor, _NotSetType] = ...,
) -> Dict[str, Union[Commit, _NotSetType]]: ...
@property
def deployments_url(self) -> str: ...
@property
def description(self) -> str: ...
def disable_automated_security_fixes(self) -> bool: ...
def disable_vulnerability_alert(self) -> bool: ...
@@ -381,6 +383,8 @@ class Repository:
@property
def has_issues(self) -> bool: ...
@property
def has_pages(self) -> bool: ...
@property
def has_projects(self) -> bool: ...
@property
def has_wiki(self) -> bool: ...
@@ -443,6 +447,8 @@ class Repository:
def pulls_url(self) -> str: ...
@property
def pushed_at(self) -> datetime: ...
@property
def releases_url(self) -> str: ...
def remove_from_collaborators(
self, collaborator: Union[str, NamedUser]
) -> None: ...