20 lines
447 B
Python
20 lines
447 B
Python
from typing import Protocol
|
|||
|
|
|
||
|
|
|
||
|
|
class WeatherProvider(Protocol):
|
||
|
|
def get_current(self) -> dict: ...
|
||
|
|
def get_forecast(self) -> list[dict]: ...
|
||
|
|
|
||
|
|
|
||
|
|
class MockWeatherProvider:
|
||
|
|
def get_current(self):
|
||
|
|
return {
|
||
|
|
"location": "上海",
|
||
|
|
"temperature": "--",
|
||
|
|
"summary": "天气演示数据 · 尚未连接实时天气源",
|
||
|
|
"mock": True,
|
||
|
|
}
|
||
|
|
|
||
|
|
def get_forecast(self):
|
||
|
|
return []
|