Skip to content

Commit

Permalink
_get_root_program_scope() + black
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoLaudatQM committed Feb 1, 2024
1 parent cc2ef67 commit 362b474
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions qualang_tools/callable_from_qua/_callable_from_qua.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def __init__(self):

try:
# Check if we are already inside a program
_get_scope_as_program()
_get_root_program_scope()
self.declare_all()
except QmQuaException:
...
Expand Down Expand Up @@ -192,7 +192,7 @@ def callable_from_qua(func: callable):

@wraps(func)
def wrapper(*args, **kwargs):
program = _get_root_program_scope._program
program = _get_root_program_scope()._program
if "callable_from_qua" not in program.addons:
program.addons["callable_from_qua"] = QuaCallableEventManager()

Expand Down
4 changes: 4 additions & 0 deletions qualang_tools/callable_from_qua/_qua_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ def __exit__(self, exc_type, exc_val, exc_tb):

return exit_result


QM_execute = _QuantumMachine_qua.execute


class QuantumMachine(_QuantumMachine_qua):
def execute(
self,
Expand Down Expand Up @@ -77,6 +80,7 @@ def patch_callable_from_qua():
print("qm.program.Program already has 'addons' attribute, not patching")
else:
from qualang_tools.callable_from_qua import ProgramAddon

Program.addons: Dict[str, ProgramAddon] = {}

if qm.qua._dsl._ProgramScope is _ProgramScope:
Expand Down

0 comments on commit 362b474

Please sign in to comment.