Iteration 1: - Dark theme with 3-way toggle - Dynamic heatmap gradient (blue→red) - Radius up to 100km - Save & Calculate workflow Iteration 2: - Terrain overlay toggle - Batch height operations - Zoom-dependent heatmap rendering Infrastructure: - Backend FastAPI on 8888 - Frontend static build via Caddy - Systemd services - Caddy reverse proxy integration
34 lines
783 B
Python
34 lines
783 B
Python
from __future__ import annotations
|
|
|
|
from abc import ABCMeta, abstractmethod
|
|
from types import TracebackType
|
|
from typing import TypeVar
|
|
|
|
T = TypeVar("T")
|
|
|
|
|
|
class AsyncResource(metaclass=ABCMeta):
|
|
"""
|
|
Abstract base class for all closeable asynchronous resources.
|
|
|
|
Works as an asynchronous context manager which returns the instance itself on enter,
|
|
and calls :meth:`aclose` on exit.
|
|
"""
|
|
|
|
__slots__ = ()
|
|
|
|
async def __aenter__(self: T) -> T:
|
|
return self
|
|
|
|
async def __aexit__(
|
|
self,
|
|
exc_type: type[BaseException] | None,
|
|
exc_val: BaseException | None,
|
|
exc_tb: TracebackType | None,
|
|
) -> None:
|
|
await self.aclose()
|
|
|
|
@abstractmethod
|
|
async def aclose(self) -> None:
|
|
"""Close the resource."""
|