mirror of
https://github.com/revanced/revanced-static-api.git
synced 2025-05-02 07:34:35 +02:00
chore: Format code
This commit is contained in:
parent
ac35644962
commit
318fa8b47d
@ -34,7 +34,6 @@ class Api:
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_members(self, organization):
|
def get_members(self, organization):
|
||||||
'''Gets the team for an organization.
|
'''Gets the team for an organization.
|
||||||
@ -116,7 +115,8 @@ class GitHubApi(Api):
|
|||||||
releases: list = requests.get(
|
releases: list = requests.get(
|
||||||
f"https://api.github.com/repos/{repository}/releases"
|
f"https://api.github.com/repos/{repository}/releases"
|
||||||
).json()
|
).json()
|
||||||
return list(map(transform_release, releases)) # List might not be needed.
|
# List might not be needed.
|
||||||
|
return list(map(transform_release, releases))
|
||||||
else:
|
else:
|
||||||
latest_release: dict = requests.get(
|
latest_release: dict = requests.get(
|
||||||
f"https://api.github.com/repos/{repository}/releases/latest?prerelease={prerelease}"
|
f"https://api.github.com/repos/{repository}/releases/latest?prerelease={prerelease}"
|
||||||
@ -143,4 +143,4 @@ class GitHubApi(Api):
|
|||||||
members = requests.get(
|
members = requests.get(
|
||||||
f'https://api.github.com/orgs/{organization}/members').json()
|
f'https://api.github.com/orgs/{organization}/members').json()
|
||||||
# List might not be needed.
|
# List might not be needed.
|
||||||
return list(map(transform_team_member, members))
|
return list(map(transform_team_member, members))
|
||||||
|
@ -44,7 +44,8 @@ class ReleaseApi(Api):
|
|||||||
|
|
||||||
create_if_not_exists(release_path)
|
create_if_not_exists(release_path)
|
||||||
|
|
||||||
write_json(release_json, join(release_path, f"{tag}.json"), overwrite=False)
|
write_json(release_json, join(
|
||||||
|
release_path, f"{tag}.json"), overwrite=False)
|
||||||
write_json(
|
write_json(
|
||||||
release_json, join(release_path, "latest.json")
|
release_json, join(release_path, "latest.json")
|
||||||
) # Overwrite the latest release
|
) # Overwrite the latest release
|
||||||
@ -89,6 +90,7 @@ class SocialApi(Api):
|
|||||||
|
|
||||||
write_json(new_social, social_path)
|
write_json(new_social, social_path)
|
||||||
|
|
||||||
|
|
||||||
class TeamApi(Api):
|
class TeamApi(Api):
|
||||||
def __init__(self, api):
|
def __init__(self, api):
|
||||||
super().__init__("team", api)
|
super().__init__("team", api)
|
||||||
@ -102,6 +104,7 @@ class TeamApi(Api):
|
|||||||
|
|
||||||
write_json(team, team_path)
|
write_json(team, team_path)
|
||||||
|
|
||||||
|
|
||||||
class DonationApi(Api):
|
class DonationApi(Api):
|
||||||
def __init__(self, api):
|
def __init__(self, api):
|
||||||
super().__init__("donation", api)
|
super().__init__("donation", api)
|
||||||
@ -113,6 +116,7 @@ class DonationApi(Api):
|
|||||||
|
|
||||||
write_json(donation, donation_path)
|
write_json(donation, donation_path)
|
||||||
|
|
||||||
|
|
||||||
class ApiProvider:
|
class ApiProvider:
|
||||||
_apis: list[Api]
|
_apis: list[Api]
|
||||||
|
|
||||||
@ -129,8 +133,8 @@ class ApiProvider:
|
|||||||
|
|
||||||
class DefaultApiProvider(ApiProvider):
|
class DefaultApiProvider(ApiProvider):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._api = api.GitHubApi() # Use GitHub as default api
|
self._api = api.GitHubApi() # Use GitHub as default api
|
||||||
|
|
||||||
super().__init__([
|
super().__init__([
|
||||||
ReleaseApi(self._api),
|
ReleaseApi(self._api),
|
||||||
ContributorApi(self._api),
|
ContributorApi(self._api),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user