Coverage for /home/runner/work/tket/tket/pytket/pytket/circuit/named_types.py: 100%
20 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-05-09 15:08 +0000
« prev ^ index » next coverage.py v7.8.0, created at 2025-05-09 15:08 +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.
15"""Named types for convenience"""
17from collections.abc import Sequence
18from typing import Union
20from sympy import Expr
22from pytket._tket.circuit import Op
23from pytket._tket.unit_id import Bit, Qubit, UnitID
25ParamType = Union[float, Expr] # noqa: UP007
26"""Type used for circuit parameters that can either
27 be a floating point number or symbolic"""
28PhasePolynomialDict = dict[tuple[bool, ...], ParamType]
29"""Dict type used to define a phase polynomial.
30A dict that maps Bitstrings(tuples) to ParamType"""
31PhasePolynomialSequence = Sequence[tuple[Sequence[bool], ParamType]]
32"""Sequence type used to define a phase polynomial.
33 A sequence of Bitstring(sequence) - ParamType pairs"""
34BitstringToOpMap = dict[tuple[bool, ...], Op]
35BitstringToOpList = Sequence[tuple[Sequence[bool], Op]]
36BitstringToTensoredOpMap = dict[tuple[bool, ...], Sequence[Op]]
37BitstringToTensoredOpList = Sequence[tuple[Sequence[bool], Sequence[Op]]]
38PermutationMap = dict[tuple[bool, ...], Sequence[bool]]
39PermutationList = Sequence[tuple[Sequence[bool], Sequence[bool]]]
40UnitIdType = Union[UnitID, Qubit, Bit] # noqa: UP007
41UnitIdMap = dict[UnitIdType, UnitIdType]
42RenameUnitsMap = UnitIdMap