[System] Fixed some minor python warnings

This commit is contained in:
Ferdinand Thiessen 2021-02-07 14:38:29 +01:00
parent 791656147e
commit ed361a7361
5 changed files with 6 additions and 8 deletions

1
.gitignore vendored
View File

@ -55,7 +55,6 @@ coverage.xml
*.pot *.pot
# Django stuff: # Django stuff:
*.log
local_settings.py local_settings.py
db.sqlite3 db.sqlite3

View File

@ -1,5 +1,5 @@
from flask import url_for from flask import url_for
from typing import Optional, Type from typing import Optional
from datetime import date, datetime from datetime import date, datetime
from sqlalchemy.orm.collections import attribute_mapped_collection from sqlalchemy.orm.collections import attribute_mapped_collection

View File

@ -4,7 +4,7 @@
# Credit -> to account # Credit -> to account
from sqlalchemy import func from sqlalchemy import func
from datetime import datetime, timezone from datetime import datetime
from werkzeug.exceptions import BadRequest, NotFound, Conflict from werkzeug.exceptions import BadRequest, NotFound, Conflict
from flaschengeist.database import db from flaschengeist.database import db
@ -12,7 +12,6 @@ from flaschengeist.models.user import User
from .models import Transaction from .models import Transaction
from . import permissions from . import permissions
from ... import logger
__attribute_limit = "balance_limit" __attribute_limit = "balance_limit"
@ -41,7 +40,9 @@ def get_balance(user, start: datetime = None, end: datetime = None):
def get_balances(start: datetime = None, end: datetime = None): def get_balances(start: datetime = None, end: datetime = None):
debit = db.session.query(Transaction.sender_id, func.sum(Transaction.amount)).filter(Transaction.sender_ != None) debit = db.session.query(Transaction.sender_id, func.sum(Transaction.amount)).filter(Transaction.sender_ != None)
credit = db.session.query(Transaction.receiver_id, func.sum(Transaction.amount)).filter(Transaction.receiver_ != None) credit = db.session.query(Transaction.receiver_id, func.sum(Transaction.amount)).filter(
Transaction.receiver_ != None
)
if start: if start:
debit = debit.filter(start <= Transaction.time) debit = debit.filter(start <= Transaction.time)
credit = credit.filter(start <= Transaction.time) credit = credit.filter(start <= Transaction.time)

View File

@ -28,7 +28,7 @@ class MailMessagePlugin(Plugin):
def send_mail(self, msg: Message): def send_mail(self, msg: Message):
if isinstance(msg.receiver, User): if isinstance(msg.receiver, User):
if not msg.receiver.mail: if not msg.receiver.mail:
logger.warn("Could not send Mail, mail missing: {}".format(msg.receiver)) logger.warning("Could not send Mail, mail missing: {}".format(msg.receiver))
return return
recipients = [msg.receiver.mail] recipients = [msg.receiver.mail]
else: else:

View File

@ -2,9 +2,7 @@
import inspect import inspect
import argparse import argparse
import sys import sys
import pkg_resources import pkg_resources
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from flaschengeist.config import config from flaschengeist.config import config