qiskit_trebugger.model.property

Module to implement a property of a circuit.

 1"""Module to implement a property of a circuit.
 2"""
 3
 4from collections import defaultdict
 5
 6
 7class Property:
 8    """Implements the property of a transpiler pass as a data structure."""
 9
10    LARGE_VALUE_THRESHOLD = 2000
11
12    def __init__(self, name, prop_type, value, state) -> None:
13        self.name = name
14        self.prop_type = prop_type
15        self.state = state
16
17        if prop_type in (list, defaultdict) and (
18            len(value) > self.LARGE_VALUE_THRESHOLD
19        ):
20            print(len(value))
21            self.value = "LARGE_VALUE"
22        else:
23            self.value = value
24
25    def __repr__(self) -> str:
26        return f"{self.name} ({self.prop_type.__name__}) : {self.value}"
27
28    def __eq__(self, other):
29        if self.name != other.name:
30            return False
31        if self.prop_type != other.prop_type:
32            return False
33        if self.state != other.state:
34            return False
35        if self.value != other.value:
36            return False
37        return True
class Property:
 8class Property:
 9    """Implements the property of a transpiler pass as a data structure."""
10
11    LARGE_VALUE_THRESHOLD = 2000
12
13    def __init__(self, name, prop_type, value, state) -> None:
14        self.name = name
15        self.prop_type = prop_type
16        self.state = state
17
18        if prop_type in (list, defaultdict) and (
19            len(value) > self.LARGE_VALUE_THRESHOLD
20        ):
21            print(len(value))
22            self.value = "LARGE_VALUE"
23        else:
24            self.value = value
25
26    def __repr__(self) -> str:
27        return f"{self.name} ({self.prop_type.__name__}) : {self.value}"
28
29    def __eq__(self, other):
30        if self.name != other.name:
31            return False
32        if self.prop_type != other.prop_type:
33            return False
34        if self.state != other.state:
35            return False
36        if self.value != other.value:
37            return False
38        return True

Implements the property of a transpiler pass as a data structure.

Property(name, prop_type, value, state)
13    def __init__(self, name, prop_type, value, state) -> None:
14        self.name = name
15        self.prop_type = prop_type
16        self.state = state
17
18        if prop_type in (list, defaultdict) and (
19            len(value) > self.LARGE_VALUE_THRESHOLD
20        ):
21            print(len(value))
22            self.value = "LARGE_VALUE"
23        else:
24            self.value = value
LARGE_VALUE_THRESHOLD = 2000
name
prop_type
state