Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit a4d9c7d

Browse files
committed
Move duplicate include_path docs to prose
There's no need to repeat ourselves, and having it makes the documentation fiddlier to read.
1 parent d66cfb5 commit a4d9c7d

File tree

2 files changed

+7
-26
lines changed

2 files changed

+7
-26
lines changed

docs/parse.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ This package currently contains two public functions, both of which create a
99
while :func:`loads` takes the program itself as a string. Their internals are very similar, so both
1010
offer the same API.
1111

12-
Both functions can optionally take an `include_path` argument, which contains the directories that
13-
should be searched (in order) to find files specified by ``include`` statements in OpenQASM 2. The
14-
include ``qelib1.inc`` is treated as a system include; this will always be found, regardless of the
15-
import settings. This helps ensure correct mapping to gates that Qiskit has builtin definitions for.
16-
1712
.. autofunction:: load
1813

1914
.. autofunction:: loads
2015

16+
Both of these loading functions also take an argument `include_path`, which is an iterable of
17+
directory names to use when searching for files in ``include`` statements. The directories are
18+
tried from index 0 onwards, and the first match is used. The import ``qelib1.inc`` is treated
19+
specially; it is always found before looking in the include path, and contains exactly the content
20+
of the `paper describing the OpenQASM 2 language <https://arxiv.org/abs/1707.03429>`__. The gates
21+
in this include file are mapped to standard gates provided by Qiskit.
22+
2123
In cases where the lexer or parser fails due to an invalid OpenQASM 2 file, the conversion functions
2224
will raise an error with a message explaining what the failure is, and where in the file it
2325
occurred.

src-python/qiskit_qasm2/__init__.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,6 @@ def loads(string: str, include_path: Iterable[Union[str, os.PathLike]] = (".",))
2626
2727
:param string: The OpenQASM 2 program in a string.
2828
:type string: str
29-
:param include_path: An iterable of directories to use when searching for include files. These
30-
are tried in order, from index 0 onwards, and the first match is used. The import
31-
`qelib1.inc` is treated as a system include, and will always be found regardless of the
32-
value of this argument.
33-
34-
By default, this contains only the current working directory.
35-
:type include_path: Iterable[Union[str, os.PathLike]]
36-
37-
:raises QASM2ParseError: If the OpenQASM 2 program is invalid, or otherwise cannot be converted
38-
to Qiskit format.
3929
4030
:return: A circuit object representing the same OpenQASM 2 program.
4131
:rtype: ~qiskit.circuit.QuantumCircuit
@@ -56,22 +46,11 @@ def load(
5646
:param filename: A filename for a file that contains an OpenQASM 2 program.
5747
:type filename: str
5848
59-
:param include_path: An iterable of directories to use when searching for include files. These
60-
are tried in order, from index 0 onwards, and the first match is used. The import
61-
`qelib1.inc` is treated as a system include, and will always be found regardless of the
62-
value of this argument.
63-
64-
By default, this contains only the current working directory.
65-
:type include_path: Iterable[Union[str, os.PathLike]]
66-
6749
:param include_file_directory: Whether to add the directory of the input file to the
6850
`include_path`, and if so, whether to `append` it to search last, or `prepend` it to search
6951
first. Pass `None` to suppress adding this directory entirely.
7052
:type include_file_directory: ``None``, ``"append"`` or ``"prepend"``.
7153
72-
:raises QASM2ParseError: If the OpenQASM 2 program is invalid, or otherwise cannot be converted
73-
to Qiskit format.
74-
7554
:return: A circuit object representing the same OpenQASM 2 program.
7655
:rtype: ~qiskit.circuit.QuantumCircuit
7756
"""

0 commit comments

Comments
 (0)