Skip to content

Commit f0a938f

Browse files
committed
typing fixes
1 parent 87e5a3a commit f0a938f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

backend/btrixcloud/crawlconfigs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def __init__(
108108
self.crawler_images_map = {}
109109
channels = []
110110
with open(os.environ["CRAWLER_CHANNELS_JSON"], encoding="utf-8") as fh:
111-
crawler_list: list[dict] = json.loads(fh.read())
111+
crawler_list = json.loads(fh.read())
112112
for channel_data in crawler_list:
113113
channel = CrawlerChannel(**channel_data)
114114
channels.append(channel)
@@ -434,7 +434,7 @@ async def get_crawl_configs(
434434
schedule: Optional[bool] = None,
435435
sort_by: str = "lastRun",
436436
sort_direction: int = -1,
437-
):
437+
) -> tuple[list[CrawlConfigOut], int]:
438438
"""Get all crawl configs for an organization is a member of"""
439439
# pylint: disable=too-many-locals,too-many-branches
440440
# Zero-index page for query

backend/btrixcloud/operator/baseoperator.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import asyncio
44
import os
5-
from typing import TYPE_CHECKING
5+
from typing import TYPE_CHECKING, Any
66
from kubernetes.utils import parse_quantity
77

88
import yaml
@@ -44,7 +44,7 @@ def __init__(self):
4444
self.compute_crawler_resources()
4545
self.compute_profile_resources()
4646

47-
def compute_crawler_resources(self):
47+
def compute_crawler_resources(self) -> None:
4848
"""compute memory / cpu resources for crawlers"""
4949
p = self.shared_params
5050
num_workers = max(int(p["crawler_browser_instances"]), 1)
@@ -105,7 +105,7 @@ def compute_crawler_resources(self):
105105
p["qa_memory"] = qa_memory
106106
p["qa_workers"] = qa_num_workers
107107

108-
def compute_profile_resources(self):
108+
def compute_profile_resources(self) -> None:
109109
"""compute memory /cpu resources for a single profile browser"""
110110
p = self.shared_params
111111
# if no profile specific options provided, default to crawler base for one browser
@@ -122,7 +122,7 @@ def compute_profile_resources(self):
122122
print(f"cpu = {profile_cpu}")
123123
print(f"memory = {profile_memory}")
124124

125-
async def async_init(self):
125+
async def async_init(self) -> None:
126126
"""perform any async init here"""
127127
self.has_pod_metrics = await self.is_pod_metrics_available()
128128
print("Pod Metrics Available:", self.has_pod_metrics)
@@ -172,16 +172,16 @@ def __init__(
172172
# see: https://stackoverflow.com/a/74059981
173173
self.bg_tasks = set()
174174

175-
def init_routes(self, app):
175+
def init_routes(self, app) -> None:
176176
"""init routes for this operator"""
177177

178-
def run_task(self, func):
178+
def run_task(self, func) -> None:
179179
"""add bg tasks to set to avoid premature garbage collection"""
180180
task = asyncio.create_task(func)
181181
self.bg_tasks.add(task)
182182
task.add_done_callback(self.bg_tasks.discard)
183183

184-
def load_from_yaml(self, filename, params):
184+
def load_from_yaml(self, filename, params) -> list[Any]:
185185
"""load and parse k8s template from yaml file"""
186186
return list(
187187
yaml.safe_load_all(

0 commit comments

Comments
 (0)