From ed361a7361f5ede5405ca869b998a14248154995 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sun, 7 Feb 2021 14:38:29 +0100 Subject: [PATCH] [System] Fixed some minor python warnings --- .gitignore | 1 - flaschengeist/models/user.py | 2 +- flaschengeist/plugins/balance/balance_controller.py | 7 ++++--- flaschengeist/plugins/message_mail.py | 2 +- run_flaschengeist | 2 -- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index c84197f..7718450 100644 --- a/.gitignore +++ b/.gitignore @@ -55,7 +55,6 @@ coverage.xml *.pot # Django stuff: -*.log local_settings.py db.sqlite3 diff --git a/flaschengeist/models/user.py b/flaschengeist/models/user.py index fb0f050..b8e8b83 100644 --- a/flaschengeist/models/user.py +++ b/flaschengeist/models/user.py @@ -1,5 +1,5 @@ from flask import url_for -from typing import Optional, Type +from typing import Optional from datetime import date, datetime from sqlalchemy.orm.collections import attribute_mapped_collection diff --git a/flaschengeist/plugins/balance/balance_controller.py b/flaschengeist/plugins/balance/balance_controller.py index 19ed72e..ea4d499 100644 --- a/flaschengeist/plugins/balance/balance_controller.py +++ b/flaschengeist/plugins/balance/balance_controller.py @@ -4,7 +4,7 @@ # Credit -> to account from sqlalchemy import func -from datetime import datetime, timezone +from datetime import datetime from werkzeug.exceptions import BadRequest, NotFound, Conflict from flaschengeist.database import db @@ -12,7 +12,6 @@ from flaschengeist.models.user import User from .models import Transaction from . import permissions -from ... import logger __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): 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: debit = debit.filter(start <= Transaction.time) credit = credit.filter(start <= Transaction.time) diff --git a/flaschengeist/plugins/message_mail.py b/flaschengeist/plugins/message_mail.py index 3d2f162..79b6a64 100644 --- a/flaschengeist/plugins/message_mail.py +++ b/flaschengeist/plugins/message_mail.py @@ -28,7 +28,7 @@ class MailMessagePlugin(Plugin): def send_mail(self, msg: Message): if isinstance(msg.receiver, User): 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 recipients = [msg.receiver.mail] else: diff --git a/run_flaschengeist b/run_flaschengeist index 3cf034f..522fbd0 100644 --- a/run_flaschengeist +++ b/run_flaschengeist @@ -2,9 +2,7 @@ import inspect import argparse import sys - import pkg_resources -from werkzeug.middleware.dispatcher import DispatcherMiddleware from flaschengeist.config import config