mirror of
https://github.com/revanced/revanced-static-api.git
synced 2025-04-30 06:34:30 +02:00
chore: Remformat code
This commit is contained in:
parent
57db41441b
commit
16c7ca4668
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user