mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 11:36:16 +00:00
Bendover for PyLint
This commit is contained in:
parent
e784ca3011
commit
b426a6f6c4
8 changed files with 65 additions and 48 deletions
|
@ -13,12 +13,13 @@ from flask_caching import Cache
|
|||
from flask_assets import Environment, Bundle
|
||||
from flask import Flask, render_template
|
||||
|
||||
from gallery.utils import theme_manager
|
||||
|
||||
# Configuration
|
||||
from dotenv import load_dotenv
|
||||
import platformdirs
|
||||
from yaml import FullLoader, load
|
||||
from dotenv import load_dotenv
|
||||
from yaml import FullLoader, safe_load
|
||||
|
||||
# Utils
|
||||
from gallery.utils import theme_manager
|
||||
|
||||
|
||||
USER_DIR = platformdirs.user_config_dir('onlylegs')
|
||||
|
@ -32,14 +33,14 @@ def create_app(test_config=None):
|
|||
assets = Environment()
|
||||
cache = Cache(config={'CACHE_TYPE': 'SimpleCache', 'CACHE_DEFAULT_TIMEOUT': 300})
|
||||
compress = Compress()
|
||||
|
||||
|
||||
# Get environment variables
|
||||
load_dotenv(os.path.join(USER_DIR, '.env'))
|
||||
print("Loaded environment variables")
|
||||
|
||||
# Get config file
|
||||
with open(os.path.join(USER_DIR, 'conf.yml'), encoding='utf-8') as f:
|
||||
conf = load(f, Loader=FullLoader)
|
||||
with open(os.path.join(USER_DIR, 'conf.yml'), encoding='utf-8') as file:
|
||||
conf = safe_load(file, loader=FullLoader)
|
||||
print("Loaded gallery config")
|
||||
|
||||
# App configuration
|
||||
|
@ -64,10 +65,10 @@ def create_app(test_config=None):
|
|||
|
||||
# Load theme
|
||||
theme_manager.CompileTheme('default', app.root_path)
|
||||
|
||||
|
||||
# Bundle JS files
|
||||
js = Bundle('js/*.js', output='gen/packed.js')
|
||||
assets.register('js_all', js)
|
||||
js_scripts = Bundle('js/*.js', output='gen/packed.js')
|
||||
assets.register('js_all', js_scripts)
|
||||
|
||||
# Error handlers
|
||||
@app.errorhandler(403)
|
||||
|
|
|
@ -4,7 +4,8 @@ OnlyLegs - Database models and functions for SQLAlchemy
|
|||
import os
|
||||
import platformdirs
|
||||
|
||||
from sqlalchemy import create_engine, Column, Integer, String, Boolean, DateTime, ForeignKey, PickleType
|
||||
from sqlalchemy import (
|
||||
create_engine, Column, Integer, String, Boolean, DateTime, ForeignKey, PickleType)
|
||||
from sqlalchemy.orm import declarative_base, relationship
|
||||
|
||||
|
||||
|
@ -47,18 +48,18 @@ class Posts (base): # pylint: disable=too-few-public-methods, C0103
|
|||
id = Column(Integer, primary_key=True)
|
||||
author_id = Column(Integer, ForeignKey('users.id'))
|
||||
created_at = Column(DateTime, nullable=False)
|
||||
|
||||
|
||||
file_name = Column(String, unique=True, nullable=False)
|
||||
file_type = Column(String, nullable=False)
|
||||
|
||||
|
||||
image_exif = Column(PickleType, nullable=False)
|
||||
image_colours = Column(PickleType, nullable=False)
|
||||
|
||||
|
||||
post_description = Column(String, nullable=False)
|
||||
post_alt = Column(String, nullable=False)
|
||||
|
||||
junction = relationship('GroupJunction', backref='posts')
|
||||
|
||||
|
||||
|
||||
class Thumbnails (base): # pylint: disable=too-few-public-methods, C0103
|
||||
"""
|
||||
|
@ -148,4 +149,4 @@ class Bans (base): # pylint: disable=too-few-public-methods, C0103
|
|||
# check if database file exists, if not create it
|
||||
if not os.path.isfile(DB_PATH):
|
||||
base.metadata.create_all(engine)
|
||||
print('Database created')
|
||||
print('Database created')
|
||||
|
|
|
@ -65,7 +65,7 @@ class Metadata:
|
|||
'Software': {},
|
||||
'File': {},
|
||||
}
|
||||
|
||||
|
||||
# Thanks chatGPT xP
|
||||
for key, value in encoded_exif.items():
|
||||
for mapping_name, mapping_val in EXIF_MAPPING:
|
||||
|
|
|
@ -279,7 +279,7 @@ def lens_specification(value):
|
|||
"""
|
||||
try:
|
||||
return str(value[0] / value[1]) + 'mm - ' + str(value[2] / value[3]) + 'mm'
|
||||
except Exception as err:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class CompileTheme:
|
|||
if not os.path.exists(theme_path):
|
||||
print("Theme does not exist!")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if not os.path.exists(theme_dest):
|
||||
os.makedirs(theme_dest)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue