From aaa6911a393529d67c3b80d3c68614c950204a39 Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 10 Feb 2022 18:42:54 +0100 Subject: clean: remove unused imports --- poezio/colors.py | 1 - poezio/common.py | 4 ++-- poezio/core/commands.py | 2 +- poezio/core/core.py | 1 - poezio/core/handlers.py | 11 ++--------- poezio/fixes.py | 7 ++----- poezio/mam.py | 1 - poezio/tabs/conversationtab.py | 1 - poezio/tabs/xmltab.py | 1 - poezio/theming.py | 1 - poezio/ui/consts.py | 2 -- poezio/user.py | 1 - poezio/windows/inputs.py | 2 +- poezio/windows/roster_win.py | 3 +-- 14 files changed, 9 insertions(+), 29 deletions(-) diff --git a/poezio/colors.py b/poezio/colors.py index 346e1fd0..62566c77 100644 --- a/poezio/colors.py +++ b/poezio/colors.py @@ -1,7 +1,6 @@ from typing import Tuple, Dict, List, Union import curses import hashlib -import math from . import hsluv diff --git a/poezio/common.py b/poezio/common.py index d4d09f9f..016e4bc7 100644 --- a/poezio/common.py +++ b/poezio/common.py @@ -14,7 +14,7 @@ from datetime import ( timezone, ) from pathlib import Path -from typing import Dict, List, Optional, Tuple, Union, Any +from typing import Dict, List, Optional, Tuple, Union import os import subprocess @@ -23,7 +23,7 @@ import string import logging import itertools -from slixmpp import JID, InvalidJID, Message +from slixmpp import Message from poezio.poezio_shlex import shlex log = logging.getLogger(__name__) diff --git a/poezio/core/commands.py b/poezio/core/commands.py index abe99b41..9ad5a78c 100644 --- a/poezio/core/commands.py +++ b/poezio/core/commands.py @@ -8,7 +8,7 @@ from xml.etree import ElementTree as ET from typing import List, Optional, Tuple import logging -from slixmpp import Iq, JID, InvalidJID +from slixmpp import JID, InvalidJID from slixmpp.exceptions import XMPPError, IqError, IqTimeout from slixmpp.xmlstream.xmlstream import NotConnectedError from slixmpp.xmlstream.stanzabase import StanzaBase diff --git a/poezio/core/core.py b/poezio/core/core.py index 17e352de..a1fdde0d 100644 --- a/poezio/core/core.py +++ b/poezio/core/core.py @@ -15,7 +15,6 @@ import pipes import sys import shutil import time -import uuid from collections import defaultdict from typing import ( Any, diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py index 5b80585f..4de95a35 100644 --- a/poezio/core/handlers.py +++ b/poezio/core/handlers.py @@ -4,19 +4,16 @@ XMPP-related handlers for the Core class import logging -from typing import Optional, Union +from typing import Optional import asyncio import curses -import functools import select import signal import ssl import sys import time -from datetime import datetime from hashlib import sha1, sha256, sha512 -from os import path import pyasn1.codec.der.decoder import pyasn1.codec.der.encoder @@ -25,8 +22,6 @@ from slixmpp import InvalidJID, JID, Message, Iq, Presence from slixmpp.xmlstream.stanzabase import StanzaBase, ElementBase from xml.etree import ElementTree as ET -from poezio import common -from poezio import fixes from poezio import tabs from poezio import xhtml from poezio import multiuserchat as muc @@ -36,12 +31,10 @@ from poezio.core.structs import Status from poezio.contact import Resource from poezio.logger import logger from poezio.roster import roster -from poezio.text_buffer import CorrectionError, AckError +from poezio.text_buffer import AckError from poezio.theming import dump_tuple, get_theme from poezio.ui.types import ( XMLLog, - Message as PMessage, - BaseMessage, InfoMessage, PersistentInfoMessage, ) diff --git a/poezio/fixes.py b/poezio/fixes.py index 2d5107fb..7383154f 100644 --- a/poezio/fixes.py +++ b/poezio/fixes.py @@ -5,17 +5,14 @@ upstream. TODO: Check that they are fixed and remove those hacks """ -import asyncio -from typing import Callable, Any -from slixmpp import Message, Iq, ClientXMPP -from slixmpp.xmlstream import ET +from slixmpp import ClientXMPP, Message import logging log = logging.getLogger(__name__) -def _filter_add_receipt_request(self, stanza): +def _filter_add_receipt_request(self: ClientXMPP, stanza): """ Auto add receipt requests to outgoing messages, if: diff --git a/poezio/mam.py b/poezio/mam.py index 180f1b2e..67467e99 100644 --- a/poezio/mam.py +++ b/poezio/mam.py @@ -5,7 +5,6 @@ from __future__ import annotations -import asyncio import logging from datetime import datetime, timedelta, timezone from hashlib import md5 diff --git a/poezio/tabs/conversationtab.py b/poezio/tabs/conversationtab.py index 02f9772b..9cf68d75 100644 --- a/poezio/tabs/conversationtab.py +++ b/poezio/tabs/conversationtab.py @@ -22,7 +22,6 @@ from slixmpp import JID, InvalidJID, Message as SMessage from poezio.tabs.basetabs import OneToOneTab, Tab from poezio import common -from poezio import tabs from poezio import windows from poezio import xhtml from poezio.config import config, get_image_cache diff --git a/poezio/tabs/xmltab.py b/poezio/tabs/xmltab.py index 9501c6d3..939af67d 100644 --- a/poezio/tabs/xmltab.py +++ b/poezio/tabs/xmltab.py @@ -10,7 +10,6 @@ log = logging.getLogger(__name__) import curses import os -from typing import Union, Optional from slixmpp import JID, InvalidJID from slixmpp.xmlstream import matcher, StanzaBase from slixmpp.xmlstream.tostring import tostring diff --git a/poezio/theming.py b/poezio/theming.py index 7a13bb6d..8624f709 100755 --- a/poezio/theming.py +++ b/poezio/theming.py @@ -73,7 +73,6 @@ except ImportError: import curses import functools -import os from typing import Dict, List, Union, Tuple, Optional, cast from pathlib import Path from os import path diff --git a/poezio/ui/consts.py b/poezio/ui/consts.py index 51febf22..91f19a82 100644 --- a/poezio/ui/consts.py +++ b/poezio/ui/consts.py @@ -1,5 +1,3 @@ -from datetime import datetime - FORMAT_CHAR = '\x19' # These are non-printable chars, so they should never appear in the input, # I guess. But maybe we can find better chars that are even less risky. diff --git a/poezio/user.py b/poezio/user.py index 858c6d0e..3416cd60 100644 --- a/poezio/user.py +++ b/poezio/user.py @@ -12,7 +12,6 @@ A user is a MUC participant, not a roster contact (see contact.py) import logging from datetime import timedelta, datetime from hashlib import md5 -from random import choice from typing import Optional, Tuple from poezio import xhtml, colors diff --git a/poezio/windows/inputs.py b/poezio/windows/inputs.py index 89da054e..01b94ac0 100644 --- a/poezio/windows/inputs.py +++ b/poezio/windows/inputs.py @@ -5,7 +5,7 @@ Text inputs. import curses import logging import string -from typing import List, Dict, Callable, Optional, ClassVar, Union +from typing import List, Dict, Callable, Optional, ClassVar from poezio import keyboard from poezio import common diff --git a/poezio/windows/roster_win.py b/poezio/windows/roster_win.py index b112689e..eed68429 100644 --- a/poezio/windows/roster_win.py +++ b/poezio/windows/roster_win.py @@ -6,11 +6,10 @@ import logging log = logging.getLogger(__name__) from datetime import datetime -from typing import Optional, List, Union, Dict +from typing import Optional, List, Union from poezio.windows.base_wins import Win -from poezio import common from poezio.config import config from poezio.contact import Contact, Resource from poezio.roster import Roster, RosterGroup -- cgit v1.2.3