We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Typos in qutip.expect()'s docstring
### Bug Description

Two words in the docstring contain typos. See below.

### Code to Reproduce the Bug

```shell
from qutip import expect
print(expect.__doc__)
```


### Code Output

```shell
Parameters
----------
oper : qobj/array-like
    A single or a `list` or operators for expectation value.

state : qobj/array-like
    A single or a `list` of quantum states or density matrices.

Returns
-------
expt : float/complex/array-like
    Expectation value.  ``real`` if `oper` is Hermitian, ``complex``
    otherwise. A (nested) array of expectaction values of state or operator
    are arrays.
```


### Expected Behaviour

Parameters
----------
oper : qobj/array-like
    A single or a `list` **~~or~~** **_of_** operators for expectation value.

state : qobj/array-like
    A single or a `list` of quantum states or density matrices.

Returns
-------
expt : float/complex/array-like
    Expectation value.  ``real`` if `oper` is Hermitian, ``complex``
    otherwise. A (nested) array of expectaction values **~~of~~** **_if_** state or operator
    are arrays.

### Your Environment

```shell
QuTiP Version:      4.7.5
Numpy Version:      1.26.4
Scipy Version:      1.11.4
Cython Version:     None
Matplotlib Version: 3.8.3
Python Version:     3.12.2
Number of CPUs:     8
BLAS Info:          Generic
OPENMP Installed:   False
INTEL MKL Ext:      False
Platform Info:      Windows (AMD64)
```


### Additional Context

