Skip to content

Commit 289edb6

Browse files
committed
more cleanup
1 parent c7f5372 commit 289edb6

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

python_files/python_server.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ def send_request(params: Optional[Union[List, Dict]] = None):
4444

4545

4646
def custom_input(prompt=""):
47-
send_request({"prompt": prompt})
4847
try:
48+
send_request({"prompt": prompt})
4949
headers = get_headers()
5050
content_length = int(headers.get("Content-Length", 0))
5151

5252
if content_length:
53-
message_text = STDIN.read(content_length) # make sure Im getting right content
53+
message_text = STDIN.read(content_length)
5454
message_json = json.loads(message_text)
5555
our_user_input = message_json["result"]["userInput"]
5656
return our_user_input
@@ -103,7 +103,6 @@ def execute(request, user_globals):
103103

104104

105105
def exec_user_input(user_input, user_globals):
106-
# have to do redirection
107106
user_input = user_input[0] if isinstance(user_input, list) else user_input
108107

109108
try:
@@ -158,9 +157,8 @@ def get_headers():
158157
headers = get_headers()
159158
content_length = int(headers.get("Content-Length", 0))
160159

161-
# TODO: pull out to separate function
162160
if content_length:
163-
request_text = STDIN.read(content_length) # make sure Im getting right content
161+
request_text = STDIN.read(content_length)
164162
request_json = json.loads(request_text)
165163
if request_json["method"] == "execute":
166164
execute(request_json, USER_GLOBALS)

0 commit comments

Comments
 (0)