mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 03:41:08 +00:00
More precise typing for MainClass.get_user() (#1575)
Use typing.overload for MainClass.get_user() since it can return two disparate types. Correct the docstring for it, as well as locking down Sphinx to <3 due to built docs issue and drive-by link correction. Fixes #1550
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from datetime import datetime
|
||||
from io import BytesIO
|
||||
from typing import Any, Dict, List, Optional, Tuple, Type, TypeVar, Union
|
||||
from typing import Any, Dict, List, Optional, Tuple, Type, TypeVar, Union, overload
|
||||
|
||||
from github.AuthenticatedUser import AuthenticatedUser
|
||||
from github.Commit import Commit
|
||||
@@ -79,9 +79,10 @@ class Github:
|
||||
since: Union[int, _NotSetType] = ...,
|
||||
visibility: Union[str, _NotSetType] = ...,
|
||||
) -> PaginatedList[Repository]: ...
|
||||
def get_user(
|
||||
self, login: Union[str, _NotSetType] = ...
|
||||
) -> Union[AuthenticatedUser, NamedUser]: ...
|
||||
@overload
|
||||
def get_user(self, login: _NotSetType) -> AuthenticatedUser: ...
|
||||
@overload
|
||||
def get_user(self, login: str) -> NamedUser: ...
|
||||
def get_users(
|
||||
self, since: Union[int, _NotSetType] = ...
|
||||
) -> PaginatedList[NamedUser]: ...
|
||||
|
||||
Reference in New Issue
Block a user