Skip to content

Commit

Permalink
move from for-loop to iter
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesfrye committed Sep 17, 2024
1 parent 7088f66 commit 79471cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions 08_advanced/code_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def _exec_cell_remote(self, code: str) -> ExecutionResult:
self.sb.stdin.write(code.encode("utf-8"))
self.sb.stdin.write(b"\n")
self.sb.stdin.drain()
for message in self.sb.stdout:
if message.strip() == NULL_MARKER:
return ExecutionResult(None)
message = next(iter(self.sb.stdout))
if message.strip() == NULL_MARKER:
return ExecutionResult(None)
return ExecutionResult(message)

def _exec_cell_local(self, code: str) -> ExecutionResult:
Expand Down

0 comments on commit 79471cc

Please sign in to comment.