_No response_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `qutip/core/expect.py`
Content:
```
1 __all__ = ['expect', 'variance']
2 
3 import numpy as np
4 
5 from .qobj import Qobj
6 from . import data as _data
7 
8 
9 def expect(oper, state):
10     """
11     Calculate the expectation value for operator(s) and state(s).  The
12     expectation of state ``k`` on operator ``A`` is defined as
13     ``k.dag() @ A @ k``, and for density matrix ``R`` on operator ``A`` it is
14     ``trace(A @ R)``.
15 
16     Parameters
17     ----------
18     oper : qobj/array-like
19         A single or a `list` or operators for expectation value.
20 
21     state : qobj/array-like
22         A single or a `list` of quantum states or density matrices.
23 
24     Returns
25     -------
26     expt : float/complex/array-like
27         Expectation value.  ``real`` if ``oper`` is Hermitian, ``complex``
28         otherwise. A (nested) array of expectaction values of state or operator
29         are arrays.
30 
31     Examples
32     --------
33     >>> expect(num(4), basis(4, 3)) == 3 # doctest: +NORMALIZE_WHITESPACE
34         True
35 
36     """
37     if isinstance(state, Qobj) and isinstance(oper, Qobj):
38         return _single_qobj_expect(oper, state)
39 
40     elif isinstance(oper, (list, np.ndarray)):
41         if isinstance(state, Qobj):
42             dtype = np.complex128
43             if all(op.isherm for op in oper) and (state.isket or state.isherm):
44                 dtype = np.float64
45             return np.array([_single_qobj_expect(op, state) for op in oper],
46                             dtype=dtype)
47         return [expect(op, state) for op in oper]
48 
49     elif isinstance(state, (list, np.ndarray)):
50         dtype = np.complex128
51         if oper.isherm and all(op.isherm or op.isket for op in state):
52             dtype = np.float64
53         return np.array([_single_qobj_expect(oper, x) for x in state],
54                         dtype=dtype)
55     raise TypeError('Arguments must be quantum objects')
56 
57 
58 def _single_qobj_expect(oper, state):
59     """
60     Private function used by expect to calculate expectation values of Qobjs.
61     """
62     if not oper.isoper or not (state.isket or state.isoper):
63         raise TypeError('invalid operand types')
64     if oper.dims[1] != state.dims[0]:
65         msg = (
66             "incompatible dimensions "
67             + str(oper.dims[1]) + " and " + str(state.dims[0])
68         )
69         raise ValueError(msg)
70     out = _data.expect(oper.data, state.data)
71 
72     # This ensures that expect can return something that is not a number such
73     # as a `tensorflow.Tensor` in qutip-tensorflow.
74     return out.real if (oper.isherm
75                         and (state.isket or state.isherm)
76                         and hasattr(out, "real")
77                         ) else out
78 
79 
80 def variance(oper, state):
81     """
82     Variance of an operator for the given state vector or density matrix.
83 
84     Parameters
85     ----------
86     oper : qobj
87         Operator for expectation value.
88 
89     state : qobj/list
90         A single or ``list`` of quantum states or density matrices..
91 
92     Returns
93     -------
94     var : float
95         Variance of operator 'oper' for given state.
96 
97     """
98     return expect(oper**2, state) - expect(oper, state)**2
99
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/qutip/core/expect.py b/qutip/core/expect.py
--- a/qutip/core/expect.py
+++ b/qutip/core/expect.py
@@ -16,7 +16,7 @@
     Parameters
     ----------
     oper : qobj/array-like
-        A single or a `list` or operators for expectation value.
+        A single or a `list` of operators for expectation value.
 
     state : qobj/array-like
         A single or a `list` of quantum states or density matrices.
@@ -25,8 +25,8 @@
     -------
     expt : float/complex/array-like
         Expectation value.  ``real`` if ``oper`` is Hermitian, ``complex``
-        otherwise. A (nested) array of expectaction values of state or operator
-        are arrays.
+        otherwise. A (nested) array of expectaction values if ``state`` or
+        ``oper`` are arrays.
 
     Examples
     --------

{"golden_diff": "diff --git a/qutip/core/expect.py b/qutip/core/expect.py\n--- a/qutip/core/expect.py\n+++ b/qutip/core/expect.py\n@@ -16,7 +16,7 @@\n     Parameters\n     ----------\n     oper : qobj/array-like\n-        A single or a `list` or operators for expectation value.\n+        A single or a `list` of operators for expectation value.\n \n     state : qobj/array-like\n         A single or a `list` of quantum states or density matrices.\n@@ -25,8 +25,8 @@\n     -------\n     expt : float/complex/array-like\n         Expectation value.  ``real`` if ``oper`` is Hermitian, ``complex``\n-        otherwise. A (nested) array of expectaction values of state or operator\n-        are arrays.\n+        otherwise. A (nested) array of expectaction values if ``state`` or\n+        ``oper`` are arrays.\n \n     Examples\n     --------\n", "issue": "Typos in qutip.expect()'s docstring\n### Bug Description\r\n\r\nTwo words in the docstring contain typos. See below.\r\n\r\n### Code to Reproduce the Bug\r\n\r\n```shell\r\nfrom qutip import expect\r\nprint(expect.__doc__)\r\n```\r\n\r\n\r\n### Code Output\r\n\r\n```shell\r\nParameters\r\n----------\r\noper : qobj/array-like\r\n    A single or a `list` or operators for expectation value.\r\n\r\nstate : qobj/array-like\r\n    A single or a `list` of quantum states or density matrices.\r\n\r\nReturns\r\n-------\r\nexpt : float/complex/array-like\r\n    Expectation value.  ``real`` if `oper` is Hermitian, ``complex``\r\n    otherwise. A (nested) array of expectaction values of state or operator\r\n    are arrays.\r\n```\r\n\r\n\r\n### Expected Behaviour\r\n\r\nParameters\r\n----------\r\noper : qobj/array-like\r\n    A single or a `list` **~~or~~** **_of_** operators for expectation value.\r\n\r\nstate : qobj/array-like\r\n    A single or a `list` of quantum states or density matrices.\r\n\r\nReturns\r\n-------\r\nexpt : float/complex/array-like\r\n    Expectation value.  ``real`` if `oper` is Hermitian, ``complex``\r\n    otherwise. A (nested) array of expectaction values **~~of~~** **_if_** state or operator\r\n    are arrays.\r\n\r\n### Your Environment\r\n\r\n```shell\r\nQuTiP Version:      4.7.5\r\nNumpy Version:      1.26.4\r\nScipy Version:      1.11.4\r\nCython Version:     None\r\nMatplotlib Version: 3.8.3\r\nPython Version:     3.12.2\r\nNumber of CPUs:     8\r\nBLAS Info:          Generic\r\nOPENMP Installed:   False\r\nINTEL MKL Ext:      False\r\nPlatform Info:      Windows (AMD64)\r\n```\r\n\r\n\r\n### Additional Context\r\n\r\n_No response_\n", "before_files": [{"content": "__all__ = ['expect', 'variance']\n\nimport numpy as np\n\nfrom .qobj import Qobj\nfrom . import data as _data\n\n\ndef expect(oper, state):\n    \"\"\"\n    Calculate the expectation value for operator(s) and state(s).  The\n    expectation of state ``k`` on operator ``A`` is defined as\n    ``k.dag() @ A @ k``, and for density matrix ``R`` on operator ``A`` it is\n    ``trace(A @ R)``.\n\n    Parameters\n    ----------\n    oper : qobj/array-like\n        A single or a `list` or operators for expectation value.\n\n    state : qobj/array-like\n        A single or a `list` of quantum states or density matrices.\n\n    Returns\n    -------\n    expt : float/complex/array-like\n        Expectation value.  ``real`` if ``oper`` is Hermitian, ``complex``\n        otherwise. A (nested) array of expectaction values of state or operator\n        are arrays.\n\n    Examples\n    --------\n    >>> expect(num(4), basis(4, 3)) == 3 # doctest: +NORMALIZE_WHITESPACE\n        True\n\n    \"\"\"\n    if isinstance(state, Qobj) and isinstance(oper, Qobj):\n        return _single_qobj_expect(oper, state)\n\n    elif isinstance(oper, (list, np.ndarray)):\n        if isinstance(state, Qobj):\n            dtype = np.complex128\n            if all(op.isherm for op in oper) and (state.isket or state.isherm):\n                dtype = np.float64\n            return np.array([_single_qobj_expect(op, state) for op in oper],\n                            dtype=dtype)\n        return [expect(op, state) for op in oper]\n\n    elif isinstance(state, (list, np.ndarray)):\n        dtype = np.complex128\n        if oper.isherm and all(op.isherm or op.isket for op in state):\n            dtype = np.float64\n        return np.array([_single_qobj_expect(oper, x) for x in state],\n                        dtype=dtype)\n    raise TypeError('Arguments must be quantum objects')\n\n\ndef _single_qobj_expect(oper, state):\n    \"\"\"\n    Private function used by expect to calculate expectation values of Qobjs.\n    \"\"\"\n    if not oper.isoper or not (state.isket or state.isoper):\n        raise TypeError('invalid operand types')\n    if oper.dims[1] != state.dims[0]:\n        msg = (\n            \"incompatible dimensions \"\n            + str(oper.dims[1]) + \" and \" + str(state.dims[0])\n        )\n        raise ValueError(msg)\n    out = _data.expect(oper.data, state.data)\n\n    # This ensures that expect can return something that is not a number such\n    # as a `tensorflow.Tensor` in qutip-tensorflow.\n    return out.real if (oper.isherm\n                        and (state.isket or state.isherm)\n                        and hasattr(out, \"real\")\n                        ) else out\n\n\ndef variance(oper, state):\n    \"\"\"\n    Variance of an operator for the given state vector or density matrix.\n\n    Parameters\n    ----------\n    oper : qobj\n        Operator for expectation value.\n\n    state : qobj/list\n        A single or ``list`` of quantum states or density matrices..\n\n    Returns\n    -------\n    var : float\n        Variance of operator 'oper' for given state.\n\n    \"\"\"\n    return expect(oper**2, state) - expect(oper, state)**2\n", "path": "qutip/core/expect.py"}], "after_files": [{"content": "__all__ = ['expect', 'variance']\n\nimport numpy as np\n\nfrom .qobj import Qobj\nfrom . import data as _data\n\n\ndef expect(oper, state):\n    \"\"\"\n    Calculate the expectation value for operator(s) and state(s).  The\n    expectation of state ``k`` on operator ``A`` is defined as\n    ``k.dag() @ A @ k``, and for density matrix ``R`` on operator ``A`` it is\n    ``trace(A @ R)``.\n\n    Parameters\n    ----------\n    oper : qobj/array-like\n        A single or a `list` of operators for expectation value.\n\n    state : qobj/array-like\n        A single or a `list` of quantum states or density matrices.\n\n    Returns\n    -------\n    expt : float/complex/array-like\n        Expectation value.  ``real`` if ``oper`` is Hermitian, ``complex``\n        otherwise. A (nested) array of expectaction values if ``state`` or\n        ``oper`` are arrays.\n\n    Examples\n    --------\n    >>> expect(num(4), basis(4, 3)) == 3 # doctest: +NORMALIZE_WHITESPACE\n        True\n\n    \"\"\"\n    if isinstance(state, Qobj) and isinstance(oper, Qobj):\n        return _single_qobj_expect(oper, state)\n\n    elif isinstance(oper, (list, np.ndarray)):\n        if isinstance(state, Qobj):\n            dtype = np.complex128\n            if all(op.isherm for op in oper) and (state.isket or state.isherm):\n                dtype = np.float64\n            return np.array([_single_qobj_expect(op, state) for op in oper],\n                            dtype=dtype)\n        return [expect(op, state) for op in oper]\n\n    elif isinstance(state, (list, np.ndarray)):\n        dtype = np.complex128\n        if oper.isherm and all(op.isherm or op.isket for op in state):\n            dtype = np.float64\n        return np.array([_single_qobj_expect(oper, x) for x in state],\n                        dtype=dtype)\n    raise TypeError('Arguments must be quantum objects')\n\n\ndef _single_qobj_expect(oper, state):\n    \"\"\"\n    Private function used by expect to calculate expectation values of Qobjs.\n    \"\"\"\n    if not oper.isoper or not (state.isket or state.isoper):\n        raise TypeError('invalid operand types')\n    if oper.dims[1] != state.dims[0]:\n        msg = (\n            \"incompatible dimensions \"\n            + str(oper.dims[1]) + \" and \" + str(state.dims[0])\n        )\n        raise ValueError(msg)\n    out = _data.expect(oper.data, state.data)\n\n    # This ensures that expect can return something that is not a number such\n    # as a `tensorflow.Tensor` in qutip-tensorflow.\n    return out.real if (oper.isherm\n                        and (state.isket or state.isherm)\n                        and hasattr(out, \"real\")\n                        ) else out\n\n\ndef variance(oper, state):\n    \"\"\"\n    Variance of an operator for the given state vector or density matrix.\n\n    Parameters\n    ----------\n    oper : qobj\n        Operator for expectation value.\n\n    state : qobj/list\n        A single or ``list`` of quantum states or density matrices..\n\n    Returns\n    -------\n    var : float\n        Variance of operator 'oper' for given state.\n\n    \"\"\"\n    return expect(oper**2, state) - expect(oper, state)**2\n", "path": "qutip/core/expect.py"}]}