Skip to content

Commit

Permalink
Sync Repository class with API spec (#3156)
Browse files Browse the repository at this point in the history
Adds the following attributes:
- anonymous_access_enabled
- code_of_conduct
- disabled
- node_id
- role_name
- starred_at
- temp_clone_token
- template_repository
  • Loading branch information
EnricoMi authored Jan 9, 2025
1 parent db1e879 commit f03b316
Show file tree
Hide file tree
Showing 126 changed files with 576 additions and 446 deletions.
68 changes: 67 additions & 1 deletion github/Repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,9 @@ class Repository(CompletableGithubObject):
- /components/schemas/event/properties/repo
- /components/schemas/full-repository
- /components/schemas/minimal-repository
- /components/schemas/nullable-repository
- /components/schemas/pull-request-minimal/properties/base/properties/repo
- /components/schemas/pull-request-minimal/properties/head/properties/repo
- /components/schemas/repo-search-result-item
- /components/schemas/repository
- /components/schemas/simple-repository
Expand All @@ -340,12 +340,14 @@ def _initAttributes(self) -> None:
self._allow_rebase_merge: Attribute[bool] = NotSet
self._allow_squash_merge: Attribute[bool] = NotSet
self._allow_update_branch: Attribute[bool] = NotSet
self._anonymous_access_enabled: Attribute[bool] = NotSet
self._archive_url: Attribute[str] = NotSet
self._archived: Attribute[bool] = NotSet
self._assignees_url: Attribute[str] = NotSet
self._blobs_url: Attribute[str] = NotSet
self._branches_url: Attribute[str] = NotSet
self._clone_url: Attribute[str] = NotSet
self._code_of_conduct: Attribute[dict[str, Any]] = NotSet
self._collaborators_url: Attribute[str] = NotSet
self._comments_url: Attribute[str] = NotSet
self._commits_url: Attribute[str] = NotSet
Expand All @@ -358,6 +360,7 @@ def _initAttributes(self) -> None:
self._delete_branch_on_merge: Attribute[bool] = NotSet
self._deployments_url: Attribute[str] = NotSet
self._description: Attribute[str] = NotSet
self._disabled: Attribute[bool] = NotSet
self._downloads_url: Attribute[str] = NotSet
self._events_url: Attribute[str] = NotSet
self._fork: Attribute[bool] = NotSet
Expand Down Expand Up @@ -396,6 +399,7 @@ def _initAttributes(self) -> None:
self._mirror_url: Attribute[str] = NotSet
self._name: Attribute[str] = NotSet
self._network_count: Attribute[int] = NotSet
self._node_id: Attribute[str] = NotSet
self._notifications_url: Attribute[str] = NotSet
self._open_issues: Attribute[int] = NotSet
self._open_issues_count: Attribute[int] = NotSet
Expand All @@ -407,6 +411,7 @@ def _initAttributes(self) -> None:
self._pulls_url: Attribute[str] = NotSet
self._pushed_at: Attribute[datetime] = NotSet
self._releases_url: Attribute[str] = NotSet
self._role_name: Attribute[str] = NotSet
self._security_and_analysis: Attribute[SecurityAndAnalysis] = NotSet
self._size: Attribute[int] = NotSet
self._source: Attribute[Repository] = NotSet
Expand All @@ -415,13 +420,16 @@ def _initAttributes(self) -> None:
self._ssh_url: Attribute[str] = NotSet
self._stargazers_count: Attribute[int] = NotSet
self._stargazers_url: Attribute[str] = NotSet
self._starred_at: Attribute[str] = NotSet
self._statuses_url: Attribute[str] = NotSet
self._subscribers_count: Attribute[int] = NotSet
self._subscribers_url: Attribute[str] = NotSet
self._subscription_url: Attribute[str] = NotSet
self._svn_url: Attribute[str] = NotSet
self._tags_url: Attribute[str] = NotSet
self._teams_url: Attribute[str] = NotSet
self._temp_clone_token: Attribute[str] = NotSet
self._template_repository: Attribute[Repository] = NotSet
self._topics: Attribute[list[str]] = NotSet
self._trees_url: Attribute[str] = NotSet
self._updated_at: Attribute[datetime] = NotSet
Expand Down Expand Up @@ -487,6 +495,11 @@ def allow_update_branch(self) -> bool:
self._completeIfNotSet(self._allow_update_branch)
return self._allow_update_branch.value

@property
def anonymous_access_enabled(self) -> bool:
self._completeIfNotSet(self._anonymous_access_enabled)
return self._anonymous_access_enabled.value

@property
def archive_url(self) -> str:
"""
Expand Down Expand Up @@ -535,6 +548,11 @@ def clone_url(self) -> str:
self._completeIfNotSet(self._clone_url)
return self._clone_url.value

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

@property
def collaborators_url(self) -> str:
"""
Expand Down Expand Up @@ -631,6 +649,11 @@ def description(self) -> str:
self._completeIfNotSet(self._description)
return self._description.value

@property
def disabled(self) -> bool:
self._completeIfNotSet(self._disabled)
return self._disabled.value

@property
def downloads_url(self) -> str:
"""
Expand Down Expand Up @@ -929,6 +952,11 @@ def network_count(self) -> int:
self._completeIfNotSet(self._network_count)
return self._network_count.value

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

@property
def notifications_url(self) -> str:
"""
Expand Down Expand Up @@ -1017,6 +1045,11 @@ def releases_url(self) -> str:
self._completeIfNotSet(self._releases_url)
return self._releases_url.value

@property
def role_name(self) -> str:
self._completeIfNotSet(self._role_name)
return self._role_name.value

@property
def security_and_analysis(self) -> SecurityAndAnalysis:
"""
Expand Down Expand Up @@ -1081,6 +1114,11 @@ def stargazers_url(self) -> str:
self._completeIfNotSet(self._stargazers_url)
return self._stargazers_url.value

@property
def starred_at(self) -> str:
self._completeIfNotSet(self._starred_at)
return self._starred_at.value

@property
def statuses_url(self) -> str:
"""
Expand Down Expand Up @@ -1137,6 +1175,16 @@ def teams_url(self) -> str:
self._completeIfNotSet(self._teams_url)
return self._teams_url.value

@property
def temp_clone_token(self) -> str:
self._completeIfNotSet(self._temp_clone_token)
return self._temp_clone_token.value

@property
def template_repository(self) -> github.Repository.Repository:
self._completeIfNotSet(self._template_repository)
return self._template_repository.value

@property
def topics(self) -> list[str]:
"""
Expand Down Expand Up @@ -4344,6 +4392,8 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None:
self._allow_squash_merge = self._makeBoolAttribute(attributes["allow_squash_merge"])
if "allow_update_branch" in attributes: # pragma no branch
self._allow_update_branch = self._makeBoolAttribute(attributes["allow_update_branch"])
if "anonymous_access_enabled" in attributes: # pragma no branch
self._anonymous_access_enabled = self._makeBoolAttribute(attributes["anonymous_access_enabled"])
if "archive_url" in attributes: # pragma no branch
self._archive_url = self._makeStringAttribute(attributes["archive_url"])
if "archived" in attributes: # pragma no branch
Expand All @@ -4356,6 +4406,8 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None:
self._branches_url = self._makeStringAttribute(attributes["branches_url"])
if "clone_url" in attributes: # pragma no branch
self._clone_url = self._makeStringAttribute(attributes["clone_url"])
if "code_of_conduct" in attributes: # pragma no branch
self._code_of_conduct = self._makeDictAttribute(attributes["code_of_conduct"])
if "collaborators_url" in attributes: # pragma no branch
self._collaborators_url = self._makeStringAttribute(attributes["collaborators_url"])
if "comments_url" in attributes: # pragma no branch
Expand All @@ -4380,6 +4432,8 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None:
self._deployments_url = self._makeStringAttribute(attributes["deployments_url"])
if "description" in attributes: # pragma no branch
self._description = self._makeStringAttribute(attributes["description"])
if "disabled" in attributes: # pragma no branch
self._disabled = self._makeBoolAttribute(attributes["disabled"])
if "downloads_url" in attributes: # pragma no branch
self._downloads_url = self._makeStringAttribute(attributes["downloads_url"])
if "events_url" in attributes: # pragma no branch
Expand Down Expand Up @@ -4456,6 +4510,8 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None:
self._name = self._makeStringAttribute(attributes["name"])
if "network_count" in attributes: # pragma no branch
self._network_count = self._makeIntAttribute(attributes["network_count"])
if "node_id" in attributes: # pragma no branch
self._node_id = self._makeStringAttribute(attributes["node_id"])
if "notifications_url" in attributes: # pragma no branch
self._notifications_url = self._makeStringAttribute(attributes["notifications_url"])
if "open_issues" in attributes: # pragma no branch
Expand All @@ -4478,6 +4534,8 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None:
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 "role_name" in attributes: # pragma no branch
self._role_name = self._makeStringAttribute(attributes["role_name"])
if "security_and_analysis" in attributes: # pragma no branch
self._security_and_analysis = self._makeClassAttribute(
github.SecurityAndAnalysis.SecurityAndAnalysis, attributes["security_and_analysis"]
Expand All @@ -4496,6 +4554,8 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None:
self._stargazers_count = self._makeIntAttribute(attributes["stargazers_count"])
if "stargazers_url" in attributes: # pragma no branch
self._stargazers_url = self._makeStringAttribute(attributes["stargazers_url"])
if "starred_at" in attributes: # pragma no branch
self._starred_at = self._makeStringAttribute(attributes["starred_at"])
if "statuses_url" in attributes: # pragma no branch
self._statuses_url = self._makeStringAttribute(attributes["statuses_url"])
if "subscribers_count" in attributes: # pragma no branch
Expand All @@ -4510,6 +4570,12 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None:
self._tags_url = self._makeStringAttribute(attributes["tags_url"])
if "teams_url" in attributes: # pragma no branch
self._teams_url = self._makeStringAttribute(attributes["teams_url"])
if "temp_clone_token" in attributes: # pragma no branch
self._temp_clone_token = self._makeStringAttribute(attributes["temp_clone_token"])
if "template_repository" in attributes: # pragma no branch
self._template_repository = self._makeClassAttribute(
github.Repository.Repository, attributes["template_repository"]
)
if "topics" in attributes: # pragma no branch
self._topics = self._makeListOfStringsAttribute(attributes["topics"])
if "trees_url" in attributes: # pragma no branch
Expand Down
10 changes: 0 additions & 10 deletions tests/ReplayData/LazyRepository.setUp.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ https
PUT
api.github.com
None
/repos/korfuri/PyGithub/automated-security-fixes
/repos/PyGithub/PyGithub/automated-security-fixes
{'Accept': 'application/vnd.github.london-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
None
422
Expand All @@ -13,7 +13,7 @@ https
DELETE
api.github.com
None
/repos/korfuri/PyGithub/automated-security-fixes
/repos/PyGithub/PyGithub/automated-security-fixes
{'Accept': 'application/vnd.github.london-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
None
422
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ https
DELETE
api.github.com
None
/repos/korfuri/PyGithub/automated-security-fixes
/repos/PyGithub/PyGithub/automated-security-fixes
{'Accept': 'application/vnd.github.london-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
None
204
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ https
DELETE
api.github.com
None
/repos/korfuri/PyGithub/vulnerability-alerts
/repos/PyGithub/PyGithub/vulnerability-alerts
{'Accept': 'application/vnd.github.dorian-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
None
204
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ https
PUT
api.github.com
None
/repos/korfuri/PyGithub/automated-security-fixes
/repos/PyGithub/PyGithub/automated-security-fixes
{'Accept': 'application/vnd.github.london-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
None
204
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ https
PUT
api.github.com
None
/repos/korfuri/PyGithub/vulnerability-alerts
/repos/PyGithub/PyGithub/vulnerability-alerts
{'Accept': 'application/vnd.github.dorian-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
None
204
Expand Down
Loading

0 comments on commit f03b316

Please sign in to comment.