Fix linting

This commit is contained in:
Matthew Stratford 2021-09-22 20:14:58 +01:00
parent a172d03f0e
commit 0cdfd7b2fe
6 changed files with 15 additions and 8 deletions

View file

@ -48,7 +48,9 @@ class PlayerAlertProvider(AlertProvider):
"start_time": -1, # Now
"id": "no_channels",
"title": "There are no players configured.",
"description": "The number of channels configured is {}. Please set to at least 1 on the 'Server Config' page.".format(self._player_count),
"description": "The number of channels configured is {}. \
Please set to at least 1 on the 'Server Config' page."
.format(self._player_count),
"module": MODULE+"Handler",
"severity": CRITICAL
})]
@ -61,7 +63,8 @@ class PlayerAlertProvider(AlertProvider):
"start_time": -1, # Now
"id": "player_{}_not_initialised".format(channel),
"title": "Player {} is not initialised.".format(channel),
"description": "This typically means the player channel was not able find the configured sound output on the system. Please check the 'Player Config' and Player logs to determine the cause.",
"description": "This typically means the player channel was not able find the configured sound output \
on the system. Please check the 'Player Config' and Player logs to determine the cause.",
"module": MODULE+str(channel),
"severity": CRITICAL
}))

View file

@ -37,7 +37,8 @@ class ServerAlertProvider(AlertProvider):
"start_time": -1, # Now
"id": "api_key_missing",
"title": "MyRadio API Key is not configured.",
"description": "This means you will be unable to load show plans, audio items, or tracklist. Please set one on the 'Server Config' page.",
"description": "This means you will be unable to load show plans, audio items, or tracklist. \
Please set one on the 'Server Config' page.",
"module": MODULE,
"severity": CRITICAL
})]
@ -47,7 +48,8 @@ class ServerAlertProvider(AlertProvider):
"start_time": -1,
"id": "api_key_missing",
"title": "MyRadio API Key seems incorrect.",
"description": "The API key is less than 10 characters, it's probably not a valid one. If it is valid, it shouldn't be.",
"description": "The API key is less than 10 characters, it's probably not a valid one. \
If it is valid, it shouldn't be.",
"module": MODULE,
"severity": WARNING
})]

View file

@ -56,7 +56,8 @@ class Alert:
raise KeyError("Key {} is missing from data to create Alert.".format(key))
# if type(new_data[key]) != type(getattr(self,key)):
# raise TypeError("Key {} has type {}, was expecting {}.".format(key, type(new_data[key]), type(getattr(self,key))))
# raise TypeError("Key {} has type {}, was expecting {}."
# .format(key, type(new_data[key]), type(getattr(self,key))))
# Account for if the creator didn't want to set a custom time.
if key == "start_time" and new_data[key] == -1:

View file

@ -6,7 +6,7 @@ from importlib import import_module
from inspect import getmembers, isclass
from sys import modules
from baps_types.alert import CRITICAL, Alert
from baps_types.alert import Alert
import alerts

View file

@ -13,7 +13,7 @@
"presenter-make": "npm run presenter-install && (rm -r presenter-build || true) && cd presenter && yarn build-baps && cp -r build ../presenter-build && cd ../ && npm install",
"test": "echo \"Error: no test specified\" && exit 1",
"presenter-start": "cd presenter && yarn start-baps",
"lint": "autopep8 -r -a -a --ignore E402,E226,E24,W50,W690 --max-line-length 127 --in-place --exclude=\"*node_modules*,*venv/*,presenter/*\" . "
"lint": "./venv/bin/autopep8 -r -a -a --ignore E402,E226,E24,W50,W690 --max-line-length 127 --in-place --exclude=\"*node_modules*,*venv/*,presenter/*\" . && ./venv/bin/flake8 . --exclude=\"*node_modules*,*venv/*,presenter/*\" --count --ignore=E402,E226,E24,W50,W690 --max-complexity=25 --max-line-length=127 --statistics"
},
"repository": {
"type": "git",

View file

@ -1,5 +1,5 @@
from sanic import Sanic
from sanic.exceptions import NotFound, ServerError, abort
from sanic.exceptions import NotFound, abort
from sanic.response import html, file, redirect
from sanic.response import json as resp_json
from sanic_cors import CORS
@ -119,6 +119,7 @@ def page_not_found(request, e: Any):
"message": "Looks like you fell off the tip of the iceberg."}
return render_template("error.html", data=data, status=404)
# Future use.
def error_page(code=500, ui_title="500", title="Something went very wrong!",
message="Looks like the server fell over. Try viewing the WebServer logs for more details."):