mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-05-19 15:35:08 +00:00
Fix main.py to use one ' type
This commit is contained in:
parent
f9e2a23dde
commit
cc3cde89c8
1 changed files with 10 additions and 10 deletions
|
@ -30,8 +30,8 @@ from .http import http
|
||||||
from .objects import Gist, Issue, Organization, Repository, User, File
|
from .objects import Gist, Issue, Organization, Repository, User, File
|
||||||
|
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar('T')
|
||||||
P = ParamSpec("P")
|
P = ParamSpec('P')
|
||||||
|
|
||||||
|
|
||||||
class GHClient:
|
class GHClient:
|
||||||
|
@ -71,11 +71,11 @@ class GHClient:
|
||||||
return self.start().__await__()
|
return self.start().__await__()
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return f"<{self.__class__.__name__} has_auth={bool(self._auth)}>"
|
return f'<{self.__class__.__name__} has_auth={bool(self._auth)}>'
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
asyncio.create_task(
|
asyncio.create_task(
|
||||||
self.http.session.close(), name="cleanup-session-github-api-wrapper"
|
self.http.session.close(), name='cleanup-session-github-api-wrapper'
|
||||||
)
|
)
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
|
@ -139,19 +139,19 @@ class GHClient:
|
||||||
async def wrapped(
|
async def wrapped(
|
||||||
self: Self, *args: P.args, **kwargs: P.kwargs
|
self: Self, *args: P.args, **kwargs: P.kwargs
|
||||||
) -> Optional[Union[T, User, Repository]]:
|
) -> Optional[Union[T, User, Repository]]:
|
||||||
if type == "user":
|
if type == 'user':
|
||||||
if obj := self._user_cache.get(kwargs.get("user")):
|
if obj := self._user_cache.get(kwargs.get('user')):
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
user: User = await func(self, *args, **kwargs) # type: ignore
|
user: User = await func(self, *args, **kwargs) # type: ignore
|
||||||
self._user_cache[kwargs.get("user")] = user
|
self._user_cache[kwargs.get("user")] = user
|
||||||
return user
|
return user
|
||||||
if type == "repo":
|
if type == 'repo':
|
||||||
if obj := self._repo_cache.get(kwargs.get("repo")):
|
if obj := self._repo_cache.get(kwargs.get('repo')):
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
repo: Repository = await func(self, *args, **kwargs) # type: ignore
|
repo: Repository = await func(self, *args, **kwargs) # type: ignore
|
||||||
self._repo_cache[kwargs.get("repo")] = repo
|
self._repo_cache[kwargs.get('repo')] = repo
|
||||||
return repo
|
return repo
|
||||||
|
|
||||||
return wrapped
|
return wrapped
|
||||||
|
@ -183,7 +183,7 @@ class GHClient:
|
||||||
async def create_repo(
|
async def create_repo(
|
||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
description: str = "Repository created using Github-Api-Wrapper.",
|
description: str = 'Repository created using Github-Api-Wrapper.',
|
||||||
public: bool = False,
|
public: bool = False,
|
||||||
gitignore: Optional[str] = None,
|
gitignore: Optional[str] = None,
|
||||||
license: Optional[str] = None,
|
license: Optional[str] = None,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue