changed autoformatter

This commit is contained in:
crunk 2024-04-24 23:05:36 +02:00
parent e824430d95
commit 2db481989a
21 changed files with 63 additions and 81 deletions

View File

@ -1,3 +1,3 @@
from setuptools import setup, find_packages
from setuptools import find_packages, setup
setup(name='library', version='1.0', packages=find_packages())
setup(name="library", version="1.0", packages=find_packages())

View File

@ -1,16 +1,15 @@
import os
import shutil
from flask import render_template
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
from app import db
from distribusisinfo import DistribusisInfo
from flask import render_template
from forms.admindistribusiform import AdminDistribusiForm
from forms.adminuserform import AdminUserForm
from models.distribusimodel import Distribusis
from models.usermodel import User
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
def AdminPage():

View File

@ -1,11 +1,10 @@
import sys
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
from app import create_app, db
from models.distribusimodel import Distribusis # noqa: F401
from models.usermodel import User # noqa: F401
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
def admintool():

View File

@ -59,7 +59,6 @@ def settings():
return APP
def settings_from_file():
settings = {}
if os.path.isfile("settings_development.toml"):

View File

@ -1,8 +1,7 @@
def deploy():
"""Run deployment of database."""
from flask_migrate import init, migrate, stamp, upgrade
from app import create_app, db
from flask_migrate import init, migrate, stamp, upgrade
from models.distribusimodel import Distribusis # noqa: F401
# This model is required for flask_migrate to make the table
from models.usermodel import User # noqa: F401

View File

@ -1,13 +1,10 @@
import os
import shutil
from flask import flash, render_template
from flask_login import current_user
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
from app import db
from distribusisinfo import DistribusisInfo
from flask import flash, render_template
from flask_login import current_user
from forms.distribusiform import DistribusiForm
from forms.publicthemeform import PublicThemeForm
from forms.selectorform import SelectorForm
@ -15,6 +12,8 @@ from forms.themeform import ThemeForm
from forms.uploadform import UploadForm
from models.distribusimodel import Distribusis
from models.usermodel import User
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
# UserPengguna
from statuspengguna.helper import UserHelper

View File

@ -1,5 +1,4 @@
from flask_login import current_user
from models.distribusimodel import Distribusis
from models.usermodel import User

View File

@ -2,17 +2,13 @@ import os
import shutil
import zipfile
from app import db
# Tada!
from distribusi.cli import build_argparser
from distribusi.distribusi import distribusify
from flask import flash, redirect, render_template, url_for
from flask_login import current_user
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
from app import db
from distribusiselector import SelectorVisible
from distribusisinfo import DistribusisInfo
from flask import flash, redirect, render_template, url_for
from flask_login import current_user
from forms.distribusiform import DistribusiForm
from forms.publicthemeform import PublicThemeForm
from forms.selectorform import SelectorForm
@ -21,9 +17,13 @@ from forms.themeform import ThemeForm
from forms.uploadform import UploadForm
from models.distribusimodel import Distribusis
from models.usermodel import User
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
# UserPengguna
from statuspengguna.helper import UserHelper
from distribusi.distribusi import distribusify
def DistribusiWorkflow():
distribusiform = DistribusiForm()

View File

@ -2,14 +2,10 @@ import os
import shutil
import bleach
from bleach_allowlist import all_styles
from flask import render_template
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
from werkzeug.utils import secure_filename
from app import db
from bleach_allowlist import all_styles
from distribusisinfo import DistribusisInfo
from flask import render_template
from forms.distribusiform import DistribusiForm
from forms.editorform import EditorForm
from forms.publicthemeform import PublicThemeForm
@ -17,7 +13,10 @@ from forms.selectorform import SelectorForm
from forms.themeform import ThemeForm
from forms.uploadform import UploadForm
from models.distribusimodel import Distribusis
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
from statuspengguna.helper import UserHelper
from werkzeug.utils import secure_filename
def Editor():

View File

@ -1,3 +1,4 @@
from app import settings
from flask_wtf import FlaskForm
from flask_wtf.file import FileAllowed, FileField, FileRequired, FileSize
from wtforms import (IntegerField, SelectField, StringField, SubmitField,
@ -5,8 +6,6 @@ from wtforms import (IntegerField, SelectField, StringField, SubmitField,
from wtforms.validators import (DataRequired, Length, NumberRange,
ValidationError)
from app import settings
class UploadForm(FlaskForm):
"""File upload class for a new site in distribusi-verse"""
@ -33,7 +32,6 @@ class UploadForm(FlaskForm):
year_choices.append((str(year), str(year)))
return year_choices
sitename = StringField(
"Name of your archive section:",
validators=[

View File

@ -3,9 +3,8 @@ from __future__ import with_statement
import logging
from logging.config import fileConfig
from flask import current_app
from alembic import context
from flask import current_app
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
@ -14,17 +13,19 @@ config = context.config
# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)
logger = logging.getLogger('alembic.env')
logger = logging.getLogger("alembic.env")
# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
config.set_main_option(
'sqlalchemy.url',
str(current_app.extensions['migrate'].db.get_engine().url).replace(
'%', '%%'))
target_metadata = current_app.extensions['migrate'].db.metadata
"sqlalchemy.url",
str(current_app.extensions["migrate"].db.get_engine().url).replace(
"%", "%%"
),
)
target_metadata = current_app.extensions["migrate"].db.metadata
# other values from the config, defined by the needs of env.py,
# can be acquired:
@ -65,20 +66,20 @@ def run_migrations_online():
# when there are no changes to the schema
# reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html
def process_revision_directives(context, revision, directives):
if getattr(config.cmd_opts, 'autogenerate', False):
if getattr(config.cmd_opts, "autogenerate", False):
script = directives[0]
if script.upgrade_ops.is_empty():
directives[:] = []
logger.info('No changes in schema detected.')
logger.info("No changes in schema detected.")
connectable = current_app.extensions['migrate'].db.get_engine()
connectable = current_app.extensions["migrate"].db.get_engine()
with connectable.connect() as connection:
context.configure(
connection=connection,
target_metadata=target_metadata,
process_revision_directives=process_revision_directives,
**current_app.extensions['migrate'].configure_args
**current_app.extensions["migrate"].configure_args,
)
with context.begin_transaction():

View File

@ -1,6 +1,5 @@
from flask_login import UserMixin
from app import db
from flask_login import UserMixin
class User(UserMixin, db.Model):

View File

@ -2,12 +2,6 @@
from datetime import timedelta
from flask import (Blueprint, redirect, render_template, send_from_directory,
session, url_for)
from flask_login import current_user, login_required, logout_user
from flask_mail import Mail
from flask_wtf.csrf import CSRFError
# Interface! these are seperate files in main folder
from adminpage import AdminPage
from app import create_app, login_manager
@ -16,6 +10,11 @@ from distribusiselector import DistribusiSelector
from distribusisinfo import DistribusisInfo
from distribusiworkflow import DistribusiWorkflow
from editor import Editor
from flask import (Blueprint, redirect, render_template, send_from_directory,
session, url_for)
from flask_login import current_user, login_required, logout_user
from flask_mail import Mail
from flask_wtf.csrf import CSRFError
# Use upload form to populate filters
from forms.uploadform import UploadForm
from models.distribusimodel import Distribusis

View File

@ -1,14 +1,13 @@
from datetime import datetime
from uuid import uuid1
from app import db
from flask import render_template
from flask_mail import Message
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
from app import db
from forms.forgotpasswordform import ForgotPasswordForm
from models.usermodel import User
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
def ForgotPassword(mail):

View File

@ -1,14 +1,13 @@
import os
from flask import flash
from flask_login import current_user
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
from app import db
from distribusisinfo import DistribusisInfo
from flask import flash
from flask_login import current_user
from models.distribusimodel import Distribusis
from models.usermodel import User
from sqlalchemy.exc import (DatabaseError, DataError, InterfaceError,
InvalidRequestError)
class UserHelper:

View File

@ -1,7 +1,6 @@
from flask import abort, flash, redirect, render_template, request, url_for
from flask_bcrypt import check_password_hash
from flask_login import login_user
from forms.loginform import LoginForm
from models.usermodel import User

View File

@ -1,14 +1,13 @@
from app import db
from flask import flash, redirect, render_template, url_for
from flask_bcrypt import generate_password_hash
from flask_login import login_user
from forms.registerform import RegisterForm
from models.usermodel import User
from sqlalchemy.exc import (DatabaseError, DataError, IntegrityError,
InterfaceError, InvalidRequestError)
from werkzeug.routing import BuildError
from app import db
from forms.registerform import RegisterForm
from models.usermodel import User
def RegisterUser():
registerform = RegisterForm()

View File

@ -1,16 +1,15 @@
from datetime import datetime
from app import db
from flask import flash, redirect, render_template, url_for
from flask_bcrypt import generate_password_hash
from flask_login import login_user
from forms.resetpasswordform import ResetPasswordForm
from models.usermodel import User
from sqlalchemy.exc import (DatabaseError, DataError, IntegrityError,
InterfaceError, InvalidRequestError)
from werkzeug.routing import BuildError
from app import db
from forms.resetpasswordform import ResetPasswordForm
from models.usermodel import User
def ResetPassword(path):
linkvalid = False

View File

@ -1,9 +1,8 @@
import os
import shutil
from flask import render_template
from distribusisinfo import DistribusisInfo
from flask import render_template
from forms.distribusiform import DistribusiForm
from forms.publicthemeform import PublicThemeForm
from forms.selectorform import SelectorForm

View File

@ -1,16 +1,15 @@
import os
import shutil
from flask import flash
from flask_login import current_user
from sqlalchemy.exc import (DatabaseError, DataError, IntegrityError,
InterfaceError, InvalidRequestError)
from app import db
from distribusiselector import SelectCurrentDistribusi
from flask import flash
from flask_login import current_user
from forms.uploadform import UploadForm
from models.distribusimodel import Distribusis
from models.usermodel import User
from sqlalchemy.exc import (DatabaseError, DataError, IntegrityError,
InterfaceError, InvalidRequestError)
from statuspengguna.helper import UserHelper

View File

@ -1,14 +1,13 @@
from flask import render_template
from app import APP
from distribusiselector import SelectorVisible
from distribusisinfo import DistribusisInfo
from flask import render_template
from forms.distribusiform import DistribusiForm
from forms.publicthemeform import PublicThemeForm
from forms.selectorform import SelectorForm
from forms.themeform import ThemeForm
# UserPengguna
from statuspengguna.helper import UserHelper
from app import APP
from upload import UploadNewDistribusi, UploadUpdatedFiles