Skip to content

Commit

Permalink
only use type annotation when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrtye committed Dec 15, 2024
1 parent 790cc83 commit 70c495a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions apiserver/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ def xui_login() -> None:
def get_xui_status() -> dict[str, str]:
xui_login()

status: requests.Response = xui_session.post(XUI_URL + "/server/status")
online: requests.Response = xui_session.post(XUI_URL + "/xui/inbound/onlines")
status = xui_session.post(XUI_URL + "/server/status")
online = xui_session.post(XUI_URL + "/xui/inbound/onlines")

status: dict = status.json()
online: dict[str] = online.json()
Expand Down
12 changes: 7 additions & 5 deletions telebot/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
print("Environment variables not fulfilled")
raise SystemExit

bot: telebot.TeleBot = telebot.TeleBot(TELEBOT_TOKEN)
bot = telebot.TeleBot(TELEBOT_TOKEN)


def MarkdownV2Encode(reply) -> str:
Expand All @@ -27,7 +27,7 @@ def DefaultEncode(reply) -> str:


def containerUsage() -> list[str]:
response: requests.Response = requests.get(GLANCES_URL)
response = requests.get(GLANCES_URL)

if response.status_code != 200:
return ["Container usage is not currently available"]
Expand Down Expand Up @@ -63,7 +63,7 @@ def containerUsage() -> list[str]:


def novelUpdate() -> list[str]:
response: requests.Response = requests.get(NOVEL_URL)
response = requests.get(NOVEL_URL)

if response.status_code != 200:
return ["Novel update is not currently available"]
Expand All @@ -80,8 +80,10 @@ def novelUpdate() -> list[str]:


def restore() -> list[str]:
client: docker.DockerClient = docker.DockerClient("unix:///var/run/docker.sock")
containers: list = client.containers.list(all=True, filters={"status": "exited"})
client = docker.DockerClient("unix:///var/run/docker.sock")
containers: list[docker.models.containers.Container] = client.containers.list(
all=True, filters={"status": "exited"}
)
exited_containers: list = [
container
for container in containers
Expand Down

0 comments on commit 70c495a

Please sign in to comment.