Skip to content

Commit

Permalink
* linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mkvanhooft committed Feb 22, 2024
1 parent 8d121a2 commit 9d164e2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
12 changes: 6 additions & 6 deletions squidasm/run/stack/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from typing import Any, List, Optional

import netsquid_netbuilder.base_configs as netbuilder_configs
import netsquid_netbuilder.modules.qdevices as netbuilder_qdevices
import netsquid_netbuilder.modules.links as netbuilder_links
import netsquid_netbuilder.modules.clinks as netbuilder_clinks
import netsquid_netbuilder.modules.links as netbuilder_links
import netsquid_netbuilder.modules.qdevices as netbuilder_qdevices
from netsquid_netbuilder.yaml_loadable import YamlLoadable


Expand Down Expand Up @@ -107,6 +107,7 @@ class StackNetworkConfig(YamlLoadable):
"""List of all the links connecting the stacks in the network."""
clinks: Optional[List[LinkConfig]]
"""List of all the links connecting the stacks in the network."""

@classmethod
def from_file(cls, path: str) -> StackNetworkConfig:
return super().from_file(path) # type: ignore
Expand All @@ -122,7 +123,7 @@ def _convert_stack_network_config(
processing_node = netbuilder_configs.ProcessingNodeConfig(
name=stack_config.name,
qdevice_typ=stack_config.qdevice_typ,
qdevice_cfg=stack_config.qdevice_cfg
qdevice_cfg=stack_config.qdevice_cfg,
)
processing_nodes.append(processing_node)

Expand Down Expand Up @@ -167,6 +168,5 @@ def _convert_stack_network_config(
clinks.append(clink)

return netbuilder_configs.NetworkConfig(
processing_nodes=processing_nodes,
links=links,
clinks=clinks)
processing_nodes=processing_nodes, links=links, clinks=clinks
)
7 changes: 4 additions & 3 deletions squidasm/run/stack/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
from netsquid_netbuilder.base_configs import NetworkConfig

from squidasm.run.stack.build import create_stack_network_builder
from squidasm.run.stack.config import StackNetworkConfig, _convert_stack_network_config
from squidasm.sim.stack.context import NetSquidContext
from squidasm.sim.stack.globals import GlobalSimData
from squidasm.sim.stack.program import Program
from squidasm.sim.stack.qnos_network_service import QNOSNetworkService
from squidasm.sim.stack.stack import NodeStack, StackNetwork, StackNode
from squidasm.run.stack.config import StackNetworkConfig
from squidasm.run.stack.config import _convert_stack_network_config


def _setup_network(config: NetworkConfig) -> StackNetwork:
Expand Down Expand Up @@ -79,7 +78,9 @@ def _run(network: StackNetwork) -> List[List[Dict[str, Any]]]:


def run(
config: Union[NetworkConfig, StackNetworkConfig], programs: Dict[str, Program], num_times: int = 1
config: Union[NetworkConfig, StackNetworkConfig],
programs: Dict[str, Program],
num_times: int = 1,
) -> List[List[Dict[str, Any]]]:
"""Run programs on a network specified by a network configuration.
Expand Down
2 changes: 1 addition & 1 deletion squidasm/sim/stack/csocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class ClassicalSocket(netsquid_classical_socket.ClassicalSocket):
pass
pass
2 changes: 1 addition & 1 deletion squidasm/util/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .util import get_qubit_state, get_reference_state, create_two_node_network
from .util import create_two_node_network, get_qubit_state, get_reference_state
15 changes: 10 additions & 5 deletions squidasm/util/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@
from netsquid.qubits import operators
from netsquid.qubits import qubitapi as qapi


import squidasm.sim.stack.globals
from squidasm.run.stack.config import StackNetworkConfig, CLinkConfig, LinkConfig, StackConfig, DepolariseLinkConfig, GenericQDeviceConfig, DefaultCLinkConfig
from squidasm.run.stack.config import (
CLinkConfig,
DefaultCLinkConfig,
DepolariseLinkConfig,
GenericQDeviceConfig,
LinkConfig,
StackConfig,
StackNetworkConfig,
)


def create_two_node_network(
Expand Down Expand Up @@ -51,9 +58,7 @@ def create_two_node_network(
typ="default",
cfg=DefaultCLinkConfig(delay=clink_delay),
)
return StackNetworkConfig(
stacks=processing_nodes, links=[link], clinks=[clink]
)
return StackNetworkConfig(stacks=processing_nodes, links=[link], clinks=[clink])


def get_qubit_state(q: Qubit, node_name, full_state=False) -> np.ndarray:
Expand Down

0 comments on commit 9d164e2

Please sign in to comment.