lots of typing fixes
This commit is contained in:
parent
51f580a304
commit
3665c34961
43 changed files with 260 additions and 178 deletions
|
@ -1,4 +1,5 @@
|
|||
import datetime
|
||||
from typing import Optional
|
||||
|
||||
from app.extensions import db
|
||||
from app.models.alarms import Alarm
|
||||
|
@ -7,9 +8,10 @@ from app.models.alarms import Alarm
|
|||
def _get_alarm(target: str,
|
||||
alarm_type: str,
|
||||
*,
|
||||
proxy_id=None,
|
||||
origin_id=None,
|
||||
create_if_missing=True):
|
||||
proxy_id: Optional[int] = None,
|
||||
origin_id: Optional[int] = None,
|
||||
create_if_missing: bool = True) -> Optional[Alarm]:
|
||||
alarm: Optional[Alarm]
|
||||
if target == "proxy":
|
||||
alarm = Alarm.query.filter(
|
||||
Alarm.target == "proxy",
|
||||
|
@ -38,5 +40,7 @@ def _get_alarm(target: str,
|
|||
return alarm
|
||||
|
||||
|
||||
def get_proxy_alarm(proxy_id: int, alarm_type: str):
|
||||
return _get_alarm("proxy", alarm_type, proxy_id=proxy_id)
|
||||
def get_proxy_alarm(proxy_id: int, alarm_type: str) -> Alarm:
|
||||
alarm = _get_alarm("proxy", alarm_type, proxy_id=proxy_id)
|
||||
assert(alarm is not None)
|
||||
return alarm
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue