Coverage for /home/runner/work/tket/tket/pytket/pytket/unit_id/__init__.py: 100%
16 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-14 11:30 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-14 11:30 +0000
1# Copyright Quantinuum
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
15from pytket._tket.unit_id import *
16from pytket._tket.unit_id import (
17 _TEMP_BIT_NAME,
18 _TEMP_BIT_REG_BASE,
19 Bit,
20 BitRegister,
21 Qubit,
22 QubitRegister,
23)
26def _bitregister_next(self: BitRegister) -> Bit:
27 if self._current < self.size:
28 result = self[self._current]
29 self._current += 1
30 return result
31 raise StopIteration
34def _qubitregister_next(self: QubitRegister) -> Qubit:
35 if self._current < self.size:
36 result = self[self._current]
37 self._current += 1
38 return result
39 raise StopIteration
42setattr(BitRegister, "__next__", _bitregister_next)
43setattr(QubitRegister, "__next__", _qubitregister_next)