mirror of
https://github.com/revanced/revanced-static-api.git
synced 2025-04-30 06:34:30 +02:00
feat: dependabot, mypy and security
This commit is contained in:
parent
860318b429
commit
00d7cc0cfa
16
.github/dependabot.yml
vendored
Normal file
16
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
assignees:
|
||||||
|
- "alexandreteles"
|
||||||
|
|
||||||
|
- package-ecosystem: "pip"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
assignees:
|
||||||
|
- "alexandreteles"
|
11
SECURITY.md
Normal file
11
SECURITY.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Tags
|
||||||
|
|
||||||
|
| Tag | ReVanced Version |
|
||||||
|
| ------- | ------------------ |
|
||||||
|
| latest | latest upstream |
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
To report a vulnerability, please open an Issue in our issue tracker here on GitHub.
|
16
mypy.ini
Normal file
16
mypy.ini
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
[mypy]
|
||||||
|
python_version = 3.11
|
||||||
|
pretty = true
|
||||||
|
follow_imports = normal
|
||||||
|
namespace_packages = true
|
||||||
|
show_column_numbers = true
|
||||||
|
show_error_codes = true
|
||||||
|
allow_redefinition = false
|
||||||
|
implicit_reexport = false
|
||||||
|
strict_optional = true
|
||||||
|
strict_equality = true
|
||||||
|
warn_no_return = true
|
||||||
|
warn_redundant_casts = true
|
||||||
|
warn_unused_configs = true
|
||||||
|
warn_unused_ignores = true
|
||||||
|
warn_unreachable = true
|
@ -58,7 +58,7 @@ class GitHubApi(Api):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def sort_and_delete_key(contributor: dict) -> int:
|
def sort_and_delete_key(contributor: dict) -> int:
|
||||||
contributions = contributor["contributions"]
|
contributions: int = contributor["contributions"]
|
||||||
del contributor["contributions"]
|
del contributor["contributions"]
|
||||||
return contributions
|
return contributions
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ from abc import abstractmethod
|
|||||||
class Api:
|
class Api:
|
||||||
_api: api.Api
|
_api: api.Api
|
||||||
|
|
||||||
def __init__(self, name: str, api: api.Api = api.GitHubApi()):
|
def __init__(self, name: str, api: api.Api = api.GitHubApi()) -> None:
|
||||||
self.name = name
|
self.name = name
|
||||||
self._api = api
|
self._api = api
|
||||||
|
|
||||||
@ -25,8 +25,9 @@ class Api:
|
|||||||
|
|
||||||
|
|
||||||
class ReleaseApi(Api):
|
class ReleaseApi(Api):
|
||||||
def __init__(self, api):
|
def __init__(self, api) -> None:
|
||||||
super().__init__("release", api)
|
super().__init__("release", api)
|
||||||
|
pass
|
||||||
|
|
||||||
def generate(self, config, path):
|
def generate(self, config, path):
|
||||||
path = join(path, "release")
|
path = join(path, "release")
|
||||||
@ -60,8 +61,9 @@ class ReleaseApi(Api):
|
|||||||
|
|
||||||
|
|
||||||
class ContributorApi(Api):
|
class ContributorApi(Api):
|
||||||
def __init__(self, api):
|
def __init__(self, api) -> None:
|
||||||
super().__init__("contributor", api)
|
super().__init__("contributor", api)
|
||||||
|
pass
|
||||||
|
|
||||||
def generate(self, config, path):
|
def generate(self, config, path):
|
||||||
path = join(path, "contributor")
|
path = join(path, "contributor")
|
||||||
@ -79,7 +81,7 @@ class ContributorApi(Api):
|
|||||||
|
|
||||||
|
|
||||||
class SocialApi(Api):
|
class SocialApi(Api):
|
||||||
def __init__(self, api):
|
def __init__(self, api) -> None:
|
||||||
super().__init__("social", api)
|
super().__init__("social", api)
|
||||||
|
|
||||||
def generate(self, config, path):
|
def generate(self, config, path):
|
||||||
@ -94,7 +96,7 @@ class SocialApi(Api):
|
|||||||
class ApiProvider:
|
class ApiProvider:
|
||||||
_apis: list[Api]
|
_apis: list[Api]
|
||||||
|
|
||||||
def __init__(self, apis: list[Api]):
|
def __init__(self, apis: list[Api]) -> None:
|
||||||
self._apis = apis
|
self._apis = apis
|
||||||
|
|
||||||
def get(self, name: str) -> Api | None:
|
def get(self, name: str) -> Api | None:
|
||||||
|
@ -2,7 +2,7 @@ import json
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
def write_json(text: str | dict | list, to, overwrite=True):
|
def write_json(text: str | dict | list, to: str, overwrite: bool = True):
|
||||||
if not os.path.exists(to) or overwrite:
|
if not os.path.exists(to) or overwrite:
|
||||||
with open(to, "w") as f:
|
with open(to, "w") as f:
|
||||||
if not isinstance(text, str):
|
if not isinstance(text, str):
|
||||||
@ -10,16 +10,16 @@ def write_json(text: str | dict | list, to, overwrite=True):
|
|||||||
f.write(text)
|
f.write(text)
|
||||||
|
|
||||||
|
|
||||||
def read_json(path, default):
|
def read_json(path: str, default: list) -> list:
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
with open(path, "r") as f:
|
with open(path, "r") as f:
|
||||||
return json.load(f)
|
return json.load(f)
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
|
||||||
def create_if_not_exists(path):
|
def create_if_not_exists(path: str):
|
||||||
os.makedirs(path, exist_ok=True)
|
os.makedirs(path, exist_ok=True)
|
||||||
|
|
||||||
|
|
||||||
def get_repository_name(repository: str):
|
def get_repository_name(repository: str) -> str:
|
||||||
return repository.split("/")[-1]
|
return repository.split("/")[-1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user