Skip to content

Commit dd9366c

Browse files
committed
add more docstring
1 parent f5b070a commit dd9366c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/bloqade/qasm2/_qasm_loading.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ def loads(
3131
lineno_offset (int): The line number offset for error reporting. Defaults to 0.
3232
col_offset (int): The column number offset for error reporting. Defaults to 0.
3333
compactify (bool): Whether to compactify the output. Defaults to True.
34+
35+
Example:
36+
37+
```python
38+
from bloqade import qasm2
39+
method = qasm2.loads('''
40+
OPENQASM 2.0;
41+
qreg q[2];
42+
creg c[2];
43+
h q[0];
44+
cx q[0], q[1];
45+
measure q[0] -> c[0];
46+
''')
47+
```
3448
"""
3549
return QASM2(dialects or main).loads(
3650
qasm,
@@ -54,7 +68,7 @@ def loadfile(
5468
col_offset: int = 0,
5569
compactify: bool = True,
5670
) -> ir.Method[[], None]:
57-
"""Loads a QASM2 file and returns the corresponding kernel object.
71+
"""Loads a QASM2 file and returns the corresponding kernel object. See also `loads`.
5872
5973
Args:
6074
qasm_file (str): The QASM2 file to load.

0 commit comments

Comments
 (0)