From d13aa87ea15ca92dc7eab5f3b38e9ac2864f90c1 Mon Sep 17 00:00:00 2001 From: Drew Vandeth Date: Thu, 29 Aug 2024 20:48:19 +1000 Subject: [PATCH] edocs fix --- docs/conf.py | 1 + src/qiskit_qec/operators/pauli.py | 33 ++++++++++++------------------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 530c8a37..5ae085a7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -34,6 +34,7 @@ "sphinx.ext.mathjax", "sphinx.ext.viewcode", "sphinx.ext.extlinks", + "sphinx.ext.napoleon", "sphinx_autodoc_typehints", "nbsphinx", "matplotlib.sphinxext.plot_directive", diff --git a/src/qiskit_qec/operators/pauli.py b/src/qiskit_qec/operators/pauli.py index c60cb930..d93f659c 100644 --- a/src/qiskit_qec/operators/pauli.py +++ b/src/qiskit_qec/operators/pauli.py @@ -52,33 +52,27 @@ def __init__( tuple_order: Optional[str] = "zx", num_qubits: Optional[int] = None, ): - r"""Initialize the Pauli + """Initialize the Pauli - Args: - data (str | tuple | List | np.ndarray | BasePauli | None): Input data. + Initialiazation of the N-qubit Pauli operator + Args: + data (Union[str, tuple, List, np.ndarray, BasePauli, None]): Input data. x (Union[List, np.ndarray, None], optional): X part. Defaults to None. - z (Union[List, np.ndarray, None], optional): Z part. Defaults to None. - phase_exp (Union[str, np.ndarray, None], optional): Phase expression of Pauli. Defaults to None. - input_pauli_encoding (str, optional): What encoding is used for the input data. Defaults to BasePauli.EXTERNAL_PAULI_ENCODING. - input_qubit_order (str, optional): Qubit read order. Defaults to "right-to-left". - order (str, optional): Order in which data lists X and Z. Defaults to 'xz'. - tuple_order (str, optional): Order in data for X and Z parts of tuples. Defaults to 'zx'. - num_qubits (int, optional): Number of qubits to use in Pauli. Defaults to None. @@ -86,35 +80,34 @@ def __init__( QiskitError: Something went wrong. Examples: - >>>Pauli('XYXXIZ') + >>> Pauli('XYXXIZ') Pauli('XYXXIZ') - >>>Pauli('X1Y3Z12') + >>> Pauli('X1Y3Z12') Pauli('ZIIIIIIIIYIXI') - >>>Pauli('X', num_qubits=12) + >>> Pauli('X', num_qubits=12) Pauli('IIIIIIIIIIIX') - >>>Pauli(np.array([[0,1,1,1]]), phase_exp="(-i,1)", num_qubits=10) + >>> Pauli(np.array([[0,1,1,1]]), phase_exp="(-i,1)", num_qubits=10) Pauli('-iIIIIIIIIYZ') - >>>Pauli(np.array([[0,1,1,1]]),phase_exp="(-i,1)", num_qubits=10, order="zx") + >>> Pauli(np.array([[0,1,1,1]]),phase_exp="(-i,1)", num_qubits=10, order="zx") Pauli('-iIIIIIIIIYX') - >>>Pauli(None, x=[0,1],z=[1,1],phase_exp = '-i') + >>> Pauli(None, x=[0,1],z=[1,1],phase_exp = '-i') Pauli('-iYZ') - >>>Pauli(np.array([[0,1,1,1]]), + >>> Pauli(np.array([[0,1,1,1]]), phase_exp="(-i,1)(-1,0)", num_qubits=10, order="zx", input_pauli_encoding='-isXZ') Pauli('-iIIIIIIIIYX') - >>>Pauli(([0,1],[1,1],'-i'), tuple_order='xz') + >>> Pauli(([0,1],[1,1],'-i'), tuple_order='xz') Pauli('-iYZ') - >>>Pauli(([0,1],[1,1],'-i')) + >>> Pauli(([0,1],[1,1],'-i')) Pauli('-iYX') - """ # str if isinstance(data, str):