Fix flake8

This commit is contained in:
RemiZOffAlex
2020-08-17 19:57:37 +03:00
parent a9736c09fe
commit ae5c629782
46 changed files with 229 additions and 336 deletions

View File

@@ -1,12 +1,10 @@
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'https://remizoffalex.ru'
from .pagination import Pagination, getpage
from .passwd import pwgen, get_hash_password
from .storage import gettree, gethashtree
from .info import get_user
from .pagination import Pagination, getpage # noqa F401
from .passwd import pwgen, get_hash_password # noqa F401
from .storage import gettree, gethashtree # noqa F401
from .info import get_user # noqa F401
__all__ = []

View File

@@ -1,22 +1,20 @@
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'https://remizoffalex.ru'
from flask import session, request
from .. import app, models
from flask import session
from .. import models
def get_user():
"""
Получить текущего пользователя
"""Получить текущего пользователя
"""
result = None
if 'user_id' in session:
result = models.db_session.query(
models.User
).filter(
models.User.id==session['user_id']
models.User.id == session['user_id']
).first()
if result is None:
session.pop('logged_in', None)

View File

@@ -1,8 +1,6 @@
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'https://remizoffalex.ru'
from math import ceil

View File

@@ -1,16 +1,14 @@
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'https://remizoffalex.ru'
import uuid
import random
import hashlib
def pwgen(length=15, hex=False):
"""
Генератор пароля
"""Генератор пароля
"""
keylist = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
if hex:
@@ -22,9 +20,9 @@ def pwgen(length=15, hex=False):
password.append(a_char)
return ''.join(password)
def get_hash_password(password, salt=None):
"""
Получить хеш пароля SHA-512
"""Получить хеш пароля SHA-512
"""
if salt is None:
salt = uuid.uuid4().hex

View File

@@ -1,8 +1,7 @@
__author__ = 'RemiZOffAlex'
__copyright__ = '(c) RemiZOffAlex'
__license__ = 'MIT'
__email__ = 'remizoffalex@mail.ru'
__url__ = 'https://remizoffalex.ru'
def gettree(number, count=3):
"""
@@ -16,6 +15,7 @@ def gettree(number, count=3):
result.append(newline[i*count:i*count+count])
return result
def gethashtree(hash, count=3):
"""
Сформировать дерево каталогов