Skip to content

Commit 27fc33a

Browse files
committed
Linter changes
1 parent ab8a0dd commit 27fc33a

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

examples/new-sdk/template-client-server/nodeTest-client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ async def run_client(reader: StreamReader, writer: StreamWriter):
3232
# Note: Since "read" is a python coroutine, we need to "await" it, so python can
3333
# execute other coroutines until the data becomes available to read.
3434
answer = await reader.read(100)
35+
# Messages received from the server come as "bytes", which need to be decoded
36+
# (using UTF-8 encoding) before using it as a string.
37+
print(answer.decode("utf-8"))
3538

3639
this_node_name = "Alice"
3740
other_node_name = "Bob"

examples/new-sdk/template-client-server/nodeTest-server.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from pathlib import Path
33

44
from simulaqron.general.host_config import SocketsConfig
5-
from simulaqron.sdk.protocol import SimulaQronClassicalClient
6-
from simulaqron.settings import network_config
5+
from simulaqron.sdk.protocol import SimulaQronClassicalServer
6+
from simulaqron.settings import network_config, simulaqron_settings
77
from simulaqron.settings.network_config import NodeConfigType
88

99
# This is recipe to use NetQASM with simulaqron backend.
@@ -27,6 +27,9 @@ async def serve_client(reader: StreamReader, writer: StreamWriter):
2727
# execute other coroutines (such as serving a new client) until the data becomes
2828
# available to read.
2929
answer = await reader.read(100)
30+
# mMessages received from the client come as "bytes", which need to be decoded
31+
# (using UTF-8 encoding) before using it as a string.
32+
print(answer.decode("utf-8"))
3033

3134
# To send a messsage, we can simply use the "wirte" method from the "writer" object
3235
# The argument *must* be a python bytes object, which we can get by encoding (using

examples/new-sdk/template-quantum-local/nodeTest.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
from asyncio import StreamReader, StreamWriter
21
from pathlib import Path
32

43
from simulaqron.general.host_config import SocketsConfig
5-
from simulaqron.sdk.protocol import SimulaQronClassicalClient
64
from simulaqron.settings import network_config, simulaqron_settings
75
from simulaqron.settings.network_config import NodeConfigType
86

@@ -13,13 +11,13 @@
1311
# Importing NetQASM connection, Qubit and EPR socket must be *after*
1412
# setting the simulator for NetQASM
1513
from netqasm.sdk.external import NetQASMConnection # noqa: E402
16-
from netqasm.sdk import Qubit, EPRSocket # noqa: E402
14+
from netqasm.sdk import Qubit # noqa: E402
1715

1816

1917
# This function contains the code of the classical client
2018
def quantum_program(this_node_name: str) -> int:
2119
# To start executing quantum operations, we need to create a NetQASM connection
22-
with NetQASMConnection(this_node_name, epr_sockets=[epr_socket]) as alice:
20+
with NetQASMConnection(this_node_name) as alice:
2321
# Create a qubit
2422
q = Qubit(alice)
2523

0 commit comments

Comments
 (0)