From 50384fac9783bb56b8315208057d94fa3a4b19f4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 14 May 2020 09:18:29 +0530 Subject: [PATCH] DRYer --- kitty/tab_bar.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/kitty/tab_bar.py b/kitty/tab_bar.py index bcb17c0b3..1680053a7 100644 --- a/kitty/tab_bar.py +++ b/kitty/tab_bar.py @@ -3,7 +3,7 @@ # License: GPL v3 Copyright: 2018, Kovid Goyal from functools import lru_cache -from typing import Any, Dict, NamedTuple, Optional, Sequence, Set, Tuple +from typing import Any, Dict, NamedTuple, Optional, Sequence, Tuple from .config import build_ansi_color_table from .constants import WindowGeometry @@ -46,7 +46,9 @@ def as_rgb(x: int) -> int: return (x << 8) | 2 -template_failures: Set[str] = set() +@lru_cache() +def report_template_failure(template: str, e: str) -> None: + log_error('Invalid tab title template: "{}" with error: {}'.format(template, e)) @lru_cache() @@ -54,9 +56,7 @@ def compile_template(template: str) -> Any: try: return compile('f"""' + template + '"""', '