lint: various non-semantic fixes
bumping fail-under for pylint to 9.72
This commit is contained in:
parent
7a54e4ea96
commit
f6452cb4fa
14 changed files with 47 additions and 29 deletions
|
@ -86,9 +86,8 @@ class AbstractResource(db.Model): # type: ignore
|
|||
self.deprecation_reason = reason
|
||||
self.updated = datetime.utcnow()
|
||||
return True
|
||||
else:
|
||||
logging.info("Not deprecating %s (reason=%s) because it's already deprecated", self.brn, reason)
|
||||
return False
|
||||
logging.info("Not deprecating %s (reason=%s) because it's already deprecated", self.brn, reason)
|
||||
return False
|
||||
|
||||
def destroy(self) -> None:
|
||||
"""
|
||||
|
|
|
@ -3,6 +3,7 @@ from typing import Any, Optional
|
|||
|
||||
import requests
|
||||
|
||||
from app.brm.brn import BRN
|
||||
from app.models import AbstractConfiguration
|
||||
from app.extensions import db
|
||||
|
||||
|
@ -49,6 +50,16 @@ class Webhook(AbstractConfiguration):
|
|||
format = db.Column(db.String(20))
|
||||
url = db.Column(db.String(255))
|
||||
|
||||
@property
|
||||
def brn(self) -> BRN:
|
||||
return BRN(
|
||||
group_id=0,
|
||||
product="notify",
|
||||
provider=self.format,
|
||||
resource_type="conf",
|
||||
resource_id=self.id
|
||||
)
|
||||
|
||||
def send(self, text: str) -> None:
|
||||
if self.format == "telegram":
|
||||
data = {"text": text}
|
||||
|
|
|
@ -3,6 +3,7 @@ from datetime import datetime
|
|||
from typing import List, Any
|
||||
|
||||
from app.extensions import db
|
||||
from app.models.activity import Activity
|
||||
|
||||
|
||||
class AlarmState(enum.Enum):
|
||||
|
@ -29,8 +30,6 @@ class Alarm(db.Model): # type: ignore
|
|||
return [getattr(self, x) for x in self.csv_header()]
|
||||
|
||||
def update_state(self, state: AlarmState, text: str) -> None:
|
||||
from app.models.activity import Activity
|
||||
|
||||
if self.alarm_state is None:
|
||||
self.alarm_state = AlarmState.UNKNOWN
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from datetime import datetime
|
||||
from typing import List
|
||||
|
||||
from app.brm.brn import BRN
|
||||
from app.extensions import db
|
||||
from app.models import AbstractConfiguration, AbstractResource
|
||||
|
||||
|
@ -15,6 +16,16 @@ class BridgeConf(AbstractConfiguration):
|
|||
group = db.relationship("Group", back_populates="bridgeconfs")
|
||||
bridges = db.relationship("Bridge", back_populates="conf")
|
||||
|
||||
@property
|
||||
def brn(self) -> BRN:
|
||||
return BRN(
|
||||
group_id=self.group_id,
|
||||
product="bridge",
|
||||
provider="",
|
||||
resource_type="bridgeconf",
|
||||
resource_id=str(self.id)
|
||||
)
|
||||
|
||||
def destroy(self) -> None:
|
||||
self.destroyed = datetime.utcnow()
|
||||
self.updated = datetime.utcnow()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue