Fix flake8
This commit is contained in:
@@ -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__ = []
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
__author__ = 'RemiZOffAlex'
|
||||
__copyright__ = '(c) RemiZOffAlex'
|
||||
__license__ = 'MIT'
|
||||
__email__ = 'remizoffalex@mail.ru'
|
||||
__url__ = 'https://remizoffalex.ru'
|
||||
|
||||
from math import ceil
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
"""
|
||||
Сформировать дерево каталогов
|
||||
|
||||
Reference in New Issue
Block a user