diff --git a/github/AuthenticatedUser.pyi b/github/AuthenticatedUser.pyi index 5dbf3ec0..3a8e7da7 100644 --- a/github/AuthenticatedUser.pyi +++ b/github/AuthenticatedUser.pyi @@ -2,10 +2,12 @@ from datetime import datetime from typing import Any, Dict, List, Optional, Union from github.Authorization import Authorization +from github.Event import Event from github.Gist import Gist -from github.GithubObject import _NotSetType +from github.GithubObject import CompletableGithubObject, _NotSetType from github.InputFileContent import InputFileContent from github.Invitation import Invitation +from github.Issue import Issue from github.Label import Label from github.Membership import Membership from github.Migration import Migration @@ -15,9 +17,10 @@ from github.Organization import Organization from github.PaginatedList import PaginatedList from github.Plan import Plan from github.Repository import Repository +from github.Team import Team from github.UserKey import UserKey -class AuthenticatedUser: +class AuthenticatedUser(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @@ -104,13 +107,15 @@ class AuthenticatedUser: @property def following_url(self) -> str: ... def get_authorization(self, id: int) -> Authorization: ... - def get_authorizations(self) -> PaginatedList: ... + def get_authorizations(self) -> PaginatedList[Authorization]: ... def get_emails(self) -> List[str]: ... - def get_events(self) -> PaginatedList: ... - def get_followers(self) -> PaginatedList: ... - def get_following(self) -> PaginatedList: ... - def get_gists(self, since: Union[datetime, _NotSetType] = ...) -> PaginatedList: ... - def get_invitations(self) -> PaginatedList: ... + def get_events(self) -> PaginatedList[Event]: ... + def get_followers(self) -> PaginatedList[NamedUser]: ... + def get_following(self) -> PaginatedList[NamedUser]: ... + def get_gists( + self, since: Union[datetime, _NotSetType] = ... + ) -> PaginatedList[Gist]: ... + def get_invitations(self) -> PaginatedList[Invitation]: ... def get_issues( self, filter: Union[str, _NotSetType] = ..., @@ -119,10 +124,10 @@ class AuthenticatedUser: sort: Union[str, _NotSetType] = ..., direction: Union[str, _NotSetType] = ..., since: Union[_NotSetType, datetime] = ..., - ) -> PaginatedList: ... + ) -> PaginatedList[Issue]: ... def get_key(self, id: int) -> UserKey: ... - def get_keys(self) -> PaginatedList: ... - def get_migrations(self) -> PaginatedList: ... + def get_keys(self) -> PaginatedList[UserKey]: ... + def get_migrations(self) -> PaginatedList[Migration]: ... def get_notification(self, id: str) -> Notification: ... def get_notifications( self, @@ -130,10 +135,10 @@ class AuthenticatedUser: participating: Union[bool, _NotSetType] = ..., since: Union[datetime, _NotSetType] = ..., before: Union[datetime, _NotSetType] = ..., - ) -> PaginatedList: ... - def get_organization_events(self, org: Organization) -> PaginatedList: ... + ) -> PaginatedList[Notification]: ... + def get_organization_events(self, org: Organization) -> PaginatedList[Event]: ... def get_organization_membership(self, org: int) -> Membership: ... - def get_orgs(self) -> PaginatedList: ... + def get_orgs(self) -> PaginatedList[Organization]: ... def get_repo(self, name: str) -> Repository: ... def get_repos( self, @@ -142,11 +147,11 @@ class AuthenticatedUser: type: Union[str, _NotSetType] = ..., sort: Union[str, _NotSetType] = ..., direction: Union[str, _NotSetType] = ..., - ) -> PaginatedList: ... - def get_starred(self) -> PaginatedList: ... - def get_starred_gists(self) -> PaginatedList: ... - def get_subscriptions(self) -> PaginatedList: ... - def get_teams(self) -> PaginatedList: ... + ) -> PaginatedList[Repository]: ... + def get_starred(self) -> PaginatedList[Repository]: ... + def get_starred_gists(self) -> PaginatedList[Gist]: ... + def get_subscriptions(self) -> PaginatedList[Repository]: ... + def get_teams(self) -> PaginatedList[Team]: ... def get_user_issues( self, filter: Union[str, _NotSetType] = ..., @@ -155,8 +160,8 @@ class AuthenticatedUser: sort: Union[str, _NotSetType] = ..., direction: Union[str, _NotSetType] = ..., since: Union[_NotSetType, datetime] = ..., - ) -> PaginatedList: ... - def get_watched(self) -> PaginatedList: ... + ) -> PaginatedList[Issue]: ... + def get_watched(self) -> PaginatedList[Repository]: ... @property def gists_url(self) -> str: ... @property diff --git a/github/Authorization.pyi b/github/Authorization.pyi index bfbdce16..059485ce 100644 --- a/github/Authorization.pyi +++ b/github/Authorization.pyi @@ -2,9 +2,9 @@ from datetime import datetime from typing import Any, Dict, List, Optional, Union from github.AuthorizationApplication import AuthorizationApplication -from github.GithubObject import _NotSetType +from github.GithubObject import CompletableGithubObject, _NotSetType -class Authorization: +class Authorization(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/AuthorizationApplication.pyi b/github/AuthorizationApplication.pyi index de96a899..f4537902 100644 --- a/github/AuthorizationApplication.pyi +++ b/github/AuthorizationApplication.pyi @@ -1,6 +1,8 @@ from typing import Dict -class AuthorizationApplication: +from github.GithubObject import CompletableGithubObject + +class AuthorizationApplication(CompletableGithubObject): def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, str]) -> None: ... @property diff --git a/github/Branch.pyi b/github/Branch.pyi index 6ed014ae..6f6def2d 100644 --- a/github/Branch.pyi +++ b/github/Branch.pyi @@ -2,12 +2,14 @@ from typing import Any, Dict, List, Union from github.BranchProtection import BranchProtection from github.Commit import Commit -from github.GithubObject import _NotSetType +from github.GithubObject import NonCompletableGithubObject, _NotSetType +from github.NamedUser import NamedUser from github.PaginatedList import PaginatedList from github.RequiredPullRequestReviews import RequiredPullRequestReviews from github.RequiredStatusChecks import RequiredStatusChecks +from github.Team import Team -class Branch: +class Branch(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @@ -47,8 +49,8 @@ class Branch: def get_required_pull_request_reviews(self) -> RequiredPullRequestReviews: ... def get_required_signatures(self) -> bool: ... def get_required_status_checks(self) -> RequiredStatusChecks: ... - def get_team_push_restrictions(self) -> PaginatedList: ... - def get_user_push_restrictions(self) -> PaginatedList: ... + def get_team_push_restrictions(self) -> PaginatedList[Team]: ... + def get_user_push_restrictions(self) -> PaginatedList[NamedUser]: ... @property def name(self) -> str: ... @property diff --git a/github/BranchProtection.pyi b/github/BranchProtection.pyi index d1cf250c..5563554c 100644 --- a/github/BranchProtection.pyi +++ b/github/BranchProtection.pyi @@ -1,17 +1,20 @@ from typing import Any, Dict +from github.GithubObject import CompletableGithubObject +from github.NamedUser import NamedUser from github.PaginatedList import PaginatedList from github.RequiredPullRequestReviews import RequiredPullRequestReviews from github.RequiredStatusChecks import RequiredStatusChecks +from github.Team import Team -class BranchProtection: +class BranchProtection(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @property def enforce_admins(self) -> bool: ... - def get_team_push_restrictions(self) -> PaginatedList: ... - def get_user_push_restrictions(self) -> PaginatedList: ... + def get_team_push_restrictions(self) -> PaginatedList[NamedUser]: ... + def get_user_push_restrictions(self) -> PaginatedList[Team]: ... @property def required_pull_request_reviews(self) -> RequiredPullRequestReviews: ... @property diff --git a/github/Clones.pyi b/github/Clones.pyi index d990facb..4e53c125 100644 --- a/github/Clones.pyi +++ b/github/Clones.pyi @@ -1,7 +1,9 @@ from datetime import datetime from typing import Any, Dict -class Clones: +from github.GithubObject import NonCompletableGithubObject + +class Clones(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Commit.pyi b/github/Commit.pyi index 3d9cefb6..56f88b0b 100644 --- a/github/Commit.pyi +++ b/github/Commit.pyi @@ -6,11 +6,11 @@ from github.CommitStats import CommitStats from github.CommitStatus import CommitStatus from github.File import File from github.GitCommit import GitCommit -from github.GithubObject import _NotSetType +from github.GithubObject import CompletableGithubObject, _NotSetType from github.NamedUser import NamedUser from github.PaginatedList import PaginatedList -class Commit: +class Commit(CompletableGithubObject): def __repr__(self) -> str: ... @property def _identity(self) -> str: ... @@ -41,8 +41,8 @@ class Commit: @property def files(self) -> List[File]: ... def get_combined_status(self) -> CommitCombinedStatus: ... - def get_comments(self) -> PaginatedList: ... - def get_statuses(self) -> PaginatedList: ... + def get_comments(self) -> PaginatedList[GitCommit]: ... + def get_statuses(self) -> PaginatedList[CommitStatus]: ... @property def html_url(self) -> str: ... @property diff --git a/github/CommitCombinedStatus.pyi b/github/CommitCombinedStatus.pyi index 5239c093..65818c8e 100644 --- a/github/CommitCombinedStatus.pyi +++ b/github/CommitCombinedStatus.pyi @@ -1,9 +1,10 @@ from typing import Any, Dict, List from github.CommitStatus import CommitStatus +from github.GithubObject import NonCompletableGithubObject from github.Repository import Repository -class CommitCombinedStatus: +class CommitCombinedStatus(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/CommitComment.pyi b/github/CommitComment.pyi index 8677bb6f..4078950a 100644 --- a/github/CommitComment.pyi +++ b/github/CommitComment.pyi @@ -1,11 +1,12 @@ from datetime import datetime from typing import Any, Dict, Optional +from github.GithubObject import CompletableGithubObject from github.NamedUser import NamedUser from github.PaginatedList import PaginatedList from github.Reaction import Reaction -class CommitComment: +class CommitComment(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @@ -18,7 +19,7 @@ class CommitComment: def created_at(self) -> datetime: ... def delete(self) -> None: ... def edit(self, body: str) -> None: ... - def get_reactions(self) -> PaginatedList: ... + def get_reactions(self) -> PaginatedList[Reaction]: ... @property def html_url(self) -> str: ... @property diff --git a/github/CommitStats.pyi b/github/CommitStats.pyi index 80f86d53..c6695932 100644 --- a/github/CommitStats.pyi +++ b/github/CommitStats.pyi @@ -1,6 +1,8 @@ from typing import Dict -class CommitStats: +from github.GithubObject import NonCompletableGithubObject + +class CommitStats(NonCompletableGithubObject): def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, int]) -> None: ... @property diff --git a/github/CommitStatus.pyi b/github/CommitStatus.pyi index f9847ac6..41f7c288 100644 --- a/github/CommitStatus.pyi +++ b/github/CommitStatus.pyi @@ -1,9 +1,10 @@ from datetime import datetime from typing import Any, Dict, Optional +from github.GithubObject import NonCompletableGithubObject from github.NamedUser import NamedUser -class CommitStatus: +class CommitStatus(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Comparison.pyi b/github/Comparison.pyi index 3d90e2e0..03c8f831 100644 --- a/github/Comparison.pyi +++ b/github/Comparison.pyi @@ -2,8 +2,9 @@ from typing import Any, Dict, List from github.Commit import Commit from github.File import File +from github.GithubObject import CompletableGithubObject -class Comparison: +class Comparison(CompletableGithubObject): def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @property diff --git a/github/ContentFile.pyi b/github/ContentFile.pyi index 4e455607..7f2f6c08 100644 --- a/github/ContentFile.pyi +++ b/github/ContentFile.pyi @@ -1,9 +1,10 @@ from typing import Any, Dict, List, Optional +from github.GithubObject import CompletableGithubObject from github.License import License from github.Repository import Repository -class ContentFile: +class ContentFile(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Deployment.pyi b/github/Deployment.pyi index c76a146a..ce4ddea0 100644 --- a/github/Deployment.pyi +++ b/github/Deployment.pyi @@ -1,9 +1,10 @@ from datetime import datetime from typing import Any, Dict +from github.GithubObject import CompletableGithubObject from github.NamedUser import NamedUser -class Deployment: +class Deployment(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Download.pyi b/github/Download.pyi index 85c345b8..bf1b4132 100644 --- a/github/Download.pyi +++ b/github/Download.pyi @@ -1,7 +1,9 @@ from datetime import datetime from typing import Any, Dict, Optional -class Download: +from github.GithubObject import CompletableGithubObject + +class Download(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Event.pyi b/github/Event.pyi index 68ef9246..a32dffb7 100644 --- a/github/Event.pyi +++ b/github/Event.pyi @@ -1,11 +1,12 @@ from datetime import datetime from typing import Any, Dict +from github.GithubObject import NonCompletableGithubObject from github.NamedUser import NamedUser from github.Organization import Organization from github.Repository import Repository -class Event: +class Event(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/File.pyi b/github/File.pyi index a17cb0fa..83097c36 100644 --- a/github/File.pyi +++ b/github/File.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict -class File: +from github.GithubObject import NonCompletableGithubObject + +class File(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Gist.pyi b/github/Gist.pyi index 60217887..833e0bac 100644 --- a/github/Gist.pyi +++ b/github/Gist.pyi @@ -4,12 +4,12 @@ from typing import Any, Dict, List, Optional, Union from github.GistComment import GistComment from github.GistFile import GistFile from github.GistHistoryState import GistHistoryState -from github.GithubObject import _NotSetType +from github.GithubObject import CompletableGithubObject, _NotSetType from github.InputFileContent import InputFileContent from github.NamedUser import NamedUser from github.PaginatedList import PaginatedList -class Gist: +class Gist(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @@ -40,7 +40,7 @@ class Gist: @property def forks_url(self) -> str: ... def get_comment(self, id: int) -> GistComment: ... - def get_comments(self) -> PaginatedList: ... + def get_comments(self) -> PaginatedList[GistComment]: ... @property def git_pull_url(self) -> str: ... @property diff --git a/github/GistComment.pyi b/github/GistComment.pyi index c418007f..ff818b8f 100644 --- a/github/GistComment.pyi +++ b/github/GistComment.pyi @@ -1,9 +1,10 @@ from datetime import datetime from typing import Any, Dict +from github.GithubObject import CompletableGithubObject from github.NamedUser import NamedUser -class GistComment: +class GistComment(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/GistFile.pyi b/github/GistFile.pyi index 53d0c41b..4f310dad 100644 --- a/github/GistFile.pyi +++ b/github/GistFile.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict, Optional -class GistFile: +from github.GithubObject import NonCompletableGithubObject + +class GistFile(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/GistHistoryState.pyi b/github/GistHistoryState.pyi index 7aa24d19..cdae6623 100644 --- a/github/GistHistoryState.pyi +++ b/github/GistHistoryState.pyi @@ -4,9 +4,10 @@ from typing import Any, Dict, List, Optional from github.CommitStats import CommitStats from github.Gist import Gist from github.GistFile import GistFile +from github.GithubObject import CompletableGithubObject from github.NamedUser import NamedUser -class GistHistoryState: +class GistHistoryState(CompletableGithubObject): def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @property diff --git a/github/GitAuthor.pyi b/github/GitAuthor.pyi index 761c7f39..f677afeb 100644 --- a/github/GitAuthor.pyi +++ b/github/GitAuthor.pyi @@ -1,7 +1,9 @@ from datetime import datetime from typing import Dict -class GitAuthor: +from github.GithubObject import NonCompletableGithubObject + +class GitAuthor(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, str]) -> None: ... diff --git a/github/GitBlob.pyi b/github/GitBlob.pyi index 18c4106d..b3cc89c6 100644 --- a/github/GitBlob.pyi +++ b/github/GitBlob.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict -class GitBlob: +from github.GithubObject import CompletableGithubObject + +class GitBlob(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/GitCommit.pyi b/github/GitCommit.pyi index fdcab79d..360f91a2 100644 --- a/github/GitCommit.pyi +++ b/github/GitCommit.pyi @@ -1,9 +1,10 @@ from typing import Any, Dict, List from github.GitAuthor import GitAuthor +from github.GithubObject import CompletableGithubObject from github.GitTree import GitTree -class GitCommit: +class GitCommit(CompletableGithubObject): def __repr__(self) -> str: ... @property def _identity(self) -> str: ... diff --git a/github/GitObject.pyi b/github/GitObject.pyi index 8638dae6..a94b6bdb 100644 --- a/github/GitObject.pyi +++ b/github/GitObject.pyi @@ -1,6 +1,8 @@ from typing import Dict -class GitObject: +from github.GithubObject import NonCompletableGithubObject + +class GitObject(NonCompletableGithubObject): def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, str]) -> None: ... @property diff --git a/github/GitRef.pyi b/github/GitRef.pyi index 05cda2dc..09c07c37 100644 --- a/github/GitRef.pyi +++ b/github/GitRef.pyi @@ -1,9 +1,9 @@ from typing import Any, Dict, Union -from github.GithubObject import _NotSetType +from github.GithubObject import CompletableGithubObject, _NotSetType from github.GitObject import GitObject -class GitRef: +class GitRef(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/GitRelease.pyi b/github/GitRelease.pyi index 6976cd06..d6f292cd 100644 --- a/github/GitRelease.pyi +++ b/github/GitRelease.pyi @@ -1,12 +1,12 @@ from datetime import datetime from typing import Any, Dict, Union -from github.GithubObject import _NotSetType +from github.GithubObject import CompletableGithubObject, _NotSetType from github.GitReleaseAsset import GitReleaseAsset from github.NamedUser import NamedUser from github.PaginatedList import PaginatedList -class GitRelease: +class GitRelease(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @@ -19,7 +19,7 @@ class GitRelease: def delete_release(self) -> None: ... @property def draft(self) -> bool: ... - def get_assets(self) -> PaginatedList: ... + def get_assets(self) -> PaginatedList[GitReleaseAsset]: ... @property def html_url(self) -> str: ... @property diff --git a/github/GitReleaseAsset.pyi b/github/GitReleaseAsset.pyi index 5df10de8..d00cdb97 100644 --- a/github/GitReleaseAsset.pyi +++ b/github/GitReleaseAsset.pyi @@ -1,9 +1,10 @@ from datetime import datetime from typing import Any, Dict, Union +from github.GithubObject import CompletableGithubObject from github.NamedUser import NamedUser -class GitReleaseAsset: +class GitReleaseAsset(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/GitTag.pyi b/github/GitTag.pyi index 770cdaf7..c3ef12fd 100644 --- a/github/GitTag.pyi +++ b/github/GitTag.pyi @@ -1,9 +1,10 @@ from typing import Any, Dict, Union from github.GitAuthor import GitAuthor +from github.GithubObject import CompletableGithubObject from github.GitObject import GitObject -class GitTag: +class GitTag(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/GitTree.pyi b/github/GitTree.pyi index e5f2fdef..520f9232 100644 --- a/github/GitTree.pyi +++ b/github/GitTree.pyi @@ -1,8 +1,9 @@ from typing import Any, Dict, List +from github.GithubObject import CompletableGithubObject from github.GitTreeElement import GitTreeElement -class GitTree: +class GitTree(CompletableGithubObject): def __repr__(self) -> str: ... @property def _identity(self) -> str: ... diff --git a/github/GitTreeElement.pyi b/github/GitTreeElement.pyi index 92cd6732..52221a76 100644 --- a/github/GitTreeElement.pyi +++ b/github/GitTreeElement.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict, Optional -class GitTreeElement: +from github.GithubObject import NonCompletableGithubObject + +class GitTreeElement(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/GithubException.pyi b/github/GithubException.pyi index ffb91bd0..4ba59450 100644 --- a/github/GithubException.pyi +++ b/github/GithubException.pyi @@ -1,6 +1,14 @@ from typing import Any, Dict, List, Optional, Tuple, Type, Union -class BadAttributeException: +class GithubException(Exception): + def __init__(self, status: Union[int, str], data: Any,) -> None: ... + def __str__(self) -> str: ... + @property + def data(self) -> Dict[str, Union[str, List[str], List[Dict[str, str]]]]: ... + @property + def status(self) -> int: ... + +class BadAttributeException(GithubException): def __init__( self, actualValue: Any, @@ -26,18 +34,9 @@ class BadAttributeException: @property def transformation_exception(self) -> Optional[ValueError]: ... -class GithubException: - def __init__(self, status: Union[int, str], data: Any,) -> None: ... - def __str__(self) -> str: ... - @property - def data(self) -> Dict[str, Union[str, List[str], List[Dict[str, str]]]]: ... - @property - def status(self) -> int: ... - -class IncompletableObject: - def __init__(self, status: Union[int, str], data: Any,) -> None: ... - def __str__(self) -> str: ... - @property - def data(self) -> Dict[str, Union[str, List[str], List[Dict[str, str]]]]: ... - @property - def status(self) -> int: ... +class BadCredentialsException(GithubException): ... +class UnknownObjectException(GithubException): ... +class BadUserAgentException(GithubException): ... +class RateLimitExceededException(GithubException): ... +class TwoFactorException(GithubException): ... +class IncompletableObject(GithubException): ... diff --git a/github/GithubObject.pyi b/github/GithubObject.pyi index df0b5a3c..b4ece220 100644 --- a/github/GithubObject.pyi +++ b/github/GithubObject.pyi @@ -8,22 +8,6 @@ from github.Organization import Organization from github.PullRequestReview import PullRequestReview from github.Requester import Requester -class CompletableGithubObject: - def __eq__(self, other: Any) -> bool: ... - def __init__( - self, - requester: Requester, - headers: Dict[str, Union[str, int]], - attributes: Dict[str, Any], - completed: bool, - ) -> None: ... - def __ne__(self, other: Any) -> bool: ... - def _completeIfNeeded(self) -> None: ... - def _completeIfNotSet( - self, value: Union[_ValuedAttribute, _BadAttribute, _NotSetType] - ) -> None: ... - def update(self) -> bool: ... - class GithubObject: def __init__( self, @@ -107,9 +91,25 @@ class GithubObject: @classmethod def setCheckAfterInitFlag(cls, flag: bool) -> None: ... -class NonCompletableGithubObject: +class NonCompletableGithubObject(GithubObject): def _completeIfNeeded(self) -> None: ... +class CompletableGithubObject(GithubObject): + def __eq__(self, other: Any) -> bool: ... + def __init__( + self, + requester: Requester, + headers: Dict[str, Union[str, int]], + attributes: Dict[str, Any], + completed: bool, + ) -> None: ... + def __ne__(self, other: Any) -> bool: ... + def _completeIfNeeded(self) -> None: ... + def _completeIfNotSet( + self, value: Union[_ValuedAttribute, _BadAttribute, _NotSetType] + ) -> None: ... + def update(self) -> bool: ... + class _BadAttribute: def __init__( self, value: Any, expectedType: Any, exception: Optional[ValueError] = ... diff --git a/github/GitignoreTemplate.pyi b/github/GitignoreTemplate.pyi index 0fb9960b..f7f8a748 100644 --- a/github/GitignoreTemplate.pyi +++ b/github/GitignoreTemplate.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict -class GitignoreTemplate: +from github.GithubObject import NonCompletableGithubObject + +class GitignoreTemplate(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Hook.pyi b/github/Hook.pyi index 865b5b7f..189fb472 100644 --- a/github/Hook.pyi +++ b/github/Hook.pyi @@ -1,10 +1,10 @@ from datetime import datetime from typing import Any, Dict, List, Union -from github.GithubObject import _NotSetType +from github.GithubObject import CompletableGithubObject, _NotSetType from github.HookResponse import HookResponse -class Hook: +class Hook(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/HookDescription.pyi b/github/HookDescription.pyi index 92b66ce0..4cd559f0 100644 --- a/github/HookDescription.pyi +++ b/github/HookDescription.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict, List -class HookDescription: +from github.GithubObject import NonCompletableGithubObject + +class HookDescription(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/HookResponse.pyi b/github/HookResponse.pyi index 346c014b..fe04da17 100644 --- a/github/HookResponse.pyi +++ b/github/HookResponse.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict -class HookResponse: +from github.GithubObject import NonCompletableGithubObject + +class HookResponse(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Installation.pyi b/github/Installation.pyi index 3eb8bdaf..61a499ff 100644 --- a/github/Installation.pyi +++ b/github/Installation.pyi @@ -1,11 +1,12 @@ from typing import Any, Dict -from github.GithubObject import _ValuedAttribute +from github.GithubObject import NonCompletableGithubObject, _ValuedAttribute from github.PaginatedList import PaginatedList +from github.Repository import Repository -class Installation: +class Installation(NonCompletableGithubObject): def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @property def id(self) -> _ValuedAttribute: ... - def get_repos(self) -> PaginatedList: ... + def get_repos(self) -> PaginatedList[Repository]: ... diff --git a/github/InstallationAuthorization.pyi b/github/InstallationAuthorization.pyi index bb4b3aa2..545ff160 100644 --- a/github/InstallationAuthorization.pyi +++ b/github/InstallationAuthorization.pyi @@ -1,9 +1,10 @@ from datetime import datetime from typing import Any, Dict +from github.GithubObject import NonCompletableGithubObject from github.NamedUser import NamedUser -class InstallationAuthorization: +class InstallationAuthorization(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Invitation.pyi b/github/Invitation.pyi index 5314e662..ea8a9f61 100644 --- a/github/Invitation.pyi +++ b/github/Invitation.pyi @@ -1,9 +1,10 @@ from typing import Any, Dict +from github.GithubObject import CompletableGithubObject from github.NamedUser import NamedUser from github.Repository import Repository -class Invitation: +class Invitation(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Issue.pyi b/github/Issue.pyi index b38449bc..5f137b88 100644 --- a/github/Issue.pyi +++ b/github/Issue.pyi @@ -1,8 +1,9 @@ from datetime import datetime from typing import Any, Dict, List, Optional, Union -from github.GithubObject import _NotSetType +from github.GithubObject import CompletableGithubObject, _NotSetType from github.IssueComment import IssueComment +from github.IssueEvent import IssueEvent from github.IssuePullRequest import IssuePullRequest from github.Label import Label from github.Milestone import Milestone @@ -12,7 +13,7 @@ from github.PullRequest import PullRequest from github.Reaction import Reaction from github.Repository import Repository -class Issue: +class Issue(CompletableGithubObject): def __repr__(self) -> str: ... @property def _identity(self) -> int: ... @@ -57,10 +58,10 @@ class Issue: def get_comment(self, id: int) -> IssueComment: ... def get_comments( self, since: Union[_NotSetType, datetime] = ... - ) -> PaginatedList: ... - def get_events(self) -> PaginatedList: ... - def get_labels(self) -> PaginatedList: ... - def get_reactions(self) -> PaginatedList: ... + ) -> PaginatedList[IssueComment]: ... + def get_events(self) -> PaginatedList[IssueEvent]: ... + def get_labels(self) -> PaginatedList[Label]: ... + def get_reactions(self) -> PaginatedList[Reaction]: ... @property def html_url(self) -> str: ... @property diff --git a/github/IssueComment.pyi b/github/IssueComment.pyi index 42d2736f..96db4ad8 100644 --- a/github/IssueComment.pyi +++ b/github/IssueComment.pyi @@ -1,11 +1,12 @@ from datetime import datetime from typing import Any, Dict +from github.GithubObject import CompletableGithubObject from github.NamedUser import NamedUser from github.PaginatedList import PaginatedList from github.Reaction import Reaction -class IssueComment: +class IssueComment(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @@ -16,7 +17,7 @@ class IssueComment: def created_at(self) -> datetime: ... def delete(self) -> None: ... def edit(self, body: str) -> None: ... - def get_reactions(self) -> PaginatedList: ... + def get_reactions(self) -> PaginatedList[Reaction]: ... @property def html_url(self) -> str: ... @property diff --git a/github/IssueEvent.pyi b/github/IssueEvent.pyi index 3b0ce3d8..0abc6390 100644 --- a/github/IssueEvent.pyi +++ b/github/IssueEvent.pyi @@ -1,11 +1,12 @@ from typing import Any, Dict, Optional, Union +from github.GithubObject import CompletableGithubObject from github.Issue import Issue from github.Label import Label from github.Milestone import Milestone from github.NamedUser import NamedUser -class IssueEvent: +class IssueEvent(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/IssuePullRequest.pyi b/github/IssuePullRequest.pyi index 9575f3d5..c1a2eae7 100644 --- a/github/IssuePullRequest.pyi +++ b/github/IssuePullRequest.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict -class IssuePullRequest: +from github.GithubObject import NonCompletableGithubObject + +class IssuePullRequest(NonCompletableGithubObject): def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @property diff --git a/github/Label.pyi b/github/Label.pyi index c47e5549..cc24477a 100644 --- a/github/Label.pyi +++ b/github/Label.pyi @@ -1,8 +1,8 @@ from typing import Any, Dict, Optional, Union -from github.GithubObject import _NotSetType +from github.GithubObject import CompletableGithubObject, _NotSetType -class Label: +class Label(CompletableGithubObject): def __repr__(self) -> str: ... @property def _identity(self) -> str: ... diff --git a/github/License.pyi b/github/License.pyi index f3070be1..b8956f86 100644 --- a/github/License.pyi +++ b/github/License.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict, List -class License: +from github.GithubObject import CompletableGithubObject + +class License(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/MainClass.pyi b/github/MainClass.pyi index 7cc7c7e1..5fb74bc8 100644 --- a/github/MainClass.pyi +++ b/github/MainClass.pyi @@ -3,12 +3,16 @@ from io import BytesIO from typing import Any, Dict, List, Optional, Tuple, Type, Union from github.AuthenticatedUser import AuthenticatedUser +from github.Commit import Commit +from github.ContentFile import ContentFile +from github.Event import Event from github.Gist import Gist from github.GithubObject import _NotSetType from github.GitignoreTemplate import GitignoreTemplate from github.HookDescription import HookDescription from github.Installation import Installation from github.InstallationAuthorization import InstallationAuthorization +from github.Issue import Issue from github.License import License from github.NamedUser import NamedUser from github.Organization import Organization @@ -16,6 +20,7 @@ from github.PaginatedList import PaginatedList from github.Project import Project from github.RateLimit import RateLimit from github.Repository import Repository +from github.Topic import Topic # from urllib3.util.retry import Retry @@ -47,20 +52,22 @@ class Github: ) -> Union[Repository, NamedUser]: ... def dump(self, obj: Repository, file: BytesIO, protocol: int = ...) -> None: ... def get_emojis(self) -> Dict[str, str]: ... - def get_events(self) -> PaginatedList: ... + def get_events(self) -> PaginatedList[Event]: ... def get_gist(self, id: str) -> Gist: ... - def get_gists(self, since: Union[datetime, _NotSetType] = ...) -> PaginatedList: ... + def get_gists( + self, since: Union[datetime, _NotSetType] = ... + ) -> PaginatedList[Gist]: ... def get_gitignore_template(self, name: str) -> GitignoreTemplate: ... def get_gitignore_templates(self) -> List[str]: ... def get_hook(self, name: str) -> HookDescription: ... def get_hooks(self) -> List[HookDescription]: ... def get_installation(self, id: int) -> Installation: ... def get_license(self, key: Union[str, _NotSetType] = ...) -> License: ... - def get_licenses(self) -> PaginatedList: ... + def get_licenses(self) -> PaginatedList[License]: ... def get_organization(self, login: str) -> Organization: ... def get_organizations( self, since: Union[int, _NotSetType] = ... - ) -> PaginatedList: ... + ) -> PaginatedList[Organization]: ... def get_project(self, id: int) -> Project: ... def get_rate_limit(self) -> RateLimit: ... def get_repo( @@ -70,11 +77,13 @@ class Github: self, since: Union[int, _NotSetType] = ..., visibility: Union[str, _NotSetType] = ..., - ) -> PaginatedList: ... + ) -> PaginatedList[Repository]: ... def get_user( self, login: Union[str, _NotSetType] = ... ) -> Union[AuthenticatedUser, NamedUser]: ... - def get_users(self, since: Union[int, _NotSetType] = ...) -> PaginatedList: ... + def get_users( + self, since: Union[int, _NotSetType] = ... + ) -> PaginatedList[NamedUser]: ... def load(self, f: BytesIO) -> Repository: ... @property def oauth_scopes(self) -> Optional[List[str]]: ... @@ -92,36 +101,36 @@ class Github: order: Union[str, _NotSetType] = ..., highlight: bool = ..., **qualifiers - ) -> PaginatedList: ... + ) -> PaginatedList[ContentFile]: ... def search_commits( self, query: str, sort: Union[str, _NotSetType] = ..., order: Union[str, _NotSetType] = ..., **qualifiers - ) -> PaginatedList: ... + ) -> PaginatedList[Commit]: ... def search_issues( self, query: str, sort: Union[str, _NotSetType] = ..., order: Union[str, _NotSetType] = ..., **qualifiers - ) -> PaginatedList: ... + ) -> PaginatedList[Issue]: ... def search_repositories( self, query: str, sort: Union[str, _NotSetType] = ..., order: Union[str, _NotSetType] = ..., **qualifiers - ) -> PaginatedList: ... - def search_topics(self, query: str, **qualifiers) -> PaginatedList: ... + ) -> PaginatedList[Repository]: ... + def search_topics(self, query: str, **qualifiers) -> PaginatedList[Topic]: ... def search_users( self, query: str, sort: Union[str, _NotSetType] = ..., order: Union[str, _NotSetType] = ..., **qualifiers - ) -> PaginatedList: ... + ) -> PaginatedList[NamedUser]: ... class GithubIntegration: def __init__( diff --git a/github/Membership.pyi b/github/Membership.pyi index d910ec71..925c252f 100644 --- a/github/Membership.pyi +++ b/github/Membership.pyi @@ -1,9 +1,10 @@ from typing import Any, Dict +from github.GithubObject import CompletableGithubObject from github.NamedUser import NamedUser from github.Organization import Organization -class Membership: +class Membership(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Migration.pyi b/github/Migration.pyi index fa371f45..b450d3aa 100644 --- a/github/Migration.pyi +++ b/github/Migration.pyi @@ -1,10 +1,11 @@ from datetime import datetime from typing import Any, Dict, List, Optional, Union +from github.GithubObject import CompletableGithubObject from github.NamedUser import NamedUser from github.Repository import Repository -class Migration: +class Migration(CompletableGithubObject): def __repr__(self): str: ... def _initAttributes(self) -> None: ... diff --git a/github/Milestone.pyi b/github/Milestone.pyi index 4bf8d155..1826ec93 100644 --- a/github/Milestone.pyi +++ b/github/Milestone.pyi @@ -1,11 +1,12 @@ from datetime import date, datetime from typing import Any, Dict, Optional, Union -from github.GithubObject import _NotSetType +from github.GithubObject import CompletableGithubObject, _NotSetType +from github.Label import Label from github.NamedUser import NamedUser from github.PaginatedList import PaginatedList -class Milestone: +class Milestone(CompletableGithubObject): def __repr__(self) -> str: ... @property def _identity(self) -> int: ... @@ -30,7 +31,7 @@ class Milestone: description: Union[_NotSetType, str] = ..., due_on: Union[date, _NotSetType] = ..., ) -> None: ... - def get_labels(self) -> PaginatedList: ... + def get_labels(self) -> PaginatedList[Label]: ... @property def id(self) -> int: ... @property diff --git a/github/NamedUser.pyi b/github/NamedUser.pyi index 9d0f6d56..d180e59e 100644 --- a/github/NamedUser.pyi +++ b/github/NamedUser.pyi @@ -1,14 +1,19 @@ from datetime import datetime from typing import Any, Dict, Optional, Union -from github.GithubObject import _NotSetType +from github.Event import Event +from github.Gist import Gist +from github.GithubObject import CompletableGithubObject, _NotSetType from github.Membership import Membership +from github.Organization import Organization from github.PaginatedList import PaginatedList from github.Permissions import Permissions from github.Plan import Plan +from github.Project import Project from github.Repository import Repository +from github.UserKey import UserKey -class NamedUser: +class NamedUser(CompletableGithubObject): def __eq__(self, other: Any) -> bool: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... @@ -44,26 +49,29 @@ class NamedUser: def following(self) -> int: ... @property def following_url(self) -> str: ... - def get_events(self) -> PaginatedList: ... - def get_followers(self) -> PaginatedList: ... - def get_following(self) -> PaginatedList: ... - def get_gists(self, since: Union[_NotSetType, datetime] = ...) -> PaginatedList: ... - def get_keys(self) -> PaginatedList: ... + def get_events(self) -> PaginatedList[Event]: ... + def get_followers(self) -> PaginatedList[NamedUser]: ... + def get_following(self) -> PaginatedList[NamedUser]: ... + def get_gists( + self, since: Union[_NotSetType, datetime] = ... + ) -> PaginatedList[Gist]: ... + def get_keys(self) -> PaginatedList[UserKey]: ... def get_organization_membership(self, org: int) -> Membership: ... - def get_orgs(self) -> PaginatedList: ... - def get_public_events(self) -> PaginatedList: ... - def get_public_received_events(self) -> PaginatedList: ... - def get_received_events(self) -> PaginatedList: ... + def get_orgs(self) -> PaginatedList[Organization]: ... + def get_projects(self, state: str = ...) -> PaginatedList[Project]: ... + def get_public_events(self) -> PaginatedList[Event]: ... + def get_public_received_events(self) -> PaginatedList[Event]: ... + def get_received_events(self) -> PaginatedList[Event]: ... def get_repo(self, name: str) -> Repository: ... def get_repos( self, type: Union[str, _NotSetType] = ..., sort: Union[str, _NotSetType] = ..., direction: Union[str, _NotSetType] = ..., - ) -> PaginatedList: ... - def get_starred(self) -> PaginatedList: ... - def get_subscriptions(self) -> PaginatedList: ... - def get_watched(self) -> PaginatedList: ... + ) -> PaginatedList[Repository]: ... + def get_starred(self) -> PaginatedList[Repository]: ... + def get_subscriptions(self) -> PaginatedList[Repository]: ... + def get_watched(self) -> PaginatedList[Repository]: ... @property def gists_url(self) -> str: ... @property diff --git a/github/Notification.pyi b/github/Notification.pyi index 3cf21c9a..3f23f287 100644 --- a/github/Notification.pyi +++ b/github/Notification.pyi @@ -1,12 +1,13 @@ from datetime import datetime from typing import Any, Dict, Optional +from github.GithubObject import CompletableGithubObject from github.Issue import Issue from github.NotificationSubject import NotificationSubject from github.PullRequest import PullRequest from github.Repository import Repository -class Notification: +class Notification(CompletableGithubObject): def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @property diff --git a/github/NotificationSubject.pyi b/github/NotificationSubject.pyi index 8030c5b3..f05ff13b 100644 --- a/github/NotificationSubject.pyi +++ b/github/NotificationSubject.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict, Optional -class NotificationSubject: +from github.GithubObject import NonCompletableGithubObject + +class NotificationSubject(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Organization.pyi b/github/Organization.pyi index 2bbefc02..06533e39 100644 --- a/github/Organization.pyi +++ b/github/Organization.pyi @@ -1,17 +1,20 @@ from datetime import datetime from typing import Any, Dict, List, Optional, Union -from github.GithubObject import _NotSetType +from github.Event import Event +from github.GithubObject import CompletableGithubObject, _NotSetType from github.Hook import Hook +from github.Issue import Issue from github.Label import Label from github.Migration import Migration from github.NamedUser import NamedUser from github.PaginatedList import PaginatedList from github.Plan import Plan +from github.Project import Project from github.Repository import Repository from github.Team import Team -class Organization: +class Organization(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @@ -105,8 +108,8 @@ class Organization: def followers(self) -> int: ... @property def following(self) -> int: ... - def get_events(self) -> PaginatedList: ... - def get_hooks(self) -> PaginatedList: ... + def get_events(self) -> PaginatedList[Event]: ... + def get_hooks(self) -> PaginatedList[Hook]: ... def get_issues( self, filter: Union[str, _NotSetType] = ..., @@ -115,28 +118,30 @@ class Organization: sort: Union[str, _NotSetType] = ..., direction: Union[str, _NotSetType] = ..., since: Union[_NotSetType, datetime] = ..., - ) -> PaginatedList: ... + ) -> PaginatedList[Issue]: ... def get_members( self, filter_: Union[str, _NotSetType] = ..., role: Union[str, _NotSetType] = ..., - ) -> PaginatedList: ... - def get_migrations(self) -> PaginatedList: ... + ) -> PaginatedList[NamedUser]: ... + def get_migrations(self) -> PaginatedList[Migration]: ... def get_outside_collaborators( self, filter_: Union[str, _NotSetType] = ... - ) -> PaginatedList: ... - def get_projects(self, state: Union[_NotSetType, str] = ...) -> PaginatedList: ... - def get_public_members(self) -> PaginatedList: ... + ) -> PaginatedList[NamedUser]: ... + def get_projects( + self, state: Union[_NotSetType, str] = ... + ) -> PaginatedList[Project]: ... + def get_public_members(self) -> PaginatedList[NamedUser]: ... def get_repo(self, name: str) -> Repository: ... def get_repos( self, type: Union[str, _NotSetType] = ..., sort: Union[str, _NotSetType] = ..., direction: Union[str, _NotSetType] = ..., - ) -> PaginatedList: ... + ) -> PaginatedList[Repository]: ... def get_team(self, id: int) -> Team: ... def get_team_by_slug(self, slug: str) -> Team: ... - def get_teams(self) -> PaginatedList: ... + def get_teams(self) -> PaginatedList[Team]: ... @property def gravatar_id(self) -> str: ... def has_in_members(self, member: NamedUser) -> bool: ... @@ -153,7 +158,7 @@ class Organization: def id(self) -> int: ... @property def issues_url(self) -> str: ... - def invitations(self) -> PaginatedList: ... + def invitations(self) -> PaginatedList[NamedUser]: ... def invite_user( self, user: Union[_NotSetType, NamedUser] = ..., diff --git a/github/PaginatedList.pyi b/github/PaginatedList.pyi index dba31151..1a02632e 100644 --- a/github/PaginatedList.pyi +++ b/github/PaginatedList.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Iterator, List, Optional, Union +from typing import Any, Dict, Generic, Iterator, List, Optional, Type, TypeVar, Union from github.ContentFile import ContentFile from github.GithubObject import GithubObject @@ -6,10 +6,23 @@ from github.Issue import Issue from github.NamedUser import NamedUser from github.Requester import Requester -class PaginatedList: +T = TypeVar("T", bound=GithubObject) + +class PaginatedListBase(Generic[T]): + def __getitem__(self, index: Union[int, slice]) -> Any: ... + def __init__(self) -> None: ... + def __iter__(self) -> Iterator[T]: ... + def _grow(self) -> Any: ... + def _isBiggerThan(self, index: int) -> bool: ... + class _Slice: + def __init__(self, theList: PaginatedList[T], theSlice: slice) -> None: ... + def __iter__(self) -> Iterator[T]: ... + def __finished(self, index: int) -> bool: ... + +class PaginatedList(PaginatedListBase[T]): def __init__( self, - contentClass: Any, + contentClass: Type[T], requester: Requester, firstUrl: str, firstParams: Any, @@ -23,17 +36,6 @@ class PaginatedList: def _getLastPageUrl(self) -> Optional[str]: ... def get_page(self, page: int) -> List[Any]: ... @property - def reversed(self) -> PaginatedList: ... + def reversed(self) -> PaginatedList[T]: ... @property def totalCount(self) -> int: ... - -class PaginatedListBase: - def __getitem__(self, index: Union[int, slice]) -> Any: ... - def __init__(self) -> None: ... - def __iter__(self) -> Iterator[GithubObject]: ... - def _grow(self) -> Any: ... - def _isBiggerThan(self, index: int) -> bool: ... - class _Slice: - def __init__(self, theList: PaginatedList, theSlice: slice) -> None: ... - def __iter__(self) -> Iterator[GithubObject]: ... - def __finished(self, index: int) -> bool: ... diff --git a/github/Path.pyi b/github/Path.pyi index 48e98db2..cd4a0044 100644 --- a/github/Path.pyi +++ b/github/Path.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict -class Path: +from github.GithubObject import NonCompletableGithubObject + +class Path(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Permissions.pyi b/github/Permissions.pyi index e3349703..abe18091 100644 --- a/github/Permissions.pyi +++ b/github/Permissions.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict -class Permissions: +from github.GithubObject import NonCompletableGithubObject + +class Permissions(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Plan.pyi b/github/Plan.pyi index 11d204f8..50035575 100644 --- a/github/Plan.pyi +++ b/github/Plan.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict, Union -class Plan: +from github.GithubObject import NonCompletableGithubObject + +class Plan(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Project.pyi b/github/Project.pyi index 360e734f..9ab38c30 100644 --- a/github/Project.pyi +++ b/github/Project.pyi @@ -1,11 +1,12 @@ from datetime import datetime from typing import Any, Dict +from github.GithubObject import CompletableGithubObject from github.NamedUser import NamedUser from github.PaginatedList import PaginatedList from github.ProjectColumn import ProjectColumn -class Project: +class Project(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @@ -18,7 +19,7 @@ class Project: def created_at(self) -> datetime: ... @property def creator(self) -> NamedUser: ... - def get_columns(self) -> PaginatedList: ... + def get_columns(self) -> PaginatedList[ProjectColumn]: ... @property def html_url(self) -> str: ... @property diff --git a/github/ProjectCard.pyi b/github/ProjectCard.pyi index e19838ec..9aaaf8db 100644 --- a/github/ProjectCard.pyi +++ b/github/ProjectCard.pyi @@ -1,12 +1,12 @@ from datetime import datetime from typing import Any, Dict, Optional, Union -from github.GithubObject import _NotSetType +from github.GithubObject import CompletableGithubObject, _NotSetType from github.Issue import Issue from github.NamedUser import NamedUser from github.PullRequest import PullRequest -class ProjectCard: +class ProjectCard(CompletableGithubObject): def _repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/ProjectColumn.pyi b/github/ProjectColumn.pyi index ceec2a81..5e9f12ad 100644 --- a/github/ProjectColumn.pyi +++ b/github/ProjectColumn.pyi @@ -1,11 +1,11 @@ from datetime import datetime from typing import Any, Dict, Union -from github.GithubObject import _NotSetType +from github.GithubObject import CompletableGithubObject, _NotSetType from github.PaginatedList import PaginatedList from github.ProjectCard import ProjectCard -class ProjectColumn: +class ProjectColumn(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @@ -21,7 +21,7 @@ class ProjectColumn: def created_at(self) -> datetime: ... def get_cards( self, archived_state: Union[_NotSetType, str] = ... - ) -> PaginatedList: ... + ) -> PaginatedList[ProjectCard]: ... @property def id(self) -> int: ... @property diff --git a/github/PullRequest.pyi b/github/PullRequest.pyi index bce55b4b..4efa8885 100644 --- a/github/PullRequest.pyi +++ b/github/PullRequest.pyi @@ -2,9 +2,11 @@ from datetime import datetime from typing import Any, Dict, List, Optional, Tuple, Union from github.Commit import Commit -from github.GithubObject import _NotSetType +from github.File import File +from github.GithubObject import CompletableGithubObject, _NotSetType from github.Issue import Issue from github.IssueComment import IssueComment +from github.IssueEvent import IssueEvent from github.Label import Label from github.Milestone import Milestone from github.NamedUser import NamedUser @@ -13,8 +15,9 @@ from github.PullRequestComment import PullRequestComment from github.PullRequestMergeStatus import PullRequestMergeStatus from github.PullRequestPart import PullRequestPart from github.PullRequestReview import PullRequestReview +from github.Team import Team -class PullRequest: +class PullRequest(CompletableGithubObject): def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... def add_to_labels(self, *labels: Union[Label, str]) -> None: ... @@ -81,21 +84,25 @@ class PullRequest: base: Union[_NotSetType, str] = ..., ) -> None: ... def get_comment(self, id: int) -> PullRequestComment: ... - def get_comments(self) -> PaginatedList: ... - def get_commits(self) -> PaginatedList: ... - def get_files(self) -> PaginatedList: ... + def get_comments(self) -> PaginatedList[PullRequestComment]: ... + def get_commits(self) -> PaginatedList[Commit]: ... + def get_files(self) -> PaginatedList[File]: ... def get_issue_comment(self, id: int) -> IssueComment: ... - def get_issue_comments(self) -> PaginatedList: ... - def get_issue_events(self) -> PaginatedList: ... - def get_labels(self) -> PaginatedList: ... + def get_issue_comments(self) -> PaginatedList[IssueComment]: ... + def get_issue_events(self) -> PaginatedList[IssueEvent]: ... + def get_labels(self) -> PaginatedList[Label]: ... def get_review(self, id: int) -> PullRequestReview: ... def get_review_comment(self, id: int) -> PullRequestComment: ... def get_review_comments( self, since: Union[_NotSetType, datetime] = ... - ) -> PaginatedList: ... - def get_single_review_comments(self, id: int) -> PaginatedList: ... - def get_review_requests(self) -> Tuple[PaginatedList, PaginatedList]: ... - def get_reviews(self) -> PaginatedList: ... + ) -> PaginatedList[PullRequestComment]: ... + def get_single_review_comments( + self, id: int + ) -> PaginatedList[PullRequestComment]: ... + def get_review_requests( + self, + ) -> Tuple[PaginatedList[NamedUser], PaginatedList[Team]]: ... + def get_reviews(self) -> PaginatedList[PullRequestReview]: ... @property def head(self) -> PullRequestPart: ... @property diff --git a/github/PullRequestComment.pyi b/github/PullRequestComment.pyi index ed1d3292..8a83710a 100644 --- a/github/PullRequestComment.pyi +++ b/github/PullRequestComment.pyi @@ -1,11 +1,12 @@ from datetime import datetime from typing import Any, Dict +from github.GithubObject import CompletableGithubObject from github.NamedUser import NamedUser from github.PaginatedList import PaginatedList from github.Reaction import Reaction -class PullRequestComment: +class PullRequestComment(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @@ -20,7 +21,7 @@ class PullRequestComment: @property def diff_hunk(self) -> str: ... def edit(self, body: str) -> None: ... - def get_reactions(self) -> PaginatedList: ... + def get_reactions(self) -> PaginatedList[Reaction]: ... @property def html_url(self) -> str: ... @property diff --git a/github/PullRequestMergeStatus.pyi b/github/PullRequestMergeStatus.pyi index 2af07bc2..c7fb42f3 100644 --- a/github/PullRequestMergeStatus.pyi +++ b/github/PullRequestMergeStatus.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict -class PullRequestMergeStatus: +from github.GithubObject import NonCompletableGithubObject + +class PullRequestMergeStatus(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/PullRequestPart.pyi b/github/PullRequestPart.pyi index 32a949a9..082e6bc2 100644 --- a/github/PullRequestPart.pyi +++ b/github/PullRequestPart.pyi @@ -1,9 +1,10 @@ from typing import Any, Dict, Optional +from github.GithubObject import NonCompletableGithubObject from github.NamedUser import NamedUser from github.Repository import Repository -class PullRequestPart: +class PullRequestPart(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/PullRequestReview.pyi b/github/PullRequestReview.pyi index 665b0ac1..269da086 100644 --- a/github/PullRequestReview.pyi +++ b/github/PullRequestReview.pyi @@ -1,9 +1,10 @@ from datetime import datetime from typing import Any, Dict +from github.GithubObject import CompletableGithubObject from github.NamedUser import NamedUser -class PullRequestReview: +class PullRequestReview(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Rate.pyi b/github/Rate.pyi index bfa447ac..956f2f2e 100644 --- a/github/Rate.pyi +++ b/github/Rate.pyi @@ -1,7 +1,9 @@ from datetime import datetime from typing import Any, Dict -class Rate: +from github.GithubObject import NonCompletableGithubObject + +class Rate(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/RateLimit.pyi b/github/RateLimit.pyi index 8727f015..d9192c82 100644 --- a/github/RateLimit.pyi +++ b/github/RateLimit.pyi @@ -1,8 +1,9 @@ from typing import Any, Dict +from github.GithubObject import NonCompletableGithubObject from github.Rate import Rate -class RateLimit: +class RateLimit(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Reaction.pyi b/github/Reaction.pyi index 786657b7..216918ad 100644 --- a/github/Reaction.pyi +++ b/github/Reaction.pyi @@ -1,9 +1,10 @@ from datetime import datetime from typing import Any, Dict +from github.GithubObject import CompletableGithubObject from github.NamedUser import NamedUser -class Reaction: +class Reaction(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Referrer.pyi b/github/Referrer.pyi index 30eb2819..c0397799 100644 --- a/github/Referrer.pyi +++ b/github/Referrer.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict -class Referrer: +from github.GithubObject import NonCompletableGithubObject + +class Referrer(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Repository.pyi b/github/Repository.pyi index 81554bb7..a6587372 100644 --- a/github/Repository.pyi +++ b/github/Repository.pyi @@ -9,9 +9,10 @@ from github.CommitComment import CommitComment from github.Comparison import Comparison from github.ContentFile import ContentFile from github.Download import Download +from github.Event import Event from github.GitBlob import GitBlob from github.GitCommit import GitCommit -from github.GithubObject import _NotSetType +from github.GithubObject import CompletableGithubObject, _NotSetType from github.GitRef import GitRef from github.GitRelease import GitRelease from github.GitReleaseAsset import GitReleaseAsset @@ -20,28 +21,35 @@ from github.GitTree import GitTree from github.Hook import Hook from github.InputGitAuthor import InputGitAuthor from github.InputGitTreeElement import InputGitTreeElement +from github.Invitation import Invitation from github.Issue import Issue +from github.IssueComment import IssueComment from github.IssueEvent import IssueEvent from github.Label import Label from github.Milestone import Milestone from github.NamedUser import NamedUser +from github.Notification import Notification from github.Organization import Organization from github.PaginatedList import PaginatedList from github.Path import Path from github.Permissions import Permissions from github.Project import Project from github.PullRequest import PullRequest +from github.PullRequestComment import PullRequestComment from github.Referrer import Referrer from github.RepositoryKey import RepositoryKey from github.SourceImport import SourceImport +from github.Stargazer import Stargazer from github.StatsCodeFrequency import StatsCodeFrequency from github.StatsCommitActivity import StatsCommitActivity from github.StatsContributor import StatsContributor from github.StatsParticipation import StatsParticipation from github.StatsPunchCard import StatsPunchCard +from github.Tag import Tag +from github.Team import Team from github.View import View -class Repository: +class Repository(CompletableGithubObject): def __repr__(self) -> str: ... def _hub( self, mode: str, event: str, callback: str, secret: Union[str, _NotSetType] @@ -233,9 +241,9 @@ class Repository: def get_archive_link( self, archive_format: str, ref: Union[str, _NotSetType] = ... ) -> str: ... - def get_assignees(self) -> PaginatedList: ... + def get_assignees(self) -> PaginatedList[NamedUser]: ... def get_branch(self, branch: str) -> Branch: ... - def get_branches(self) -> PaginatedList: ... + def get_branches(self) -> PaginatedList[Branch]: ... def get_clones_traffic( self, per: Union[str, _NotSetType] = ... ) -> Dict[str, Union[int, List[Clones]]]: ... @@ -244,9 +252,9 @@ class Repository: ) -> str: ... def get_collaborators( self, affiliation: Union[str, _NotSetType] = ... - ) -> PaginatedList: ... + ) -> PaginatedList[NamedUser]: ... def get_comment(self, id: int) -> CommitComment: ... - def get_comments(self) -> PaginatedList: ... + def get_comments(self) -> PaginatedList[CommitComment]: ... def get_commit(self, sha: str) -> Commit: ... def get_commits( self, @@ -255,30 +263,30 @@ class Repository: since: Union[_NotSetType, datetime] = ..., until: Union[_NotSetType, datetime] = ..., author: Union[AuthenticatedUser, NamedUser, str, _NotSetType] = ..., - ) -> PaginatedList: ... + ) -> PaginatedList[Commit]: ... def get_contents( self, path: str, ref: Union[str, _NotSetType] = ... ) -> Union[List[ContentFile], ContentFile]: ... def get_contributors( self, anon: Union[str, _NotSetType] = ... - ) -> PaginatedList: ... + ) -> PaginatedList[NamedUser]: ... def get_dir_contents( self, path: str, ref: Union[str, _NotSetType] = ... ) -> List[ContentFile]: ... def get_download(self, id: int) -> Download: ... - def get_downloads(self) -> PaginatedList: ... - def get_events(self) -> PaginatedList: ... - def get_forks(self) -> PaginatedList: ... + def get_downloads(self) -> PaginatedList[Download]: ... + def get_events(self) -> PaginatedList[Event]: ... + def get_forks(self) -> PaginatedList[Repository]: ... def get_git_blob(self, sha: str) -> GitBlob: ... def get_git_commit(self, sha: str) -> GitCommit: ... def get_git_ref(self, ref: str) -> GitRef: ... - def get_git_refs(self) -> PaginatedList: ... + def get_git_refs(self) -> PaginatedList[GitRef]: ... def get_git_tag(self, sha: str) -> GitTag: ... def get_git_tree( self, sha: str, recursive: Union[bool, _NotSetType] = ... ) -> GitTree: ... def get_hook(self, id: int) -> Hook: ... - def get_hooks(self) -> PaginatedList: ... + def get_hooks(self) -> PaginatedList[Hook]: ... def get_issue(self, number: int) -> Issue: ... def get_issues( self, @@ -291,19 +299,19 @@ class Repository: direction: Union[str, _NotSetType] = ..., since: Union[_NotSetType, datetime] = ..., creator: Union[NamedUser, _NotSetType] = ..., - ) -> PaginatedList: ... + ) -> PaginatedList[Issue]: ... def get_issues_comments( self, sort: Union[str, _NotSetType] = ..., direction: Union[str, _NotSetType] = ..., since: Union[_NotSetType, datetime] = ..., - ) -> PaginatedList: ... + ) -> PaginatedList[IssueComment]: ... def get_issues_event(self, id: int) -> IssueEvent: ... - def get_issues_events(self) -> PaginatedList: ... + def get_issues_events(self) -> PaginatedList[IssueEvent]: ... def get_key(self, id: int) -> RepositoryKey: ... - def get_keys(self) -> PaginatedList: ... + def get_keys(self) -> PaginatedList[RepositoryKey]: ... def get_label(self, name: str) -> Label: ... - def get_labels(self) -> PaginatedList: ... + def get_labels(self) -> PaginatedList[Label]: ... def get_languages(self) -> Dict[str, int]: ... def get_latest_release(self) -> GitRelease: ... def get_license(self) -> ContentFile: ... @@ -313,17 +321,19 @@ class Repository: state: Union[str, _NotSetType] = ..., sort: Union[str, _NotSetType] = ..., direction: Union[str, _NotSetType] = ..., - ) -> PaginatedList: ... - def get_network_events(self) -> PaginatedList: ... + ) -> PaginatedList[Milestone]: ... + def get_network_events(self) -> PaginatedList[Event]: ... def get_notifications( self, all: Union[bool, _NotSetType] = ..., participating: Union[bool, _NotSetType] = ..., since: Union[datetime, _NotSetType] = ..., before: Union[datetime, _NotSetType] = ..., - ) -> PaginatedList: ... - def get_pending_invitations(self) -> PaginatedList: ... - def get_projects(self, state: Union[str, _NotSetType] = ...) -> PaginatedList: ... + ) -> PaginatedList[Notification]: ... + def get_pending_invitations(self) -> PaginatedList[Invitation]: ... + def get_projects( + self, state: Union[str, _NotSetType] = ... + ) -> PaginatedList[Project]: ... def get_pull(self, number: int) -> PullRequest: ... def get_pulls( self, @@ -332,34 +342,34 @@ class Repository: direction: Union[str, _NotSetType] = ..., base: Union[str, _NotSetType] = ..., head: Union[str, _NotSetType] = ..., - ) -> PaginatedList: ... + ) -> PaginatedList[PullRequest]: ... def get_pulls_comments( self, sort: Union[str, _NotSetType] = ..., direction: Union[str, _NotSetType] = ..., since: Union[_NotSetType, datetime] = ..., - ) -> PaginatedList: ... + ) -> PaginatedList[PullRequestComment]: ... def get_pulls_review_comments( self, sort: Union[str, _NotSetType] = ..., direction: Union[str, _NotSetType] = ..., since: Union[_NotSetType, datetime] = ..., - ) -> PaginatedList: ... + ) -> PaginatedList[PullRequestComment]: ... def get_readme(self, ref: Union[str, _NotSetType] = ...) -> ContentFile: ... def get_release(self, id: Union[int, str]) -> GitRelease: ... def get_release_asset(self, id: int) -> GitReleaseAsset: ... - def get_releases(self) -> PaginatedList: ... + def get_releases(self) -> PaginatedList[GitRelease]: ... def get_source_import(self) -> SourceImport: ... - def get_stargazers(self) -> PaginatedList: ... - def get_stargazers_with_dates(self) -> PaginatedList: ... + def get_stargazers(self) -> PaginatedList[NamedUser]: ... + def get_stargazers_with_dates(self) -> PaginatedList[Stargazer]: ... def get_stats_code_frequency(self) -> Optional[List[StatsCodeFrequency]]: ... def get_stats_commit_activity(self) -> Optional[List[StatsCommitActivity]]: ... def get_stats_contributors(self) -> Optional[List[StatsContributor]]: ... def get_stats_participation(self) -> Optional[StatsParticipation]: ... def get_stats_punch_card(self) -> Optional[StatsPunchCard]: ... - def get_subscribers(self) -> PaginatedList: ... - def get_tags(self) -> PaginatedList: ... - def get_teams(self) -> PaginatedList: ... + def get_subscribers(self) -> PaginatedList[NamedUser]: ... + def get_tags(self) -> PaginatedList[Tag]: ... + def get_teams(self) -> PaginatedList[Team]: ... def get_top_paths(self) -> List[Path]: ... def get_top_referrers(self) -> List[Referrer]: ... def get_topics(self) -> List[str]: ... @@ -367,7 +377,7 @@ class Repository: self, per: Union[str, _NotSetType] = ... ) -> Dict[str, Union[int, List[View]]]: ... def get_vulnerability_alert(self) -> bool: ... - def get_watchers(self) -> PaginatedList: ... + def get_watchers(self) -> PaginatedList[NamedUser]: ... @property def git_commits_url(self) -> str: ... @property diff --git a/github/RepositoryKey.pyi b/github/RepositoryKey.pyi index 6ad15b24..44a942b6 100644 --- a/github/RepositoryKey.pyi +++ b/github/RepositoryKey.pyi @@ -1,7 +1,9 @@ from datetime import datetime from typing import Any, Dict -class RepositoryKey: +from github.GithubObject import CompletableGithubObject + +class RepositoryKey(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/RequiredPullRequestReviews.pyi b/github/RequiredPullRequestReviews.pyi index 16d14a24..4d1c5884 100644 --- a/github/RequiredPullRequestReviews.pyi +++ b/github/RequiredPullRequestReviews.pyi @@ -1,9 +1,10 @@ from typing import Any, Dict, List, Optional +from github.GithubObject import CompletableGithubObject from github.NamedUser import NamedUser from github.Team import Team -class RequiredPullRequestReviews: +class RequiredPullRequestReviews(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/RequiredStatusChecks.pyi b/github/RequiredStatusChecks.pyi index 7dcfe11d..a5058afb 100644 --- a/github/RequiredStatusChecks.pyi +++ b/github/RequiredStatusChecks.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict, List -class RequiredStatusChecks: +from github.GithubObject import CompletableGithubObject + +class RequiredStatusChecks(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/SourceImport.pyi b/github/SourceImport.pyi index 5fb1673e..544ef1e7 100644 --- a/github/SourceImport.pyi +++ b/github/SourceImport.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict, Optional -class SourceImport: +from github.GithubObject import CompletableGithubObject + +class SourceImport(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Stargazer.pyi b/github/Stargazer.pyi index 8b4d2028..7f7284ef 100644 --- a/github/Stargazer.pyi +++ b/github/Stargazer.pyi @@ -1,9 +1,10 @@ from datetime import datetime from typing import Any, Dict +from github.GithubObject import NonCompletableGithubObject from github.NamedUser import NamedUser -class Stargazer: +class Stargazer(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/StatsCodeFrequency.pyi b/github/StatsCodeFrequency.pyi index 325db717..456bfb4b 100644 --- a/github/StatsCodeFrequency.pyi +++ b/github/StatsCodeFrequency.pyi @@ -1,7 +1,9 @@ from datetime import datetime from typing import List -class StatsCodeFrequency: +from github.GithubObject import NonCompletableGithubObject + +class StatsCodeFrequency(NonCompletableGithubObject): def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: List[int]) -> None: ... @property diff --git a/github/StatsCommitActivity.pyi b/github/StatsCommitActivity.pyi index 8bc3b216..12243e5d 100644 --- a/github/StatsCommitActivity.pyi +++ b/github/StatsCommitActivity.pyi @@ -1,7 +1,9 @@ from datetime import datetime from typing import Any, Dict, List -class StatsCommitActivity: +from github.GithubObject import NonCompletableGithubObject + +class StatsCommitActivity(NonCompletableGithubObject): def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @property diff --git a/github/StatsContributor.pyi b/github/StatsContributor.pyi index 46a85fe9..ee483ec6 100644 --- a/github/StatsContributor.pyi +++ b/github/StatsContributor.pyi @@ -1,9 +1,10 @@ from datetime import datetime from typing import Any, Dict, List, Optional +from github.GithubObject import NonCompletableGithubObject from github.NamedUser import NamedUser -class StatsContributor: +class StatsContributor(NonCompletableGithubObject): def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... @property @@ -12,7 +13,7 @@ class StatsContributor: def total(self) -> int: ... @property def weeks(self) -> List[Week]: ... - class Week: + class Week(NonCompletableGithubObject): def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, int]) -> None: ... @property diff --git a/github/StatsParticipation.pyi b/github/StatsParticipation.pyi index 3883fec3..45dc6605 100644 --- a/github/StatsParticipation.pyi +++ b/github/StatsParticipation.pyi @@ -1,6 +1,8 @@ from typing import Dict, List -class StatsParticipation: +from github.GithubObject import NonCompletableGithubObject + +class StatsParticipation(NonCompletableGithubObject): def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, List[int]]) -> None: ... @property diff --git a/github/StatsPunchCard.pyi b/github/StatsPunchCard.pyi index 1525ecf0..03353169 100644 --- a/github/StatsPunchCard.pyi +++ b/github/StatsPunchCard.pyi @@ -1,6 +1,8 @@ from typing import List -class StatsPunchCard: +from github.GithubObject import NonCompletableGithubObject + +class StatsPunchCard(NonCompletableGithubObject): def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: List[List[int]]) -> None: ... def get(self, day: int, hour: int) -> int: ... diff --git a/github/Tag.pyi b/github/Tag.pyi index 9d0112cc..019c1bde 100644 --- a/github/Tag.pyi +++ b/github/Tag.pyi @@ -1,8 +1,9 @@ from typing import Any, Dict from github.Commit import Commit +from github.GithubObject import NonCompletableGithubObject -class Tag: +class Tag(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Team.pyi b/github/Team.pyi index 6bcc0d9b..6b57676c 100644 --- a/github/Team.pyi +++ b/github/Team.pyi @@ -1,12 +1,13 @@ from typing import Any, Dict, Union -from github.GithubObject import _NotSetType +from github.GithubObject import CompletableGithubObject, _NotSetType from github.NamedUser import NamedUser from github.Organization import Organization from github.PaginatedList import PaginatedList from github.Repository import Repository +from github.TeamDiscussion import TeamDiscussion -class Team: +class Team(CompletableGithubObject): def __repr__(self) -> str: ... @property def _identity(self) -> int: ... @@ -27,14 +28,16 @@ class Team: permission: Union[str, _NotSetType] = ..., privacy: Union[str, _NotSetType] = ..., ) -> None: ... - def get_discussions(self) -> PaginatedList: ... - def get_members(self, role: Union[str, _NotSetType] = ...) -> PaginatedList: ... - def get_repos(self) -> PaginatedList: ... + def get_discussions(self) -> PaginatedList[TeamDiscussion]: ... + def get_members( + self, role: Union[str, _NotSetType] = ... + ) -> PaginatedList[NamedUser]: ... + def get_repos(self) -> PaginatedList[Repository]: ... def has_in_members(self, member: NamedUser) -> bool: ... def has_in_repos(self, repo: Repository) -> bool: ... @property def id(self) -> int: ... - def invitations(self) -> PaginatedList: ... + def invitations(self) -> PaginatedList[NamedUser]: ... @property def members_count(self) -> int: ... @property diff --git a/github/TeamDiscussion.pyi b/github/TeamDiscussion.pyi index 440f51f5..cb0acfad 100644 --- a/github/TeamDiscussion.pyi +++ b/github/TeamDiscussion.pyi @@ -1,9 +1,10 @@ from datetime import datetime from typing import Any, Dict +from github.GithubObject import CompletableGithubObject from github.NamedUser import NamedUser -class TeamDiscussion: +class TeamDiscussion(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/TimelineEvent.pyi b/github/TimelineEvent.pyi index b26956f4..73677838 100644 --- a/github/TimelineEvent.pyi +++ b/github/TimelineEvent.pyi @@ -1,10 +1,11 @@ from datetime import datetime from typing import Any, Dict +from github.GithubObject import NonCompletableGithubObject from github.NamedUser import NamedUser from github.TimelineEventSource import TimelineEventSource -class TimelineEvent: +class TimelineEvent(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/TimelineEventSource.pyi b/github/TimelineEventSource.pyi index 117d9cde..8a7d31d1 100644 --- a/github/TimelineEventSource.pyi +++ b/github/TimelineEventSource.pyi @@ -1,8 +1,9 @@ from typing import Any, Dict +from github.GithubObject import NonCompletableGithubObject from github.Issue import Issue -class TimelineEventSource: +class TimelineEventSource(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/Topic.pyi b/github/Topic.pyi index 14f5541c..ad62a839 100644 --- a/github/Topic.pyi +++ b/github/Topic.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict -class Topic: +from github.GithubObject import NonCompletableGithubObject + +class Topic(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/UserKey.pyi b/github/UserKey.pyi index 31ca4b5c..4aa4aadb 100644 --- a/github/UserKey.pyi +++ b/github/UserKey.pyi @@ -1,6 +1,8 @@ from typing import Any, Dict -class UserKey: +from github.GithubObject import CompletableGithubObject + +class UserKey(CompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/View.pyi b/github/View.pyi index 0df8625e..dd45c7d6 100644 --- a/github/View.pyi +++ b/github/View.pyi @@ -1,7 +1,9 @@ from datetime import datetime from typing import Any, Dict -class View: +from github.GithubObject import NonCompletableGithubObject + +class View(NonCompletableGithubObject): def __repr__(self) -> str: ... def _initAttributes(self) -> None: ... def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... diff --git a/github/__init__.py b/github/__init__.py index 680ae684..d1ae8321 100644 --- a/github/__init__.py +++ b/github/__init__.py @@ -57,7 +57,7 @@ import logging from github.MainClass import Github, GithubIntegration -from .GithubException import ( # type: ignore +from .GithubException import ( BadAttributeException, BadCredentialsException, BadUserAgentException, diff --git a/github/__init__.pyi b/github/__init__.pyi new file mode 100644 index 00000000..a3f3a5ff --- /dev/null +++ b/github/__init__.pyi @@ -0,0 +1,16 @@ +from github.MainClass import Github as Github +from github.MainClass import GithubIntegration as GithubIntegration + +from .GithubException import BadAttributeException as BadAttributeException +from .GithubException import BadCredentialsException as BadCredentialsException +from .GithubException import BadUserAgentException as BadUserAgentException +from .GithubException import GithubException as GithubException +from .GithubException import IncompletableObject as IncompleteableObject +from .GithubException import RateLimitExceededException as RateLimitExceededException +from .GithubException import TwoFactorException as TwoFactorException +from .GithubException import UnknownObjectException as UnknownObjectException +from .InputFileContent import InputFileContent as InputFileContent +from .InputGitAuthor import InputGitAuthor as InputGitAuthor +from .InputGitTreeElement import InputGitTreeElement as InputGitTreeElement + +def enable_console_debug_logging() -> None: ... diff --git a/github/py.typed b/github/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/setup.py b/setup.py index 59ed469f..634e5ead 100755 --- a/setup.py +++ b/setup.py @@ -83,7 +83,7 @@ if __name__ == "__main__": See http://pygithub.readthedocs.io/en/latest/""" ), packages=["github"], - package_data={}, + package_data={"github": ["py.typed", "*.pyi"]}, classifiers=[ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment",