@@ -730,7 +730,7 @@ def release_all_qubits(self):
730730 """
731731 return self .release_qubits (self .active_qubits [:])
732732
733- # sendFactory is depecrated. Do not use it . #
733+ # sendFactory is depecrated. Use flush_factory() instead . #
734734 def sendFactory (
735735 self ,
736736 qID ,
@@ -1481,14 +1481,14 @@ def ref_id(self):
14811481 # override the == operator
14821482 # other can be a CQCVariable or int
14831483 def __eq__ (self , other : Union ['CQCVariable' , int ]):
1484- return LogicalFunction (self , CQCLogicalOperator .EQ , other )
1484+ return _LogicalFunction (self , CQCLogicalOperator .EQ , other )
14851485
14861486 # override the != operator
14871487 def __ne__ (self , other : Union ['CQCVariable' , int ]):
1488- return LogicalFunction (self , CQCLogicalOperator .NEQ , other )
1488+ return _LogicalFunction (self , CQCLogicalOperator .NEQ , other )
14891489
14901490
1491- class LogicalFunction :
1491+ class _LogicalFunction :
14921492 """
14931493 Private helper class. This class should never be used outside this pythonLib.
14941494 """
@@ -1516,8 +1516,8 @@ def __init__(
15161516 self .operator = operator
15171517 self .operand_two = operand_two
15181518
1519- def get_negation (self ) -> 'LogicalFunction ' :
1520- return LogicalFunction (self .operand_one , CQCLogicalOperator .opposite_of (self .operator ), self .operand_two )
1519+ def get_negation (self ) -> '_LogicalFunction ' :
1520+ return _LogicalFunction (self .operand_one , CQCLogicalOperator .opposite_of (self .operator ), self .operand_two )
15211521
15221522 def get_CQCIfHeader (self ) -> CQCIfHeader :
15231523 """
@@ -1598,28 +1598,28 @@ def __exit__(self, exc_type, exc_val, exc_tb):
15981598 # current_scope is only used inside CQCMix contexts
15991599 self ._conn .current_scope = None
16001600
1601- def cqc_if (self , logical_function : LogicalFunction ):
1601+ def cqc_if (self , logical_function : _LogicalFunction ):
16021602 """
16031603 Open a Python Context Manager Type to start an if-statement block.
16041604
16051605 - **Arguments**
16061606
1607- :logical_function: A LogicalFunction instance. Never instantiate this explicitely; instead
1607+ :logical_function: A _LogicalFunction instance. Never instantiate this explicitely; instead
16081608 use the following: CQCVariable == 1 OR CQCVariable == CQCVariable.
16091609 CQCVariable can be any instance that you want to test to a value, or to another
16101610 CQCVariable. The operator can be == or !=.
16111611 The value can be any integer (though only 1 and 0 make sense).
16121612
16131613 """
1614- return CQCConditional (self ._conn , False , logical_function )
1614+ return _CQCConditional (self ._conn , False , logical_function )
16151615
16161616 def cqc_else (self ):
16171617 """
16181618 Open a Python Context Manager Type to start an else-statement block.
16191619 This will be an else-block of the last closed cqc_if-block.
16201620 """
16211621 # Find out to which if this else belongs
1622- return CQCConditional (self ._conn , True )
1622+ return _CQCConditional (self ._conn , True )
16231623
16241624 def loop (self , times : int ):
16251625 """
@@ -1630,10 +1630,10 @@ def loop(self, times: int):
16301630 :times: The number of times the commands inside body of this context should be repeated.
16311631
16321632 """
1633- return CQCFactory (self ._conn , times )
1633+ return _CQCFactory (self ._conn , times )
16341634
16351635
1636- class CQCFactory :
1636+ class _CQCFactory :
16371637 """
16381638 Private class to create factories inside CQCMix contexts. Never explicitely instantiate this class outside
16391639 the source code of this library.
@@ -1680,34 +1680,34 @@ def __exit__(self, exc_type, exc_val, exc_tb):
16801680 self .type_header .length = body_length
16811681
16821682
1683- class CQCConditional (NodeMixin ):
1683+ class _CQCConditional (NodeMixin ):
16841684 """
16851685 Private helper class. Never explicitely instantiate this class outside the source code of this library.
16861686 This Context Manager class is instantiated by CQCMix.cqc_if() and CQCMix.cqc_else(). Its
16871687 function is to build and pend CQC If headers.
16881688 """
16891689
1690- # This private class variable holds the last CQCConditional that
1690+ # This private class variable holds the last _CQCConditional that
16911691 # functioned as an IF (as opposed to an ELSE) on which __exit__ is invoked.
16921692 # In other words, it is the last closed IF statement.
16931693 # This is important so that ELSE statements can find out to which IF statement they belong.
16941694 # If this variable is None, then there either has not been aan IF statement yet, or the last
1695- # CQCConditional was an ELSE.
1695+ # _CQCConditional was an ELSE.
16961696 _last_closed_conditional = None
16971697
1698- def __init__ (self , cqc_connection : CQCConnection , is_else : bool , logical_function : LogicalFunction = None ):
1698+ def __init__ (self , cqc_connection : CQCConnection , is_else : bool , logical_function : _LogicalFunction = None ):
16991699 self ._conn = cqc_connection
17001700 self .is_else = is_else
17011701
17021702 if is_else :
17031703 # If _last_closed_conditional is None, then there either has not been aan IF statement yet, or the last
1704- # CQCConditional was an ELSE.
1705- if CQCConditional ._last_closed_conditional is None :
1704+ # _CQCConditional was an ELSE.
1705+ if _CQCConditional ._last_closed_conditional is None :
17061706 raise CQCGeneralError ('Cannot use an ELSE if there is no IF directly before it.' )
17071707 else :
17081708 # Get the negation of the logical function of the IF,
17091709 # which will be the logical function for this ELSE statement
1710- logical_function = CQCConditional ._last_closed_conditional ._logical_function .get_negation ()
1710+ logical_function = _CQCConditional ._last_closed_conditional ._logical_function .get_negation ()
17111711
17121712 self ._logical_function = logical_function
17131713
@@ -1729,9 +1729,9 @@ def __exit__(self, exc_type, exc_val, exc_tb):
17291729
17301730 # Set _last_closed_conditional to the correct value
17311731 if (self .is_else ):
1732- CQCConditional ._last_closed_conditional = None
1732+ _CQCConditional ._last_closed_conditional = None
17331733 else :
1734- CQCConditional ._last_closed_conditional = self
1734+ _CQCConditional ._last_closed_conditional = self
17351735
17361736 # Calculate the length of the body of the conditional
17371737 # Loop in reverse through all pending_headers to calculate the lenght of all headers
@@ -1949,15 +1949,15 @@ def check_active(self):
19491949 or self .scope_of_deactivation in self ._cqc .current_scope .descendants
19501950 ):
19511951
1952- raise QubitNotActiveError ("""
1953- Qubit is not active. Possible causes:
1954- - Qubit is sent to another node
1955- - Qubit is measured (with inplace=False)
1956- - Qubit is released
1957- - Qubit is not received
1958- - Qubit is used and created in the same factory
1959- - Qubit is measured (with inplace=False) inside a cqc_if block earlier in the code
1960- """ )
1952+ raise QubitNotActiveError (
1953+ " Qubit is not active. Possible causes:\n "
1954+ " - Qubit is sent to another node\n "
1955+ " - Qubit is measured (with inplace=False)\n "
1956+ " - Qubit is released\n "
1957+ " - Qubit is not received\n "
1958+ " - Qubit is used and created in the same factory\n "
1959+ " - Qubit is measured (with inplace=False) inside a cqc_if block earlier in the code\n "
1960+ )
19611961
19621962 def _set_active (self , be_active ):
19631963
0 commit comments