Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ htmlcov/
.coverage
.idea/*
.vscode/*
venv
.python-version
.envrc
2 changes: 1 addition & 1 deletion netqasm/sdk/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ def loop_until(self, max_iterations: int) -> ContextManager[SdkLoopUntilContext]

:param max_iterations: the maximum number of times to loop
"""
return self.builder.sdk_new_loop_until_context(max_iterations)
return self._builder.sdk_new_loop_until_context(max_iterations)

def if_eq(self, a: T_CValue, b: T_CValue, body: T_BranchRoutine) -> None:
"""Execute a function if a == b.
Expand Down
2 changes: 2 additions & 0 deletions netqasm/sdk/run/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .context import Context
from .program import Program
17 changes: 17 additions & 0 deletions netqasm/sdk/run/context.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
External execution context interface.
"""

from abc import ABC, abstractmethod

from netqasm.sdk.connection import BaseNetQASMConnection


class Context(ABC):
def __init__(self):
pass

@property
@abstractmethod
def connection(self) -> BaseNetQASMConnection:
raise NotImplementedError
21 changes: 21 additions & 0 deletions netqasm/sdk/run/program.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""
External program interface.
"""

from abc import ABC, abstractmethod
from typing import Any, Dict

from netqasm.sdk.run import Context


class Program(ABC):
def __init__(self):
print(__name__)

@property
def parameters(self) -> Dict[str, Any]:
raise NotImplementedError

@abstractmethod
def run(self, context: Context):
raise NotImplementedError