refactor to get .get()
This commit is contained in:
parent
64dd7d6279
commit
0f731598dd
@ -107,13 +107,11 @@ async def stream_code(websocket: WebSocket):
|
|||||||
|
|
||||||
print("Received params")
|
print("Received params")
|
||||||
|
|
||||||
# Read the code config settings (stack) from the request. Fall back to default if not provided.
|
# Read the code config settings (stack) from the request.
|
||||||
generated_code_config = ""
|
generated_code_config = params.get("generatedCodeConfig", "")
|
||||||
if "generatedCodeConfig" in params and params["generatedCodeConfig"]:
|
|
||||||
generated_code_config = params["generatedCodeConfig"]
|
|
||||||
if not generated_code_config in get_args(Stack):
|
if not generated_code_config in get_args(Stack):
|
||||||
await throw_error(f"Invalid generated code config: {generated_code_config}")
|
await throw_error(f"Invalid generated code config: {generated_code_config}")
|
||||||
return
|
raise Exception(f"Invalid generated code config: {generated_code_config}")
|
||||||
# Cast the variable to the Stack type
|
# Cast the variable to the Stack type
|
||||||
valid_stack = cast(Stack, generated_code_config)
|
valid_stack = cast(Stack, generated_code_config)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user