Skip to content

Commit

Permalink
add some docstrings
Browse files Browse the repository at this point in the history
Signed-off-by: Alex McCaskey <amccaskey@nvidia.com>
  • Loading branch information
amccaskey committed Mar 28, 2024
1 parent cf927c5 commit e8199db
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions python/cudaq/kernel/ast_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,10 @@ def argumentsValidForFunction(self, values, functionTy):
]

def checkControlAndTargetTypes(self, controls, targets):
"""
Loop through the provided control and target qubit values and
assert that they are of quantum type. Emit a fatal error if not.
"""
[
self.emitFatalError(f'control operand {i} is not of quantum type.')
if not self.isQuantumType(control.type) else None
Expand Down Expand Up @@ -1646,6 +1650,12 @@ def bodyBuilder(iterVal):
return

def maybeProposeOpAttrFix(opName, attrName):
"""
Check the quantum operation attribute name and
propose a smart fix message if possible. For example,
if we have `x.control(...)` then remind the programmer the
correct attribute is `x.ctrl(...)`.
"""
# TODO Add more possibilities in the future...
if attrName in ['control'
] or 'control' in attrName or 'ctrl' in attrName:
Expand Down

0 comments on commit e8199db

Please sign in to comment.