From d3777d3b07245194fdb7fc89676f210ce1b8bb07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=A4fer?= Date: Sat, 16 Jan 2021 15:22:46 +0100 Subject: [PATCH] Make flake8 happy --- snikket_web/__init__.py | 12 ++++++++---- snikket_web/prosodyclient.py | 5 +---- snikket_web/xmpputil.py | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/snikket_web/__init__.py b/snikket_web/__init__.py index f536dbe..290e209 100644 --- a/snikket_web/__init__.py +++ b/snikket_web/__init__.py @@ -9,7 +9,7 @@ from datetime import datetime, timedelta import quart.flask_patch from quart import ( - Quart, session, request, render_template, redirect, url_for, Response, + Quart, request, render_template, redirect, url_for, Response, current_app, ) import quart.exceptions @@ -21,7 +21,7 @@ from flask_babel import Babel, _, lazy_gettext as _l from . import colour, xmpputil from .prosodyclient import client -from ._version import version, version_info +from ._version import version, version_info # noqa:F401 app = Quart(__name__) app.config.setdefault("LANGUAGES", ["de", "en"]) @@ -145,8 +145,12 @@ def proc(): def url_for_avatar(entity, hash_, **kwargs): return url_for( "avatar", - from_=base64.urlsafe_b64encode(entity.encode("utf-8")).decode("ascii").rstrip("="), - code=base64.urlsafe_b64encode(binascii.a2b_hex(hash_)[:8]).decode("ascii").rstrip("="), + from_=base64.urlsafe_b64encode( + entity.encode("utf-8"), + ).decode("ascii").rstrip("="), + code=base64.urlsafe_b64encode( + binascii.a2b_hex(hash_)[:8], + ).decode("ascii").rstrip("="), **kwargs ) diff --git a/snikket_web/prosodyclient.py b/snikket_web/prosodyclient.py index 478364d..0aa6b47 100644 --- a/snikket_web/prosodyclient.py +++ b/snikket_web/prosodyclient.py @@ -1,8 +1,5 @@ -import binascii -import contextlib import functools import hashlib -import json import logging import secrets @@ -362,7 +359,7 @@ class ProsodyClient: self.session_address, current_password, ) - reply = await self._xml_iq_call( + await self._xml_iq_call( session, xmpputil.make_password_change_request( self.session_address, diff --git a/snikket_web/xmpputil.py b/snikket_web/xmpputil.py index 5d21a91..caeaa77 100644 --- a/snikket_web/xmpputil.py +++ b/snikket_web/xmpputil.py @@ -1,5 +1,4 @@ import base64 -import binascii import typing import xml.etree.ElementTree as ET @@ -11,7 +10,8 @@ import quart.exceptions TAG_XMPP_ERROR = "error" NS_XMPP_ERROR_CONDITION = "urn:ietf:params:xml:ns:xmpp-stanzas" -TAG_XMPP_ERROR_ITEM_NOT_FOUND = "{{{}}}item-not-found".format(NS_XMPP_ERROR_CONDITION) +TAG_XMPP_ERROR_ITEM_NOT_FOUND = \ + "{{{}}}item-not-found".format(NS_XMPP_ERROR_CONDITION) TAG_XMPP_ERROR_TEXT = "{{{}}}text".format(NS_XMPP_ERROR_CONDITION) ERROR_CODE_MAP = {