From bd68dbf0af1983f8d1e04c52fe3714f1198b4277 Mon Sep 17 00:00:00 2001 From: sraver Date: Wed, 8 Nov 2023 15:10:24 +0100 Subject: [PATCH] Add optional keyword arguments to `SuperCircuit` (#176) In some cases, we need to pass information into the Circuit/SuperCircuit, and for that, we can use optional keyword arguments sent through the constructor. This PR adds this feature, already present in `Circuit`, into `SuperCircuit`. --- Cargo.toml | 2 +- src/frontend/python/chiquito/dsl.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 12fd7191..276df152 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chiquito" -version = "0.1.2023110700" +version = "0.1.2023110800" edition = "2021" license = "MIT OR Apache-2.0" authors = ["Leo Lara "] diff --git a/src/frontend/python/chiquito/dsl.py b/src/frontend/python/chiquito/dsl.py index 329d973f..aa355972 100644 --- a/src/frontend/python/chiquito/dsl.py +++ b/src/frontend/python/chiquito/dsl.py @@ -28,7 +28,12 @@ class SuperCircuitMode(Enum): class SuperCircuit: - def __init__(self: SuperCircuit): + def __init__( + self: SuperCircuit, + **kwargs, # **kwargs is intended for arbitrary names for imports + ): + for key, value in kwargs.items(): + setattr(self, key, value) self.ast = ASTSuperCircuit() self.mode = SuperCircuitMode.SETUP self.setup()