Fix maintainability:

- Resolved formatting issues using isort and black.
- Updated deprecated methods (_app_ctx_stack, datetime.utcnow).
- Added a requirements.txt file for dependency management.
- Addressed Python 3. warnings (ast.Num, ast.n).
This commit is contained in:
Michele Grimaldi 2025-01-08 21:04:06 +01:00
parent 19ecdb5052
commit 776ea9d948
6 changed files with 40 additions and 11 deletions

View file

@ -1,10 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python
import datetime
import getpass import getpass
import os import os
import random import random
import sys import sys
import datetime
import click import click
from flask.cli import FlaskGroup from flask.cli import FlaskGroup

View file

@ -82,12 +82,14 @@ class PatchedTransactionFactory(TransactionFactory):
) )
return "<Transaction %s>" % ", ".join( return "<Transaction %s>" % ", ".join(
( (
"%s=%r" % (field, value) (
if not isinstance(value, six.integer_types) "%s=%r" % (field, value)
# We want the following line to ensure that longs get if not isinstance(value, six.integer_types)
# shown without the ugly L suffix on python 2.x # We want the following line to ensure that longs get
# versions # shown without the ugly L suffix on python 2.x
else "%s=%d" % (field, value) # versions
else "%s=%d" % (field, value)
)
for field, value in field_values.items() for field, value in field_values.items()
) )
) )

View file

@ -1,5 +1,5 @@
from collections import defaultdict from collections import defaultdict
from datetime import datetime, timedelta, date from datetime import date, datetime, timedelta
import re import re
from urllib.parse import unquote, urlparse, urlunparse from urllib.parse import unquote, urlparse, urlunparse
@ -1032,7 +1032,9 @@ class TestBudget(IhatemoneyTestCase):
assert """<thead> assert """<thead>
<tr> <tr>
<th>Project</th> <th>Project</th>
<th>Number of participants</th>""" in resp.data.decode("utf-8") <th>Number of participants</th>""" in resp.data.decode(
"utf-8"
)
def test_dashboard_project_deletion(self): def test_dashboard_project_deletion(self):
self.post_project("raclette") self.post_project("raclette")

View file

@ -5,7 +5,7 @@ build-backend = "hatchling.build"
[project] [project]
name = "ihatemoney" name = "ihatemoney"
version = "6.2.0.dev0" version = "6.2.0.dev0"
requires-python = ">=3.9" requires-python = ">=3.9, <3.14"
description = "A simple shared budget manager web application." description = "A simple shared budget manager web application."
readme = "README.md" readme = "README.md"
license = {file = "LICENSE"} license = {file = "LICENSE"}
@ -20,6 +20,7 @@ classifiers = [
"Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
] ]

24
requirements.txt Normal file
View file

@ -0,0 +1,24 @@
blinker>=1.4,<2
cachetools>=4.1,<6
debts>=0.5,<1
email_validator>=1.0,<3
Flask>=2,<4
Flask-Babel>=1.0,<4
Flask-Cors>=3.0.8,<6
Flask-Limiter>=2.6,<3
Flask-Mail>=0.9.1,<1
Flask-Migrate>=2.5.3,<5
Flask-RESTful>=0.3.9,<1
Flask-SQLAlchemy>=2.4,<3
Flask-Talisman>=0.8,<2
Flask-WTF>=0.14.3,<2
itsdangerous>=2,<3
Jinja2>=3,<4
python-dateutil
qrcode>=7.1,<9
requests>=2.25,<3
SQLAlchemy>=1.4.0,<2
SQLAlchemy-Continuum>=1.3.12,<2
Werkzeug>=2,<3
WTForms>=2.3.3,<3.3
alembic>=1.14,<2

View file

@ -1,5 +1,5 @@
version = 1 version = 1
requires-python = ">=3.9" requires-python = ">=3.9, <3.14"
[[package]] [[package]]
name = "alabaster" name = "alabaster"