summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-04-15 19:35:29 +0200
committermathieui <mathieui@mathieui.net>2021-04-15 19:35:54 +0200
commit63d51c463021dc1e16873814058f06eb43a9b69b (patch)
tree1d3c2dd08fd48aa5c98f3f23dec81816ee2fcd59
parenta17e5a456b9bf1a949d9ed1d0d1df90013c69e6d (diff)
downloadpoezio-63d51c463021dc1e16873814058f06eb43a9b69b.tar.gz
poezio-63d51c463021dc1e16873814058f06eb43a9b69b.tar.bz2
poezio-63d51c463021dc1e16873814058f06eb43a9b69b.tar.xz
poezio-63d51c463021dc1e16873814058f06eb43a9b69b.zip
internal: add more annotation and remove unused attributes
-rw-r--r--poezio/core/core.py36
-rw-r--r--poezio/poezio.py2
2 files changed, 28 insertions, 10 deletions
diff --git a/poezio/core/core.py b/poezio/core/core.py
index 9fa003b6..52b45427 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -5,6 +5,8 @@ of everything; it also contains global commands, completions and event
handlers but those are defined in submodules in order to avoir cluttering
this file.
"""
+from __future__ import annotations
+
import logging
import asyncio
import curses
@@ -25,14 +27,14 @@ from typing import (
Tuple,
Type,
TypeVar,
- Union,
+ TYPE_CHECKING,
)
from xml.etree import ElementTree as ET
from slixmpp import JID, InvalidJID
from slixmpp.util import FileSystemPerJidCache
from slixmpp.xmlstream.handler import Callback
-from slixmpp.exceptions import IqError, IqTimeout
+from slixmpp.exceptions import IqError, IqTimeout, XMPPError
from poezio import connection
from poezio import decorators
@@ -58,7 +60,6 @@ from poezio.size_manager import SizeManager
from poezio.user import User
from poezio.text_buffer import TextBuffer
from poezio.timed_events import DelayedEvent
-from poezio.theming import get_theme
from poezio import keyboard, xdg
from poezio.core.completions import CompletionCore
@@ -73,11 +74,13 @@ from poezio.core.structs import (
)
from poezio.ui.types import (
- Message,
PersistentInfoMessage,
UIMessage,
)
+if TYPE_CHECKING:
+ from _curses import _CursesWindow
+
log = logging.getLogger(__name__)
T = TypeVar('T', bound=tabs.Tab)
@@ -101,6 +104,27 @@ class Core:
pending_invites: Dict[str, str]
configuration_change_handlers: Dict[str, List[Callable[..., None]]]
own_nick: str
+ connection_time: float
+ custom_version: str
+ xmpp: connection.Connection
+ avatar_cache: FileSystemPerJidCache
+ plugins_autoloaded: bool
+ previous_tab_nb: int
+ tabs: Tabs
+ size: SizeManager
+ plugin_manager: PluginManager
+ events: events.EventHandler
+ legitimate_disconnect: bool
+ information_buffer: TextBuffer
+ information_win_size: int
+ stdscr: Optional[_CursesWindow]
+ xml_buffer: TextBuffer
+ xml_tab: Optional[tabs.XMLTab]
+ last_stream_error: Optional[Tuple[float, XMPPError]]
+ remote_fifo: Optional[Fifo]
+ key_func: KeyDict
+ tab_win: windows.GlobalInfoBar
+ left_tab_win: Optional[windows.VerticalGlobalInfoBar]
def __init__(self, custom_version: str, firstrun: bool):
self.completion = CompletionCore(self)
@@ -116,7 +140,6 @@ class Core:
status = config.getstr('status')
status = POSSIBLE_SHOW.get(status) or ''
self.status = Status(show=status, message=config.getstr('status_message'))
- self.running = True
self.custom_version = custom_version
self.xmpp = connection.Connection(custom_version)
self.xmpp.core = self
@@ -124,7 +147,6 @@ class Core:
roster.set_node(self.xmpp.client_roster)
decorators.refresh_wrapper.core = self
self.bookmarks = BookmarkList()
- self.debug = False
self.remote_fifo = None
self.avatar_cache = FileSystemPerJidCache(
str(xdg.CACHE_HOME), 'avatars', binary=True)
@@ -1361,8 +1383,6 @@ class Core:
def doupdate(self) -> None:
"Do a curses update"
- if not self.running:
- return
curses.doupdate()
def information(self, msg: str, typ: str = '') -> bool:
diff --git a/poezio/poezio.py b/poezio/poezio.py
index e987467f..694130f0 100644
--- a/poezio/poezio.py
+++ b/poezio/poezio.py
@@ -111,8 +111,6 @@ def main():
signal.signal(signal.SIGUSR1, cocore.sigusr_handler) # reload the config
signal.signal(signal.SIGHUP, cocore.exit_from_signal)
signal.signal(signal.SIGTERM, cocore.exit_from_signal)
- if options.debug:
- cocore.debug = True
cocore.start()
from slixmpp.exceptions import IqError, IqTimeout