From b8b03c4fa8efcaff095770260eb26611c6f1098e Mon Sep 17 00:00:00 2001 From: Sarah Mount Date: Fri, 14 Oct 2022 19:30:10 +0100 Subject: [PATCH 1/3] FIX type stubs for Repository --- github/Repository.pyi | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/github/Repository.pyi b/github/Repository.pyi index 103fc8f1c7..ca0d1757dd 100644 --- a/github/Repository.pyi +++ b/github/Repository.pyi @@ -105,8 +105,8 @@ class Repository(CompletableGithubObject): def contributors_url(self) -> str: ... def create_check_run( self, - name: str = ..., - head_sha: str = ..., + name: str, + head_sha: str, details_url: Union[_NotSetType, str] = ..., external_id: Union[_NotSetType, str] = ..., status: Union[_NotSetType, str] = ..., @@ -213,7 +213,9 @@ class Repository(CompletableGithubObject): description: Union[str, _NotSetType] = ..., due_on: Union[date, _NotSetType] = ..., ) -> Milestone: ... - def create_project(self, name: str, body: str = ...) -> Project: ... + def create_project( + self, name: str, body: Union[str, _NotSetType] = ... + ) -> Project: ... @overload def create_pull( self, @@ -236,7 +238,7 @@ class Repository(CompletableGithubObject): issue: Issue, ) -> PullRequest: ... def create_repository_dispatch( - self, event_type: str, client_payload: Dict[str, Any] + self, event_type: str, client_payload: Union[Dict[str, Any], _NotSetType] = ... ) -> bool: ... def create_secret(self, secret_name: str, unencrypted_value: str) -> bool: ... def delete_secret(self, secret_name: str) -> bool: ... @@ -463,7 +465,13 @@ class Repository(CompletableGithubObject): def get_workflow(self, id_or_name: Union[str, int]) -> Workflow: ... def get_workflows(self) -> PaginatedList[Workflow]: ... def get_workflow_run(self, id_: int) -> WorkflowRun: ... - def get_workflow_runs(self) -> PaginatedList[WorkflowRun]: ... + def get_workflow_runs( + self, + actor: Union[NamedUser, _NotSetType] = ..., + branch: Union[Branch, _NotSetType] = ..., + event: Union[str, _NotSetType] = ..., + status: Union[str, _NotSetType] = ..., + ) -> PaginatedList[WorkflowRun]: ... def update_check_suites_preferences( self, auto_trigger_checks: List[Dict[str, Union[bool, int]]] ) -> RepositoryPreferences: ... @@ -496,6 +504,8 @@ class Repository(CompletableGithubObject): @property def id(self) -> int: ... @property + def is_template(self) -> bool: ... + @property def issue_comment_url(self) -> str: ... @property def issue_events_url(self) -> str: ... @@ -584,6 +594,8 @@ class Repository(CompletableGithubObject): @property def teams_url(self) -> str: ... @property + def topics(self) -> List[str]: ... + @property def trees_url(self) -> str: ... def unsubscribe_from_hub(self, event: str, callback: str) -> None: ... def update_file( @@ -601,6 +613,8 @@ class Repository(CompletableGithubObject): @property def url(self) -> str: ... @property + def visibility(self) -> str: ... + @property def watchers(self) -> int: ... @property def watchers_count(self) -> int: ... From ab080e7280441ad0f3a2a2e12bc5525e919ba322 Mon Sep 17 00:00:00 2001 From: Sarah Mount Date: Fri, 14 Oct 2022 19:45:18 +0100 Subject: [PATCH 2/3] FIX type stubs for Topic --- github/Topic.pyi | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/github/Topic.pyi b/github/Topic.pyi index ad62a839e1..f8a35a564f 100644 --- a/github/Topic.pyi +++ b/github/Topic.pyi @@ -1,3 +1,5 @@ +import datetime + from typing import Any, Dict from github.GithubObject import NonCompletableGithubObject @@ -7,10 +9,24 @@ class Topic(NonCompletableGithubObject): def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @property - def description(self) -> str: ... + def name(self) -> str: ... @property def display_name(self) -> str: ... @property - def name(self) -> str: ... - @property def short_description(self) -> str: ... + @property + def description(self) -> str: ... + @property + def created_by(self) -> str: ... + @property + def released(self) -> str: ... + @property + def created_at(self) -> datetime.datetime: ... + @property + def updated_at(self) -> datetime.datetime: ... + @property + def featured(self) -> bool: ... + @property + def curated(self) -> bool: ... + @property + def score(self) -> float: ... From 244243be332dc9dd964539c87e0b9ac4ab643130 Mon Sep 17 00:00:00 2001 From: Sarah Mount Date: Fri, 14 Oct 2022 19:51:19 +0100 Subject: [PATCH 3/3] FIX type stubs for Team --- github/Team.pyi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/github/Team.pyi b/github/Team.pyi index 2dafb9728b..5e9beaa749 100644 --- a/github/Team.pyi +++ b/github/Team.pyi @@ -5,6 +5,7 @@ from github.NamedUser import NamedUser from github.Organization import Organization from github.Membership import Membership from github.PaginatedList import PaginatedList +from github.Permissions import Permissions from github.Repository import Repository from github.TeamDiscussion import TeamDiscussion @@ -20,6 +21,10 @@ class Team(CompletableGithubObject): def add_to_members(self, member: NamedUser) -> None: ... def get_team_membership(self, member: Union[str, NamedUser]) -> Membership: ... def add_to_repos(self, repo: Repository) -> None: ... + def get_repo_permission( + self, repo: Repository + ) -> Union[Permissions, _NotSetType]: ... + def update_team_repository(self, repo: Repository, permission: str) -> bool: ... def delete(self) -> None: ... @property def description(self) -> str: ... @@ -30,6 +35,7 @@ class Team(CompletableGithubObject): permission: Union[str, _NotSetType] = ..., privacy: Union[str, _NotSetType] = ..., ) -> None: ... + def get_teams(self) -> PaginatedList[Team]: ... def get_discussions(self) -> PaginatedList[TeamDiscussion]: ... def get_members( self, role: Union[str, _NotSetType] = ... @@ -65,4 +71,6 @@ class Team(CompletableGithubObject): @property def url(self) -> str: ... @property + def parent(self) -> Union[Team, _NotSetType]: ... + @property def html_url(self) -> str: ...