1
Fork 0
mirror of https://github.com/RGBCube/GitHubWrapper synced 2025-05-19 15:35:08 +00:00

fix some repr and change File import

This commit is contained in:
VarMonke 2022-04-27 19:53:22 +05:30
parent 104203fb3f
commit 428b7e97ed
2 changed files with 4 additions and 8 deletions

View file

@ -11,15 +11,13 @@ from types import SimpleNamespace
from typing import TYPE_CHECKING, Dict, Union, List from typing import TYPE_CHECKING, Dict, Union, List
import platform import platform
if TYPE_CHECKING:
from .main import File
import aiohttp import aiohttp
from .exceptions import * from .exceptions import *
from .exceptions import GistNotFound, RepositoryAlreadyExists, MissingPermissions from .exceptions import GistNotFound, RepositoryAlreadyExists, MissingPermissions
from .objects import APIObject, User, Gist, Repository, Organization from .objects import APIObject, User, Gist, Repository, Organization, File
from .urls import * from .urls import *
__version__ = '0.0.1' __version__ = '0.0.1'
__all__ = ( __all__ = (

View file

@ -16,8 +16,6 @@ from . import exceptions
from .cache import RepoCache, UserCache from .cache import RepoCache, UserCache
from .http import http from .http import http
from .objects import Gist, Issue, Organization, Repository, User, File from .objects import Gist, Issue, Organization, Repository, User, File
from .urls import BASE_URL
class GHClient: class GHClient:
_auth = None _auth = None
@ -46,7 +44,7 @@ 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(self.http.session.close()) asyncio.create_task(self.http.session.close())
@ -59,7 +57,7 @@ class GHClient:
for key, value in self.http.session._rates._asdict().items(): for key, value in self.http.session._rates._asdict().items():
output.append(f'{key} : {value}') output.append(f'{key} : {value}')
return output return output
return self.http.session._rates._asdict() return self.http.session._rates
async def update_auth(self, username: str, token: str) -> None: async def update_auth(self, username: str, token: str) -> None:
"""Allows you to input auth information after instantiating the client.""" """Allows you to input auth information after instantiating the client."""