From d97655d68c33765969d0529f2b8897aac8d6e271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 30 Aug 2018 16:35:05 +0200 Subject: [PATCH] matrix: Style fixes. --- matrix/buffer.py | 2 +- matrix/colors.py | 9 ++++++--- matrix/config.py | 2 +- matrix/globals.py | 3 +-- matrix/server.py | 11 ++++++----- matrix/utils.py | 4 ++-- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/matrix/buffer.py b/matrix/buffer.py index 49e922d..ec36a2e 100644 --- a/matrix/buffer.py +++ b/matrix/buffer.py @@ -20,7 +20,7 @@ from __future__ import unicode_literals import time from builtins import super from functools import partial -from typing import Dict, List, NamedTuple, Set, Optional +from typing import Dict, List, NamedTuple, Optional, Set from nio import ( Api, diff --git a/matrix/colors.py b/matrix/colors.py index 6e0f878..89b578d 100644 --- a/matrix/colors.py +++ b/matrix/colors.py @@ -346,9 +346,12 @@ class Formatted(object): # If we're quoted code add quotation marks now. if attributes["quote"] and key == "code" and value: - text = indent(text, "{}>{} ".format( - W.color(G.CONFIG.color.quote), - W.color("reset"))) + text = indent( + text, + "{}>{} ".format( + W.color(G.CONFIG.color.quote), W.color("reset") + ), + ) # If we're code don't remove multiple newlines blindly if attributes["code"]: diff --git a/matrix/config.py b/matrix/config.py index 7a82c14..5a94fad 100644 --- a/matrix/config.py +++ b/matrix/config.py @@ -20,8 +20,8 @@ from collections import namedtuple from enum import Enum, unique import logbook -import nio +import nio from matrix.globals import SCRIPT_NAME, SERVERS, W from matrix.utf import utf8_decode diff --git a/matrix/globals.py b/matrix/globals.py index f68c41a..b8e60d4 100644 --- a/matrix/globals.py +++ b/matrix/globals.py @@ -17,11 +17,10 @@ from __future__ import unicode_literals import sys +from typing import Dict, Optional from .utf import WeechatWrapper -from typing import Dict, Optional - if False: from .server import MatrixServer from .config import MatrixConfig diff --git a/matrix/server.py b/matrix/server.py index 4149b29..eeb12b1 100644 --- a/matrix/server.py +++ b/matrix/server.py @@ -24,19 +24,16 @@ import time from collections import defaultdict, deque from typing import Any, Deque, Dict, Optional -if False: - from .colors import Formatted - from nio import ( HttpClient, LocalProtocolError, LoginResponse, + Response, + Rooms, RoomSendResponse, SyncRepsponse, TransportResponse, TransportType, - Rooms, - Response ) from . import globals as G @@ -46,6 +43,10 @@ from .globals import SCRIPT_NAME, SERVERS, W from .utf import utf8_decode from .utils import create_server_buffer, key_from_value, server_buffer_prnt +if False: + from .colors import Formatted + + try: FileNotFoundError # type: ignore except NameError: diff --git a/matrix/utils.py b/matrix/utils.py index e10c3ea..060fd14 100644 --- a/matrix/utils.py +++ b/matrix/utils.py @@ -19,11 +19,11 @@ from __future__ import unicode_literals import time from typing import Any, Dict, List +from .globals import W + if False: from .server import MatrixServer -from .globals import W - def key_from_value(dictionary, value): # type: (Dict[str, Any], Any) -> str