Skip to content

Commit

Permalink
Cleanup: Missing types and variables shadowing
Browse files Browse the repository at this point in the history
Minor code cleanup.

Sharing variable names shadowed the variables from outer scope, and types were missing.
  • Loading branch information
hoh committed Sep 25, 2023
1 parent 2b39b16 commit caba5d7
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions vm_supervisor/vm/firecracker/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import dataclasses
import logging
import os.path
from asyncio import StreamReader, StreamWriter
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
Expand Down Expand Up @@ -439,17 +440,19 @@ async def run_code(
logger.debug("running code")
scope = scope or {}

async def communicate(reader, writer, scope) -> bytes:
payload = RunCodePayload(scope=scope)
async def communicate(
reader_: StreamReader, writer_: StreamWriter, scope_: dict
) -> bytes:
payload = RunCodePayload(scope=scope_)

writer.write(b"CONNECT 52\n" + payload.as_msgpack())
await writer.drain()
writer_.write(b"CONNECT 52\n" + payload.as_msgpack())
await writer_.drain()

ack: bytes = await reader.readline()
ack: bytes = await reader_.readline()
logger.debug(f"ack={ack.decode()}")

logger.debug("waiting for VM response")
response: bytes = await reader.read()
response: bytes = await reader_.read()

return response

Expand Down

0 comments on commit caba5d7

Please sign in to comment.