Skip to content

Commit

Permalink
dur
Browse files Browse the repository at this point in the history
Signed-off-by: Ayush Kamat <[email protected]>
  • Loading branch information
ayushkamat committed Aug 30, 2024
1 parent 451e7d6 commit 588adf2
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 22 deletions.
5 changes: 3 additions & 2 deletions latch_cli/menus.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import os
import sys
import termios
import tty
from typing import Any, Callable, Generic, List, Optional, Tuple, TypeVar

from typing_extensions import TypedDict
Expand Down Expand Up @@ -261,6 +259,9 @@ def render(

return num_lines_rendered

import termios
import tty

old_settings = termios.tcgetattr(sys.stdin.fileno())
tty.setraw(sys.stdin.fileno())

Expand Down
5 changes: 3 additions & 2 deletions latch_cli/services/execute/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import os
import signal
import sys
import termios
import tty
from typing import Generic, Literal, Optional, Tuple, TypedDict, TypeVar, Union
from urllib.parse import urljoin, urlparse

Expand Down Expand Up @@ -186,6 +184,9 @@ def exec(
egn_info = get_egn_info(execution_info, egn_id)
container_info = get_container_info(egn_info, container_index)

import termios
import tty

old_settings_stdin = termios.tcgetattr(sys.stdin.fileno())
tty.setraw(sys.stdin)

Expand Down
27 changes: 15 additions & 12 deletions latch_cli/services/get_executions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import os
import sys
import termios
import textwrap
import tty
from pathlib import Path
from typing import Dict, List

Expand Down Expand Up @@ -50,12 +48,10 @@ def get_executions():
]

for execution_data in sorted(data.values(), key=lambda x: -int(x["id"])):
options.append(
{
**execution_data,
"workflow_tagged": f'{execution_data["workflow_name"]}/{execution_data["workflow_version"]}',
}
)
options.append({
**execution_data,
"workflow_tagged": f'{execution_data["workflow_name"]}/{execution_data["workflow_version"]}',
})

_all_executions(
title="All Executions",
Expand Down Expand Up @@ -142,6 +138,9 @@ def render(
menus._show()
return max_row_len

import termios
import tty

old_settings = termios.tcgetattr(sys.stdin.fileno())
tty.setraw(sys.stdin.fileno())

Expand Down Expand Up @@ -223,7 +222,8 @@ def render(
prev = (curr_selected, hor_index, term_width, term_height)
menus.clear_screen()
max_row_len = render(curr_selected, hor_index, term_width, term_height)
except KeyboardInterrupt: ...
except KeyboardInterrupt:
...
finally:
menus.clear_screen()
menus.reveal_cursor()
Expand Down Expand Up @@ -316,7 +316,8 @@ def render(curr_selected: int, term_width: int, term_height: int):
menus.clear_screen()
prev = (curr_selected, term_width, term_height)
render(curr_selected, term_width, term_height)
except KeyboardInterrupt: ...
except KeyboardInterrupt:
...
finally:
menus.clear_screen()
menus.move_cursor((0, 0))
Expand Down Expand Up @@ -452,7 +453,8 @@ def render(vert_index, hor_index, term_width, term_height):
menus.clear_screen()
prev_term_dims = (vert_index, hor_index, term_width, term_height)
render(vert_index, hor_index, term_width, term_height)
except KeyboardInterrupt: ...
except KeyboardInterrupt:
...
finally:
log_sched.shutdown()
log_file.unlink(missing_ok=True)
Expand Down Expand Up @@ -513,7 +515,8 @@ def render(term_width: int, term_height: int):
if prev_term_dims != (term_width, term_height):
prev_term_dims = (term_width, term_height)
render(term_width, term_height)
except KeyboardInterrupt: ...
except KeyboardInterrupt:
...
finally:
menus.clear_screen()
menus.move_cursor((0, 0))
5 changes: 3 additions & 2 deletions latch_cli/services/local_dev_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
import signal
import subprocess
import sys
import termios
import time
import traceback
import tty
from enum import Enum
from http.client import HTTPException
from pathlib import Path
Expand Down Expand Up @@ -256,6 +254,9 @@ async def _send_resize_message(
async def _shell_session(
ws: client.WebSocketClientProtocol,
):
import termios
import tty

old_settings_stdin = termios.tcgetattr(sys.stdin.fileno())
tty.setraw(sys.stdin)

Expand Down
8 changes: 5 additions & 3 deletions latch_cli/services/preview.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import os
import sys
import termios
import tty
import webbrowser
from pathlib import Path
from typing import List
Expand Down Expand Up @@ -125,6 +123,9 @@ def render(

return num_lines_rendered

import termios
import tty

old_settings = termios.tcgetattr(sys.stdin.fileno())
tty.setraw(sys.stdin.fileno())

Expand Down Expand Up @@ -176,7 +177,8 @@ def render(
start_index=start_index,
max_per_page=max_per_page,
)
except KeyboardInterrupt: ...
except KeyboardInterrupt:
...
finally:
menus.clear(num_lines_rendered)
menus.reveal_cursor()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

setup(
name="latch",
version="v2.52.0",
version="v2.52.1",
author_email="[email protected]",
description="The Latch SDK",
packages=find_packages(),
Expand Down

0 comments on commit 588adf2

Please sign in to comment.