Add pylint flake8
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2020-12-08 17:17:24 +01:00
parent 012b474a79
commit d73beb9be4
3 changed files with 12 additions and 9 deletions

View File

@ -3,6 +3,11 @@ name: default
type: docker type: docker
steps: steps:
- name: flake8
image: python
commands:
- pip install flake8
- flake8 pynyaata --ignore=E501
- name: docker - name: docker
image: plugins/docker image: plugins/docker
settings: settings:

View File

@ -2,13 +2,12 @@ from functools import wraps
from operator import attrgetter, itemgetter from operator import attrgetter, itemgetter
from flask import redirect, render_template, request, url_for, abort from flask import redirect, render_template, request, url_for, abort
from werkzeug.security import check_password_hash
import utils
from .config import app, auth, ADMIN_USERNAME, ADMIN_PASSWORD, MYSQL_ENABLED, APP_PORT, IS_DEBUG from .config import app, auth, ADMIN_USERNAME, ADMIN_PASSWORD, MYSQL_ENABLED, APP_PORT, IS_DEBUG
from .connectors import * from .connectors import get_instance, run_all
from .connectors.core import ConnectorCore, ConnectorLang, ConnectorReturn from .connectors.core import ConnectorLang, ConnectorReturn
from .forms import SearchForm, DeleteForm, EditForm from .forms import SearchForm, DeleteForm, EditForm
from .utils import boldify, clean_model
if MYSQL_ENABLED: if MYSQL_ENABLED:
from .config import db from .config import db
@ -27,7 +26,7 @@ def mysql_required(f):
@auth.verify_password @auth.verify_password
def verify_password(username, password): def verify_password(username, password):
return username == ADMIN_USERNAME and check_password_hash(ADMIN_PASSWORD, password) return username == ADMIN_USERNAME and ADMIN_PASSWORD == password
@app.template_filter('boldify') @app.template_filter('boldify')
@ -179,8 +178,8 @@ def admin_edit(link_id=None):
link = AnimeLink.query.filter_by(id=link_id).first() link = AnimeLink.query.filter_by(id=link_id).first()
form.folder.data = link.title.folder.id form.folder.data = link.title.folder.id
else: else:
link = clean_model(AnimeLink()) link = utils.clean_model(AnimeLink())
link.title = clean_model(AnimeTitle()) link.title = utils.clean_model(AnimeTitle())
link.vf = False link.vf = False
return render_template('admin/edit.html', search_form=SearchForm(), link=link, folders=folders, action_form=form) return render_template('admin/edit.html', search_form=SearchForm(), link=link, folders=folders, action_form=form)

View File

@ -4,13 +4,12 @@ from flask import Flask
from flask.cli import load_dotenv from flask.cli import load_dotenv
from flask_httpauth import HTTPBasicAuth from flask_httpauth import HTTPBasicAuth
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash
load_dotenv() load_dotenv()
IS_DEBUG = environ.get('FLASK_ENV', 'production') == 'development' IS_DEBUG = environ.get('FLASK_ENV', 'production') == 'development'
ADMIN_USERNAME = environ.get('ADMIN_USERNAME', 'admin') ADMIN_USERNAME = environ.get('ADMIN_USERNAME', 'admin')
ADMIN_PASSWORD = generate_password_hash(environ.get('ADMIN_PASSWORD', 'secret')) ADMIN_PASSWORD = environ.get('ADMIN_PASSWORD', 'secret')
APP_PORT = int(environ.get('FLASK_PORT', 5000)) APP_PORT = int(environ.get('FLASK_PORT', 5000))
CACHE_TIMEOUT = int(environ.get('CACHE_TIMEOUT', 60 * 60)) CACHE_TIMEOUT = int(environ.get('CACHE_TIMEOUT', 60 * 60))
REQUESTS_TIMEOUT = int(environ.get('REQUESTS_TIMEOUT', 5)) REQUESTS_TIMEOUT = int(environ.get('REQUESTS_TIMEOUT', 5))