From 2d4fc4f04c24a60e58a26f9f5e3fe5bb2e268f65 Mon Sep 17 00:00:00 2001 From: sjdilkes Date: Thu, 10 Aug 2023 10:55:35 +0100 Subject: [PATCH] Set **kwargs type to KwargTypes where required --- pytket/pytket/backends/backend.py | 9 ++++++--- pytket/tests/simulator/tket_sim_backend.py | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pytket/pytket/backends/backend.py b/pytket/pytket/backends/backend.py index 33887777de..f737870d34 100644 --- a/pytket/pytket/backends/backend.py +++ b/pytket/pytket/backends/backend.py @@ -144,7 +144,7 @@ def rebase_pass(self) -> BasePass: @abstractmethod def default_compilation_pass( - self, optimisation_level: int = 2, **kwargs + self, optimisation_level: int = 2, **kwargs: KwargTypes ) -> BasePass: """ A suggested compilation pass that will will, if possible, produce an equivalent @@ -173,7 +173,7 @@ def default_compilation_pass( ... def get_compiled_circuit( - self, circuit: Circuit, optimisation_level: int = 2, **kwargs + self, circuit: Circuit, optimisation_level: int = 2, **kwargs: KwargTypes ) -> Circuit: """ Return a single circuit compiled with :py:meth:`default_compilation_pass` See @@ -187,7 +187,10 @@ def get_compiled_circuit( return return_circuit def get_compiled_circuits( - self, circuits: Sequence[Circuit], optimisation_level: int = 2, **kwargs + self, + circuits: Sequence[Circuit], + optimisation_level: int = 2, + **kwargs: KwargTypes, ) -> List[Circuit]: """Compile a sequence of circuits with :py:meth:`default_compilation_pass` and return the list of compiled circuits (does not act in place). diff --git a/pytket/tests/simulator/tket_sim_backend.py b/pytket/tests/simulator/tket_sim_backend.py index 705348cba9..f4bca4733c 100644 --- a/pytket/tests/simulator/tket_sim_backend.py +++ b/pytket/tests/simulator/tket_sim_backend.py @@ -105,7 +105,7 @@ def rebase_pass(self) -> BasePass: return auto_rebase_pass(_GATE_SET) def default_compilation_pass( - self, optimisation_level: int = 1, **kwargs + self, optimisation_level: int = 1, **kwargs: KwargTypes ) -> BasePass: assert optimisation_level in range(3) if optimisation_level == 0: @@ -158,7 +158,7 @@ class TketSimShotBackend(TketSimBackend): _supports_contextual_optimisation = True def default_compilation_pass( - self, optimisation_level: int = 1, **kwargs + self, optimisation_level: int = 1, **kwargs: KwargTypes ) -> BasePass: assert optimisation_level in range(3) if optimisation_level == 0: