Code cleanup and dependency updates
- Remove unused imports (abort, g, ngettext) from app.py - Remove unused variables (werktage, datumsrechnung, werktagsrechnung, wochen_monate) - Update Flask from 3.0.0 to 3.1.1 - Update requests from 2.31.0 to 2.32.4 - Update pytest from 7.4.3 to 8.4.1 - Update numpy from 1.26.4 to 2.3.2 (safe migration based on NumPy 2.0 guide) - Add pytest to requirements.txt (was missing)
This commit is contained in:
8
app.py
8
app.py
@@ -1,5 +1,5 @@
|
|||||||
from flask import Flask, render_template, request, redirect, url_for, session, abort, jsonify, g, make_response
|
from flask import Flask, render_template, request, redirect, url_for, session, jsonify, make_response
|
||||||
from flask_babel import Babel, gettext, ngettext, get_locale
|
from flask_babel import Babel, gettext, get_locale
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
@@ -118,7 +118,7 @@ def index():
|
|||||||
with open(log_path, 'a', encoding='utf-8') as f:
|
with open(log_path, 'a', encoding='utf-8') as f:
|
||||||
from datetime import datetime as dt
|
from datetime import datetime as dt
|
||||||
f.write(f"{dt.now().isoformat()} PAGEVIEW\n")
|
f.write(f"{dt.now().isoformat()} PAGEVIEW\n")
|
||||||
tage = werktage = wochentag = datumsrechnung = werktagsrechnung = kw_berechnen = kw_datum = wochen_monate = None
|
tage = wochentag = kw_berechnen = kw_datum = None
|
||||||
feiertage_anzahl = wochenendtage_anzahl = None
|
feiertage_anzahl = wochenendtage_anzahl = None
|
||||||
active_idx = 0
|
active_idx = 0
|
||||||
plusminus_result = None
|
plusminus_result = None
|
||||||
@@ -245,7 +245,7 @@ def index():
|
|||||||
plusminus_result = f"Datum {d.strftime('%d.%m.%Y')} {'plus' if anzahl_int>=0 else 'minus'} {abs(anzahl_int)} Monate: {result.strftime('%d.%m.%Y')}"
|
plusminus_result = f"Datum {d.strftime('%d.%m.%Y')} {'plus' if anzahl_int>=0 else 'minus'} {abs(anzahl_int)} Monate: {result.strftime('%d.%m.%Y')}"
|
||||||
except Exception:
|
except Exception:
|
||||||
plusminus_result = gettext('Ungültige Eingabe')
|
plusminus_result = gettext('Ungültige Eingabe')
|
||||||
response = make_response(render_template('index.html', tage=tage, werktage=werktage, wochentag=wochentag, plusminus_result=plusminus_result, kw_berechnen=kw_berechnen, kw_datum=kw_datum, active_idx=active_idx
|
response = make_response(render_template('index.html', tage=tage, wochentag=wochentag, plusminus_result=plusminus_result, kw_berechnen=kw_berechnen, kw_datum=kw_datum, active_idx=active_idx
|
||||||
, feiertage_anzahl=feiertage_anzahl, wochenendtage_anzahl=wochenendtage_anzahl, app_version=APP_VERSION, get_locale=get_locale
|
, feiertage_anzahl=feiertage_anzahl, wochenendtage_anzahl=wochenendtage_anzahl, app_version=APP_VERSION, get_locale=get_locale
|
||||||
))
|
))
|
||||||
return add_cache_headers(response)
|
return add_cache_headers(response)
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
Flask==3.0.0
|
Flask==3.1.1
|
||||||
numpy==1.26.4
|
numpy==2.3.2
|
||||||
python-dateutil==2.9.0.post0
|
python-dateutil==2.9.0.post0
|
||||||
requests==2.31.0
|
requests==2.32.4
|
||||||
Flask-Babel==4.0.0
|
Flask-Babel==4.0.0
|
||||||
|
pytest==8.4.1
|
Reference in New Issue
Block a user