Skip to content

Commit 53b1e33

Browse files
committed
formatting
Signed-off-by: Bettina Heim <[email protected]>
1 parent eacfe78 commit 53b1e33

14 files changed

+940
-553
lines changed

python/cudaq/kernel/analysis.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,15 @@ def visit_FunctionDef(self, node):
5656
[self.visit(stm) for stm in node.body]
5757

5858
def visit_Attribute(self, node):
59-
if not self.kernelName: return
59+
if not self.kernelName:
60+
return
6061
if node.attr in globalAstRegistry:
6162
self.depKernels[node.attr] = globalAstRegistry[node.attr]
6263
self.visit(node.value)
6364

6465
def visit_Name(self, node):
65-
if not self.kernelName: return
66+
if not self.kernelName:
67+
return
6668
if node.id in globalAstRegistry:
6769
self.depKernels[node.id] = globalAstRegistry[node.id]
6870

python/cudaq/kernel/ast_bridge.py

Lines changed: 596 additions & 349 deletions
Large diffs are not rendered by default.

python/cudaq/kernel/utils.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,22 +187,24 @@ def emitFatalErrorOverride(msg):
187187
f"Callable type must have signature specified ({ast.unparse(annotation) if hasattr(ast, 'unparse') else annotation})."
188188
)
189189

190-
if hasattr(annotation.slice, 'elts') and len(annotation.slice.elts) == 2:
190+
if hasattr(annotation.slice, 'elts') and len(
191+
annotation.slice.elts) == 2:
191192
args = annotation.slice.elts[0]
192193
ret = annotation.slice.elts[1]
193194
elif hasattr(annotation.slice, 'value') and hasattr(
194-
annotation.slice.value, 'elts') and len(annotation.slice.value.elts) == 2:
195+
annotation.slice.value, 'elts') and len(
196+
annotation.slice.value.elts) == 2:
195197
args = annotation.slice.value.elts[0]
196198
ret = annotation.slice.value.elts[1]
197199
else:
198200
localEmitFatalError(
199201
f"Unable to get list elements when inferring type from annotation ({ast.unparse(annotation) if hasattr(ast, 'unparse') else annotation})."
200202
)
201-
argTypes = [
202-
mlirTypeFromAnnotation(a, ctx) for a in args.elts
203-
]
203+
argTypes = [mlirTypeFromAnnotation(a, ctx) for a in args.elts]
204204
if not isinstance(ret, ast.Constant) or ret.value:
205-
localEmitFatalError("passing kernels as arguments that return a value is not currently supported")
205+
localEmitFatalError(
206+
"passing kernels as arguments that return a value is not currently supported"
207+
)
206208
return cc.CallableType.get(argTypes)
207209

208210
if isinstance(annotation,

0 commit comments

Comments
 (0)