chore: Remformat code

This commit is contained in:
oSumAtrIX 2023-11-03 22:37:18 +01:00
parent 57db41441b
commit 16c7ca4668
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -2,10 +2,11 @@ from abc import abstractmethod
import asyncio import asyncio
import aiohttp import aiohttp
class Api: class Api:
_api_key: str | None _api_key: str | None
_client_session = aiohttp.ClientSession() _client_session = aiohttp.ClientSession()
@abstractmethod @abstractmethod
def __init__(self, api_key: str | None = None): def __init__(self, api_key: str | None = None):
@ -56,6 +57,7 @@ class Api:
""" """
raise NotImplementedError raise NotImplementedError
class GitHubApi(Api): class GitHubApi(Api):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
@ -92,6 +94,7 @@ class GitHubApi(Api):
contributors.sort(key=sort_and_delete_key, reverse=True) contributors.sort(key=sort_and_delete_key, reverse=True)
return contributors return contributors
# TODO: Return a list of objects instead of a dict.
async def get_release( async def get_release(
self, repository: str, all: bool = False, prerelease: bool = False self, repository: str, all: bool = False, prerelease: bool = False
) -> dict | list: ) -> dict | list:
@ -104,7 +107,6 @@ class GitHubApi(Api):
Returns: Returns:
dict: The transformed release dict. dict: The transformed release dict.
""" """
return { return {
# TODO: Check if theres any need for this: 'id': release['id']. # TODO: Check if theres any need for this: 'id': release['id'].
"tag": release["tag_name"], "tag": release["tag_name"],
@ -155,5 +157,3 @@ class GitHubApi(Api):
async def is_rate_limited(self) -> bool: async def is_rate_limited(self) -> bool:
async with self._client_session.get('https://api.github.com/rate_limit') as resp: async with self._client_session.get('https://api.github.com/rate_limit') as resp:
return (await resp.json())["rate"]["remaining"] == 0 return (await resp.json())["rate"]["remaining"] == 0