fix: pylint

This commit is contained in:
Mathias DUPEUX 2025-03-05 16:46:56 +01:00
parent 761e6d810a
commit 836b91aa67

12
main.py
View file

@ -1,15 +1,18 @@
import json
import re
import os
from flask import Flask, render_template, request, send_file, make_response from flask import Flask, render_template, request, send_file, make_response
from routes.editor import editor_routes
from feedgen.feed import FeedGenerator from feedgen.feed import FeedGenerator
from dotenv import load_dotenv from dotenv import load_dotenv
from routes.editor import editor_routes
from classes import * from classes import *
import json, re, os
load_dotenv() load_dotenv()
app = Flask(__name__) app = Flask(__name__)
app.register_blueprint(editor_routes) app.register_blueprint(editor_routes)
articles_data = json.load(open("articles.json", "r", encoding="utf-8")) with open("articles.json", "r", encoding="utf-8") as f:
articles_data = json.load(f)
categories = {} # Category name:str -> [Article] categories = {} # Category name:str -> [Article]
articles = {} # ID:str = Article articles = {} # ID:str = Article
@ -23,7 +26,6 @@ fg.description("Blog RSS feed")
for article_data in articles_data: for article_data in articles_data:
category_name = article_data.get("category", "Uncategorized") category_name = article_data.get("category", "Uncategorized")
category_list = categories.get(category_name, []) category_list = categories.get(category_name, [])
article = Article( article = Article(
@ -32,7 +34,7 @@ for article_data in articles_data:
category=category_name category=category_name
) )
if article.template in list(articles.keys()): if article.template in articles.keys():
raise KeyError(f"Two articles linking to the same template ({article.template})") raise KeyError(f"Two articles linking to the same template ({article.template})")
articles[article.template] = article articles[article.template] = article