Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync GitTree class with API spec #3132

Merged
merged 3 commits into from
Jan 8, 2025
Merged
Changes from 1 commit
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
Next Next commit
Updated class according to API spec
  • Loading branch information
EnricoMi committed Jan 8, 2025
commit 2fb973ff7995d87cccb7270b0d2de1bda343f0d8
8 changes: 8 additions & 0 deletions github/GitTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class GitTree(CompletableGithubObject):
def _initAttributes(self) -> None:
self._sha: Attribute[str] = NotSet
self._tree: Attribute[list[GitTreeElement]] = NotSet
self._truncated: Attribute[bool] = NotSet
self._url: Attribute[str] = NotSet

def __repr__(self) -> str:
Expand All @@ -86,6 +87,11 @@ def tree(self) -> list[GitTreeElement]:
self._completeIfNotSet(self._tree)
return self._tree.value

@property
def truncated(self) -> bool:
self._completeIfNotSet(self._truncated)
return self._truncated.value

@property
def url(self) -> str:
self._completeIfNotSet(self._url)
Expand All @@ -96,5 +102,7 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None:
self._sha = self._makeStringAttribute(attributes["sha"])
if "tree" in attributes: # pragma no branch
self._tree = self._makeListOfClassesAttribute(github.GitTreeElement.GitTreeElement, attributes["tree"])
if "truncated" in attributes: # pragma no branch
self._truncated = self._makeBoolAttribute(attributes["truncated"])
if "url" in attributes: # pragma no branch
self._url = self._makeStringAttribute(attributes["url"])