Skip to content

Commit e3ace7c

Browse files
author
lazero
committed
use black formatter for tmux stat repr
1 parent 2ab6263 commit e3ace7c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

tmux_trials/lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
Text = Union[str, bytes]
6363
TERMINAL_VIEWPORT = {"width": 645, "height": 350}
6464

65-
TMUX_WARN_INFO_DISPLAY_TIME = 2.5
65+
TMUX_WARN_INFO_DISPLAY_TIME = 1.5
6666
ZELLIJ_URL= "https://github.com/zellij-org/zellij"
6767

6868
def check_if_in_tmux_session() -> bool:

tmux_trials/test_lib.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
from io import TextIOWrapper
88
import string
99
import random
10+
import black
11+
12+
1013

1114
SERVER_NAME = "test_server"
1215
SESSION_NAME = "test_session"
@@ -24,6 +27,9 @@
2427
print("[*] Removing old log file:", STDOUT_FILEPATH)
2528
os.remove(STDOUT_FILEPATH)
2629

30+
def format_python_object(obj):
31+
ret = black.format_str(repr(obj), mode=black.FileMode())
32+
return ret
2733

2834
def flush_filehandle_periodically(f: TextIOWrapper):
2935
while True:
@@ -40,7 +46,8 @@ def start_daemon_thread(target, *args, **kwargs):
4046
def write_env_stats_periodically(env: TmuxEnvironment):
4147
while True:
4248
try:
43-
content = str(env.info)
49+
content=format_python_object(env.info)
50+
#content = ujson.dumps(env.info,indent=4)
4451
except:
4552
content = "Failed to log stats for TmuxEnvironment\n"
4653
content += traceback.format_exc()

0 commit comments

Comments
 (0)