Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion backend_py/src/services/cameras/drivers/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ class DeviceMetadata:
(0x3961, 0x1102): DeviceMetadata("stellarHD (F)", DeviceType.STELLARHD_FOLLOWER),
# explore3D
(0x3961, 0x3112): DeviceMetadata("explore3D (Left)", DeviceType.STELLARHD_FOLLOWER),
(0x3961, 0x3111): DeviceMetadata("explore3D (Right)", DeviceType.STELLARHD_FOLLOWER),
(0x3961, 0x3111): DeviceMetadata(
"explore3D (Right)", DeviceType.STELLARHD_FOLLOWER
),
}


Expand Down
10 changes: 5 additions & 5 deletions backend_py/src/services/network/async_network_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def get_compatible_profiles(
"""
Get a list of compatible profiles for a given wired device
"""
compatible_profiles = []
compatible_profiles: list[tuple[ConnectionProfile, int]] = []

for profile in self.profiles.values():
settings = profile.settings_dict
Expand All @@ -451,13 +451,13 @@ def get_compatible_profiles(

# TODO: mac filtering

timestamp = connection_settings.get("timestamp", 0)
timestamp: int = connection_settings.get("timestamp", 0)

compatible_profiles.append({"profile": profile, "timestamp": timestamp})
compatible_profiles.append((profile, timestamp))

compatible_profiles.sort(key=lambda x: x["timestamp"], reverse=True)
compatible_profiles.sort(key=lambda x: x[1], reverse=True)

return [p["profile"] for p in compatible_profiles]
return [p[0] for p in compatible_profiles]

def get_profile(self, path: str) -> ConnectionProfile | None:
"""
Expand Down
9 changes: 5 additions & 4 deletions run_release.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import argparse
import asyncio
import os
from collections.abc import AsyncIterator
from contextlib import asynccontextmanager

import socketio
Expand All @@ -17,7 +18,7 @@

# Define events
@asynccontextmanager
async def lifespan(app: FastAPI):
async def lifespan(app: FastAPI) -> AsyncIterator[None]:
await server.serve()
yield
print("Shutting down server...")
Expand Down Expand Up @@ -86,19 +87,19 @@ async def lifespan(app: FastAPI):

# Register as a BlueOS extension
@app.get("/register_service")
async def register_service():
async def register_service() -> JSONResponse:
return JSONResponse(content=blueos_extension)

# Do API mounting before static mounting

app.mount("/", StaticFiles(directory=FRONTEND_DIR, html=True), name="static")

@app.exception_handler(404)
async def not_found(request: Request, exc: HTTPException):
async def not_found(request: Request, exc: HTTPException) -> FileResponse:
"""Serve index.html for any unknown paths (Frontend Routing Support)"""
return FileResponse(os.path.join(FRONTEND_DIR, "index.html"))

async def main():
async def main() -> None:
config = uvicorn.Config(asgi_app, host="0.0.0.0", port=args.port)
server = uvicorn.Server(config)
await server.serve()
Expand Down
6 changes: 3 additions & 3 deletions update_versioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# return None


def get_new_tag():
def get_new_tag() -> str | None:
try:
new_tag = input("Enter a new tag name: ")
if new_tag == "":
Expand All @@ -29,9 +29,9 @@ def get_new_tag():
return None


def update_version_json(new_version):
def update_version_json(new_version) -> None:
# Load the current package.json file
with open(VERSION_FILE_PATH, "r") as f:
with open(VERSION_FILE_PATH) as f:
data = json.load(f)

# Update the version string
Expand Down
Loading