refactor: move shutil import to module level
Cleanup on top of PR #305 — replace two inline 'import shutil as _shutil' with a single module-level import.
This commit is contained in:
parent
9079a27814
commit
55b173dd03
1 changed files with 4 additions and 5 deletions
9
cli.py
9
cli.py
|
|
@ -14,6 +14,7 @@ Usage:
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import atexit
|
import atexit
|
||||||
|
|
@ -2144,8 +2145,7 @@ class HermesCLI:
|
||||||
# Add user message to history
|
# Add user message to history
|
||||||
self.conversation_history.append({"role": "user", "content": message})
|
self.conversation_history.append({"role": "user", "content": message})
|
||||||
|
|
||||||
import shutil as _shutil
|
w = shutil.get_terminal_size().columns
|
||||||
w = _shutil.get_terminal_size().columns
|
|
||||||
_cprint(f"{_GOLD}{'─' * w}{_RST}")
|
_cprint(f"{_GOLD}{'─' * w}{_RST}")
|
||||||
print(flush=True)
|
print(flush=True)
|
||||||
|
|
||||||
|
|
@ -2221,7 +2221,7 @@ class HermesCLI:
|
||||||
response = response + "\n\n---\n_[Interrupted - processing new message]_"
|
response = response + "\n\n---\n_[Interrupted - processing new message]_"
|
||||||
|
|
||||||
if response:
|
if response:
|
||||||
w = _shutil.get_terminal_size().columns
|
w = shutil.get_terminal_size().columns
|
||||||
label = " ⚕ Hermes "
|
label = " ⚕ Hermes "
|
||||||
fill = w - 2 - len(label) # 2 for ╭ and ╮
|
fill = w - 2 - len(label) # 2 for ╭ and ╮
|
||||||
top = f"{_GOLD}╭─{label}{'─' * max(fill - 1, 0)}╮{_RST}"
|
top = f"{_GOLD}╭─{label}{'─' * max(fill - 1, 0)}╮{_RST}"
|
||||||
|
|
@ -2541,8 +2541,7 @@ class HermesCLI:
|
||||||
def _input_height():
|
def _input_height():
|
||||||
try:
|
try:
|
||||||
doc = input_area.buffer.document
|
doc = input_area.buffer.document
|
||||||
import shutil as _shutil
|
available_width = shutil.get_terminal_size().columns - 4 # subtract prompt width
|
||||||
available_width = _shutil.get_terminal_size().columns - 4 # subtract prompt width
|
|
||||||
if available_width < 10:
|
if available_width < 10:
|
||||||
available_width = 40
|
available_width = 40
|
||||||
visual_lines = 0
|
visual_lines = 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue