Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions github/GitCommit.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@
from __future__ import annotations

from datetime import datetime
from typing import Any
from typing import TYPE_CHECKING, Any

import github.GitAuthor
import github.GithubObject
import github.GitTree
from github.GithubObject import Attribute, CompletableGithubObject, NotSet
from github.GithubObject import Attribute, CompletableGithubObject, NotSet, is_defined, is_undefined

if TYPE_CHECKING:
from github.GitAuthor import GitAuthor
from github.GitTree import GitTree


class GitCommit(CompletableGithubObject):
Expand All @@ -68,17 +71,17 @@ class GitCommit(CompletableGithubObject):
"""

def _initAttributes(self) -> None:
self._author: Attribute[github.GitAuthor.GitAuthor] = NotSet
self._author: Attribute[GitAuthor] = NotSet
self._comment_count: Attribute[int] = NotSet
self._committer: Attribute[github.GitAuthor.GitAuthor] = NotSet
self._committer: Attribute[GitAuthor] = NotSet
self._html_url: Attribute[str] = NotSet
self._id: Attribute[str] = NotSet
self._message: Attribute[str] = NotSet
self._node_id: Attribute[str] = NotSet
self._parents: Attribute[list[GitCommit]] = NotSet
self._sha: Attribute[str] = NotSet
self._timestamp: Attribute[datetime] = NotSet
self._tree: Attribute[github.GitTree.GitTree] = NotSet
self._tree: Attribute[GitTree] = NotSet
self._tree_id: Attribute[str] = NotSet
self._url: Attribute[str] = NotSet
self._verification: Attribute[dict[str, Any]] = NotSet
Expand All @@ -91,7 +94,7 @@ def _identity(self) -> str:
return self.sha

@property
def author(self) -> github.GitAuthor.GitAuthor:
def author(self) -> GitAuthor:
self._completeIfNotSet(self._author)
return self._author.value

Expand All @@ -101,7 +104,7 @@ def comment_count(self) -> int:
return self._comment_count.value

@property
def committer(self) -> github.GitAuthor.GitAuthor:
def committer(self) -> GitAuthor:
self._completeIfNotSet(self._committer)
return self._committer.value

Expand Down Expand Up @@ -132,6 +135,9 @@ def parents(self) -> list[GitCommit]:

@property
def sha(self) -> str:
# if populated from a simple-commit, id actually holds the sha
if is_undefined(self._sha) and is_defined(self._id):
return self._id.value
self._completeIfNotSet(self._sha)
return self._sha.value

Expand All @@ -141,7 +147,10 @@ def timestamp(self) -> datetime:
return self._timestamp.value

@property
def tree(self) -> github.GitTree.GitTree:
def tree(self) -> GitTree:
# if populated from a simple-commit, tree_id holds the sha
if is_undefined(self._tree) and is_defined(self._tree_id):
return github.GitTree.GitTree(self._requester, self._headers, {"sha": self._tree_id.value})
self._completeIfNotSet(self._tree)
return self._tree.value

Expand Down
86 changes: 86 additions & 0 deletions github/GitRelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,26 @@ class GitRelease(CompletableGithubObject):

def _initAttributes(self) -> None:
self._assets: Attribute[list[github.GitReleaseAsset.GitReleaseAsset]] = NotSet
self._assets_url: Attribute[str] = NotSet
self._author: Attribute[github.NamedUser.NamedUser] = NotSet
self._body: Attribute[str] = NotSet
self._body_html: Attribute[str] = NotSet
self._body_text: Attribute[str] = NotSet
self._created_at: Attribute[datetime] = NotSet
self._discussion_url: Attribute[str] = NotSet
self._documentation_url: Attribute[str] = NotSet
self._draft: Attribute[bool] = NotSet
self._generate_release_notes: Attribute[bool] = NotSet
self._html_url: Attribute[str] = NotSet
self._id: Attribute[int] = NotSet
self._mentions_count: Attribute[int] = NotSet
self._message: Attribute[str] = NotSet
self._name: Attribute[str] = NotSet
self._node_id: Attribute[str] = NotSet
self._prerelease: Attribute[bool] = NotSet
self._published_at: Attribute[datetime] = NotSet
self._reactions: Attribute[dict[str, Any]] = NotSet
self._status: Attribute[str] = NotSet
self._tag_name: Attribute[str] = NotSet
self._tarball_url: Attribute[str] = NotSet
self._target_commitish: Attribute[str] = NotSet
Expand All @@ -109,6 +120,11 @@ def assets(self) -> list[github.GitReleaseAsset.GitReleaseAsset]:
self._completeIfNotSet(self._assets)
return self._assets.value

@property
def assets_url(self) -> str:
self._completeIfNotSet(self._assets_url)
return self._assets_url.value

@property
def author(self) -> github.NamedUser.NamedUser:
self._completeIfNotSet(self._author)
Expand All @@ -119,11 +135,31 @@ def body(self) -> str:
self._completeIfNotSet(self._body)
return self._body.value

@property
def body_html(self) -> str:
self._completeIfNotSet(self._body_html)
return self._body_html.value

@property
def body_text(self) -> str:
self._completeIfNotSet(self._body_text)
return self._body_text.value

@property
def created_at(self) -> datetime:
self._completeIfNotSet(self._created_at)
return self._created_at.value

@property
def discussion_url(self) -> str:
self._completeIfNotSet(self._discussion_url)
return self._discussion_url.value

@property
def documentation_url(self) -> str:
self._completeIfNotSet(self._documentation_url)
return self._documentation_url.value

@property
def draft(self) -> bool:
self._completeIfNotSet(self._draft)
Expand All @@ -139,6 +175,26 @@ def id(self) -> int:
self._completeIfNotSet(self._id)
return self._id.value

@property
def mentions_count(self) -> int:
self._completeIfNotSet(self._mentions_count)
return self._mentions_count.value

@property
def message(self) -> str:
self._completeIfNotSet(self._message)
return self._message.value

@property
def name(self) -> str:
self._completeIfNotSet(self._name)
return self._name.value

@property
def node_id(self) -> str:
self._completeIfNotSet(self._node_id)
return self._node_id.value

@property
def prerelease(self) -> bool:
self._completeIfNotSet(self._prerelease)
Expand All @@ -149,6 +205,16 @@ def published_at(self) -> datetime:
self._completeIfNotSet(self._published_at)
return self._published_at.value

@property
def reactions(self) -> dict[str, Any]:
self._completeIfNotSet(self._reactions)
return self._reactions.value

@property
def status(self) -> str:
self._completeIfNotSet(self._status)
return self._status.value

@property
def tag_name(self) -> str:
self._completeIfNotSet(self._tag_name)
Expand Down Expand Up @@ -311,12 +377,22 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None:
self._assets = self._makeListOfClassesAttribute(
github.GitReleaseAsset.GitReleaseAsset, attributes["assets"]
)
if "assets_url" in attributes: # pragma no branch
self._assets_url = self._makeStringAttribute(attributes["assets_url"])
if "author" in attributes:
self._author = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["author"])
if "body" in attributes:
self._body = self._makeStringAttribute(attributes["body"])
if "body_html" in attributes: # pragma no branch
self._body_html = self._makeStringAttribute(attributes["body_html"])
if "body_text" in attributes: # pragma no branch
self._body_text = self._makeStringAttribute(attributes["body_text"])
if "created_at" in attributes:
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
if "discussion_url" in attributes: # pragma no branch
self._discussion_url = self._makeStringAttribute(attributes["discussion_url"])
if "documentation_url" in attributes: # pragma no branch
self._documentation_url = self._makeStringAttribute(attributes["documentation_url"])
if "draft" in attributes:
self._draft = self._makeBoolAttribute(attributes["draft"])
if "generate_release_notes" in attributes:
Expand All @@ -325,12 +401,22 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None:
self._html_url = self._makeStringAttribute(attributes["html_url"])
if "id" in attributes:
self._id = self._makeIntAttribute(attributes["id"])
if "mentions_count" in attributes: # pragma no branch
self._mentions_count = self._makeIntAttribute(attributes["mentions_count"])
if "message" in attributes: # pragma no branch
self._message = self._makeStringAttribute(attributes["message"])
if "name" in attributes:
self._title = self._makeStringAttribute(attributes["name"])
if "node_id" in attributes: # pragma no branch
self._node_id = self._makeStringAttribute(attributes["node_id"])
if "prerelease" in attributes:
self._prerelease = self._makeBoolAttribute(attributes["prerelease"])
if "published_at" in attributes:
self._published_at = self._makeDatetimeAttribute(attributes["published_at"])
if "reactions" in attributes: # pragma no branch
self._reactions = self._makeDictAttribute(attributes["reactions"])
if "status" in attributes: # pragma no branch
self._status = self._makeStringAttribute(attributes["status"])
if "tag_name" in attributes:
self._tag_name = self._makeStringAttribute(attributes["tag_name"])
if "tarball_url" in attributes:
Expand Down
8 changes: 8 additions & 0 deletions github/GitReleaseAsset.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def _initAttributes(self) -> None:
self._id: Attribute[int] = NotSet
self._label: Attribute[str] = NotSet
self._name: Attribute[str] = NotSet
self._node_id: Attribute[str] = NotSet
self._size: Attribute[int] = NotSet
self._state: Attribute[str] = NotSet
self._updated_at: Attribute[datetime] = NotSet
Expand Down Expand Up @@ -112,6 +113,11 @@ def name(self) -> str:
self._completeIfNotSet(self._name)
return self._name.value

@property
def node_id(self) -> str:
self._completeIfNotSet(self._node_id)
return self._node_id.value

@property
def size(self) -> int:
self._completeIfNotSet(self._size)
Expand Down Expand Up @@ -169,6 +175,8 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None:
self._label = self._makeStringAttribute(attributes["label"])
if "name" in attributes: # pragma no branch
self._name = self._makeStringAttribute(attributes["name"])
if "node_id" in attributes: # pragma no branch
self._node_id = self._makeStringAttribute(attributes["node_id"])
if "size" in attributes: # pragma no branch
self._size = self._makeIntAttribute(attributes["size"])
if "state" in attributes: # pragma no branch
Expand Down
16 changes: 16 additions & 0 deletions github/Invitation.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ class Invitation(CompletableGithubObject):

def _initAttributes(self) -> None:
self._created_at: Attribute[datetime] = NotSet
self._expired: Attribute[bool] = NotSet
self._html_url: Attribute[str] = NotSet
self._id: Attribute[int] = NotSet
self._invitee: Attribute[NamedUser] = NotSet
self._inviter: Attribute[NamedUser] = NotSet
self._node_id: Attribute[str] = NotSet
self._permissions: Attribute[str] = NotSet
self._repository: Attribute[Repository] = NotSet
self._url: Attribute[str] = NotSet
Expand All @@ -83,6 +85,11 @@ def created_at(self) -> datetime:
self._completeIfNotSet(self._created_at)
return self._created_at.value

@property
def expired(self) -> bool:
self._completeIfNotSet(self._expired)
return self._expired.value

@property
def html_url(self) -> str:
self._completeIfNotSet(self._html_url)
Expand All @@ -103,6 +110,11 @@ def inviter(self) -> NamedUser:
self._completeIfNotSet(self._inviter)
return self._inviter.value

@property
def node_id(self) -> str:
self._completeIfNotSet(self._node_id)
return self._node_id.value

@property
def permissions(self) -> str:
self._completeIfNotSet(self._permissions)
Expand All @@ -121,6 +133,8 @@ def url(self) -> str:
def _useAttributes(self, attributes: dict[str, Any]) -> None:
if "created_at" in attributes: # pragma no branch
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
if "expired" in attributes: # pragma no branch
self._expired = self._makeBoolAttribute(attributes["expired"])
if "html_url" in attributes: # pragma no branch
self._html_url = self._makeStringAttribute(attributes["html_url"])
if "id" in attributes: # pragma no branch
Expand All @@ -129,6 +143,8 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None:
self._invitee = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["invitee"])
if "inviter" in attributes: # pragma no branch
self._inviter = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["inviter"])
if "node_id" in attributes: # pragma no branch
self._node_id = self._makeStringAttribute(attributes["node_id"])

if "permissions" in attributes: # pragma no branch
self._permissions = self._makeStringAttribute(attributes["permissions"])
Expand Down
Loading