summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--poezio/logger.py18
-rw-r--r--poezio/text_buffer.py6
-rwxr-xr-xpoezio/theming.py9
-rw-r--r--poezio/xhtml.py3
4 files changed, 26 insertions, 10 deletions
diff --git a/poezio/logger.py b/poezio/logger.py
index 9ca7120e..29375dcd 100644
--- a/poezio/logger.py
+++ b/poezio/logger.py
@@ -105,7 +105,8 @@ class Logger:
log.debug('Log handle for %s re-created', room)
return None
- def _check_and_create_log_dir(self, room: str, open_fd: bool = True) -> Optional[IO[Any]]:
+ def _check_and_create_log_dir(self, room: str,
+ open_fd: bool = True) -> Optional[IO[Any]]:
"""
Check that the directory where we want to log the messages
exists. if not, create it
@@ -131,7 +132,8 @@ class Logger:
'Unable to open the log file (%s)', filename, exc_info=True)
return None
- def get_logs(self, jid: str, nb: int = 10) -> Optional[List[Dict[str, Any]]]:
+ def get_logs(self, jid: str,
+ nb: int = 10) -> Optional[List[Dict[str, Any]]]:
"""
Get the nb last messages from the log history for the given jid.
Note that a message may be more than one line in these files, so
@@ -176,7 +178,12 @@ class Logger:
return None
return parse_log_lines(lines)
- def log_message(self, jid: str, nick: str, msg: str, date: Optional[datetime] = None, typ: int = 1) -> bool:
+ def log_message(self,
+ jid: str,
+ nick: str,
+ msg: str,
+ date: Optional[datetime] = None,
+ typ: int = 1) -> bool:
"""
log the message in the appropriate jid's file
type:
@@ -253,7 +260,10 @@ class Logger:
return True
-def build_log_message(nick: str, msg: str, date: Optional[datetime] = None, typ: int = 1) -> str:
+def build_log_message(nick: str,
+ msg: str,
+ date: Optional[datetime] = None,
+ typ: int = 1) -> str:
"""
Create a log message from a nick, a message, optionally a date and type
message types:
diff --git a/poezio/text_buffer.py b/poezio/text_buffer.py
index 4ea7b788..1a2c073b 100644
--- a/poezio/text_buffer.py
+++ b/poezio/text_buffer.py
@@ -200,11 +200,13 @@ class TextBuffer:
"""Mark a message as acked"""
return self._edit_ack(1, old_id, jid)
- def nack_message(self, error: str, old_id: str, jid: str) -> Union[None, bool, Message]:
+ def nack_message(self, error: str, old_id: str,
+ jid: str) -> Union[None, bool, Message]:
"""Mark a message as errored"""
return self._edit_ack(-1, old_id, jid, append=error)
- def _edit_ack(self, value: int, old_id: str, jid: str, append: str = '') -> Union[None, bool, Message]:
+ def _edit_ack(self, value: int, old_id: str, jid: str,
+ append: str = '') -> Union[None, bool, Message]:
"""
Edit the ack status of a message, and optionally
append some text.
diff --git a/poezio/theming.py b/poezio/theming.py
index 8178ab6f..32ff8041 100755
--- a/poezio/theming.py
+++ b/poezio/theming.py
@@ -383,7 +383,8 @@ theme = Theme()
# Each time we use a color tuple, we check if it has already been used.
# If not we create a new color_pair and keep it in that dict, to use it
# the next time.
-curses_colors_dict = {} # type: Dict[Union[Tuple[int, int], Tuple[int, int, str]], int]
+curses_colors_dict = {
+} # type: Dict[Union[Tuple[int, int], Tuple[int, int, str]], int]
# yapf: disable
@@ -433,7 +434,8 @@ def read_tuple(_str: str) -> Tuple[Tuple[int, int], str]:
@functools.lru_cache(maxsize=128)
-def to_curses_attr(color_tuple: Union[Tuple[int, int], Tuple[int, int, str]]) -> int:
+def to_curses_attr(
+ color_tuple: Union[Tuple[int, int], Tuple[int, int, str]]) -> int:
"""
Takes a color tuple (as defined at the top of this file) and
returns a valid curses attr that can be passed directly to attron() or attroff()
@@ -484,7 +486,8 @@ def get_theme() -> Theme:
return theme
-def update_themes_dir(option: Optional[str] = None, value: Optional[str] = None):
+def update_themes_dir(option: Optional[str] = None,
+ value: Optional[str] = None):
global load_path
load_path = []
diff --git a/poezio/xhtml.py b/poezio/xhtml.py
index b28eed4f..fefa2e1b 100644
--- a/poezio/xhtml.py
+++ b/poezio/xhtml.py
@@ -299,7 +299,8 @@ def get_hash(data: bytes) -> str:
class XHTMLHandler(sax.ContentHandler):
- def __init__(self, force_ns=False, tmp_image_dir: Optional[Path] = None) -> None:
+ def __init__(self, force_ns=False,
+ tmp_image_dir: Optional[Path] = None) -> None:
self.builder = [] # type: List[str]
self.formatting = [] # type: List[str]
self.attrs = [] # type: List[Dict[str, str]]