We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
NEP-18 sort kind translation is incorrect
### Version of Awkward Array

main

### Description and code to reproduce

We only support "stable", so we should just coerce the algorithms into a `stable` flag.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/awkward/operations/ak_sort.py`
Content:
```
1 # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
2 
3 import awkward as ak
4 from awkward._connect.numpy import unsupported
5 
6 np = ak._nplikes.NumpyMetadata.instance()
7 
8 
9 def sort(array, axis=-1, *, ascending=True, stable=True, highlevel=True, behavior=None):
10     """
11     Args:
12         array: Array-like data (anything #ak.to_layout recognizes).
13         axis (int): The dimension at which this operation is applied. The
14             outermost dimension is `0`, followed by `1`, etc., and negative
15             values count backward from the innermost: `-1` is the innermost
16             dimension, `-2` is the next level up, etc.
17         ascending (bool): If True, the first value in each sorted group
18             will be smallest, the last value largest; if False, the order
19             is from largest to smallest.
20         stable (bool): If True, use a stable sorting algorithm (introsort:
21             a hybrid of quicksort, heapsort, and insertion sort); if False,
22             use a sorting algorithm that is not guaranteed to be stable
23             (heapsort).
24         highlevel (bool): If True, return an #ak.Array; otherwise, return
25             a low-level #ak.contents.Content subclass.
26         behavior (None or dict): Custom #ak.behavior for the output array, if
27             high-level.
28 
29     Returns a sorted array.
30 
31     For example,
32 
33         >>> ak.sort(ak.Array([[7, 5, 7], [], [2], [8, 2]]))
34         <Array [[5, 7, 7], [], [2], [2, 8]] type='4 * var * int64'>
35     """
36     with ak._errors.OperationErrorContext(
37         "ak.sort",
38         dict(
39             array=array,
40             axis=axis,
41             ascending=ascending,
42             stable=stable,
43             highlevel=highlevel,
44             behavior=behavior,
45         ),
46     ):
47         return _impl(array, axis, ascending, stable, highlevel, behavior)
48 
49 
50 def _impl(array, axis, ascending, stable, highlevel, behavior):
51     layout = ak.operations.to_layout(array, allow_record=False, allow_other=False)
52     out = ak._do.sort(layout, axis, ascending, stable)
53     return ak._util.wrap(out, behavior, highlevel, like=array)
54 
55 
56 @ak._connect.numpy.implements("sort")
57 def _nep_18_impl(a, axis=-1, kind=None, order=unsupported):
58     if kind is None:
59         stable = False
60     elif kind == "stable":
61         stable = True
62     elif kind == "heapsort":
63         stable = False
64     else:
65         raise ak._errors.wrap_error(
66             ValueError(
67                 f"unsupported value for 'kind' passed to overloaded NumPy function 'sort': {kind!r}"
68             )
69         )
70     return sort(a, axis=axis, stable=stable)
71
```

Path: `src/awkward/operations/ak_argsort.py`
Content:
```
1 # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
2 
3 import awkward as ak
4 from awkward._connect.numpy import unsupported
5 
6 np = ak._nplikes.NumpyMetadata.instance()
7 
8 
9 def argsort(
10     array, axis=-1, *, ascending=True, stable=True, highlevel=True, behavior=None
11 ):
12     """
13     Args:
14         array: Array-like data (anything #ak.to_layout recognizes).
15         axis (int): The dimension at which this operation is applied. The
16             outermost dimension is `0`, followed by `1`, etc., and negative
17             values count backward from the innermost: `-1` is the innermost
18             dimension, `-2` is the next level up, etc.
19         ascending (bool): If True, the first value in each sorted group
20             will be smallest, the last value largest; if False, the order
21             is from largest to smallest.
22         stable (bool): If True, use a stable sorting algorithm (introsort:
23             a hybrid of quicksort, heapsort, and insertion sort); if False,
24             use a sorting algorithm that is not guaranteed to be stable
25             (heapsort).
26         highlevel (bool): If True, return an #ak.Array; otherwise, return
27             a low-level #ak.contents.Content subclass.
28         behavior (None or dict): Custom #ak.behavior for the output array, if
29             high-level.
30 
31     Returns an array of integer indexes that would sort the array if applied
32     as an integer-array slice.
33 
34     For example,
35 
36         >>> ak.argsort(ak.Array([[7.7, 5.5, 7.7], [], [2.2], [8.8, 2.2]]))
37         <Array [[1, 0, 2], [], [0], [1, 0]] type='4 * var * int64'>
38 
39     The result of this function can be used to index other arrays with the
40     same shape:
41 
42         >>> data = ak.Array([[7, 5, 7], [], [2], [8, 2]])
43         >>> index = ak.argsort(data)
44         >>> index
45         <Array [[1, 0, 2], [], [0], [1, 0]] type='4 * var * int64'>
46         >>> data[index]
47         <Array [[5, 7, 7], [], [2], [2, 8]] type='4 * var * int64'>
48     """
49     with ak._errors.OperationErrorContext(
50         "ak.argsort",
51         dict(
52             array=array,
53             axis=axis,
54             ascending=ascending,
55             stable=stable,
56             highlevel=highlevel,
57             behavior=behavior,
58         ),
59     ):
60         return _impl(array, axis, ascending, stable, highlevel, behavior)
61 
62 
63 def _impl(array, axis, ascending, stable, highlevel, behavior):
64     layout = ak.operations.to_layout(array, allow_record=False, allow_other=False)
65     out = ak._do.argsort(layout, axis, ascending, stable)
66     return ak._util.wrap(out, behavior, highlevel, like=array)
67 
68 
69 @ak._connect.numpy.implements("argsort")
70 def _nep_18_impl(a, axis=-1, kind=None, order=unsupported):
71     if kind is None:
72         stable = False
73     elif kind == "stable":
74         stable = True
75     elif kind == "heapsort":
76         stable = False
77     else:
78         raise ak._errors.wrap_error(
79             ValueError(
80                 f"unsupported value for 'kind' passed to overloaded NumPy function 'argsort': {kind!r}"
81             )
82         )
83     return argsort(a, axis=axis, stable=stable)
84
```
--- 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/src/awkward/operations/ak_argsort.py b/src/awkward/operations/ak_argsort.py
--- a/src/awkward/operations/ak_argsort.py
+++ b/src/awkward/operations/ak_argsort.py
@@ -70,9 +70,9 @@
 def _nep_18_impl(a, axis=-1, kind=None, order=unsupported):
     if kind is None:
         stable = False
-    elif kind == "stable":
+    elif kind in ("stable", "mergesort"):
         stable = True
-    elif kind == "heapsort":
+    elif kind in ("heapsort", "quicksort"):
         stable = False
     else:
         raise ak._errors.wrap_error(
diff --git a/src/awkward/operations/ak_sort.py b/src/awkward/operations/ak_sort.py
--- a/src/awkward/operations/ak_sort.py
+++ b/src/awkward/operations/ak_sort.py
@@ -57,9 +57,9 @@
 def _nep_18_impl(a, axis=-1, kind=None, order=unsupported):
     if kind is None:
         stable = False
-    elif kind == "stable":
+    elif kind in ("stable", "mergesort"):
         stable = True
-    elif kind == "heapsort":
+    elif kind in ("heapsort", "quicksort"):
         stable = False
     else:
         raise ak._errors.wrap_error(

{"golden_diff": "diff --git a/src/awkward/operations/ak_argsort.py b/src/awkward/operations/ak_argsort.py\n--- a/src/awkward/operations/ak_argsort.py\n+++ b/src/awkward/operations/ak_argsort.py\n@@ -70,9 +70,9 @@\n def _nep_18_impl(a, axis=-1, kind=None, order=unsupported):\n     if kind is None:\n         stable = False\n-    elif kind == \"stable\":\n+    elif kind in (\"stable\", \"mergesort\"):\n         stable = True\n-    elif kind == \"heapsort\":\n+    elif kind in (\"heapsort\", \"quicksort\"):\n         stable = False\n     else:\n         raise ak._errors.wrap_error(\ndiff --git a/src/awkward/operations/ak_sort.py b/src/awkward/operations/ak_sort.py\n--- a/src/awkward/operations/ak_sort.py\n+++ b/src/awkward/operations/ak_sort.py\n@@ -57,9 +57,9 @@\n def _nep_18_impl(a, axis=-1, kind=None, order=unsupported):\n     if kind is None:\n         stable = False\n-    elif kind == \"stable\":\n+    elif kind in (\"stable\", \"mergesort\"):\n         stable = True\n-    elif kind == \"heapsort\":\n+    elif kind in (\"heapsort\", \"quicksort\"):\n         stable = False\n     else:\n         raise ak._errors.wrap_error(\n", "issue": "NEP-18 sort kind translation is incorrect\n### Version of Awkward Array\n\nmain\n\n### Description and code to reproduce\n\nWe only support \"stable\", so we should just coerce the algorithms into a `stable` flag.\n", "before_files": [{"content": "# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE\n\nimport awkward as ak\nfrom awkward._connect.numpy import unsupported\n\nnp = ak._nplikes.NumpyMetadata.instance()\n\n\ndef sort(array, axis=-1, *, ascending=True, stable=True, highlevel=True, behavior=None):\n    \"\"\"\n    Args:\n        array: Array-like data (anything #ak.to_layout recognizes).\n        axis (int): The dimension at which this operation is applied. The\n            outermost dimension is `0`, followed by `1`, etc., and negative\n            values count backward from the innermost: `-1` is the innermost\n            dimension, `-2` is the next level up, etc.\n        ascending (bool): If True, the first value in each sorted group\n            will be smallest, the last value largest; if False, the order\n            is from largest to smallest.\n        stable (bool): If True, use a stable sorting algorithm (introsort:\n            a hybrid of quicksort, heapsort, and insertion sort); if False,\n            use a sorting algorithm that is not guaranteed to be stable\n            (heapsort).\n        highlevel (bool): If True, return an #ak.Array; otherwise, return\n            a low-level #ak.contents.Content subclass.\n        behavior (None or dict): Custom #ak.behavior for the output array, if\n            high-level.\n\n    Returns a sorted array.\n\n    For example,\n\n        >>> ak.sort(ak.Array([[7, 5, 7], [], [2], [8, 2]]))\n        <Array [[5, 7, 7], [], [2], [2, 8]] type='4 * var * int64'>\n    \"\"\"\n    with ak._errors.OperationErrorContext(\n        \"ak.sort\",\n        dict(\n            array=array,\n            axis=axis,\n            ascending=ascending,\n            stable=stable,\n            highlevel=highlevel,\n            behavior=behavior,\n        ),\n    ):\n        return _impl(array, axis, ascending, stable, highlevel, behavior)\n\n\ndef _impl(array, axis, ascending, stable, highlevel, behavior):\n    layout = ak.operations.to_layout(array, allow_record=False, allow_other=False)\n    out = ak._do.sort(layout, axis, ascending, stable)\n    return ak._util.wrap(out, behavior, highlevel, like=array)\n\n\n@ak._connect.numpy.implements(\"sort\")\ndef _nep_18_impl(a, axis=-1, kind=None, order=unsupported):\n    if kind is None:\n        stable = False\n    elif kind == \"stable\":\n        stable = True\n    elif kind == \"heapsort\":\n        stable = False\n    else:\n        raise ak._errors.wrap_error(\n            ValueError(\n                f\"unsupported value for 'kind' passed to overloaded NumPy function 'sort': {kind!r}\"\n            )\n        )\n    return sort(a, axis=axis, stable=stable)\n", "path": "src/awkward/operations/ak_sort.py"}, {"content": "# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE\n\nimport awkward as ak\nfrom awkward._connect.numpy import unsupported\n\nnp = ak._nplikes.NumpyMetadata.instance()\n\n\ndef argsort(\n    array, axis=-1, *, ascending=True, stable=True, highlevel=True, behavior=None\n):\n    \"\"\"\n    Args:\n        array: Array-like data (anything #ak.to_layout recognizes).\n        axis (int): The dimension at which this operation is applied. The\n            outermost dimension is `0`, followed by `1`, etc., and negative\n            values count backward from the innermost: `-1` is the innermost\n            dimension, `-2` is the next level up, etc.\n        ascending (bool): If True, the first value in each sorted group\n            will be smallest, the last value largest; if False, the order\n            is from largest to smallest.\n        stable (bool): If True, use a stable sorting algorithm (introsort:\n            a hybrid of quicksort, heapsort, and insertion sort); if False,\n            use a sorting algorithm that is not guaranteed to be stable\n            (heapsort).\n        highlevel (bool): If True, return an #ak.Array; otherwise, return\n            a low-level #ak.contents.Content subclass.\n        behavior (None or dict): Custom #ak.behavior for the output array, if\n            high-level.\n\n    Returns an array of integer indexes that would sort the array if applied\n    as an integer-array slice.\n\n    For example,\n\n        >>> ak.argsort(ak.Array([[7.7, 5.5, 7.7], [], [2.2], [8.8, 2.2]]))\n        <Array [[1, 0, 2], [], [0], [1, 0]] type='4 * var * int64'>\n\n    The result of this function can be used to index other arrays with the\n    same shape:\n\n        >>> data = ak.Array([[7, 5, 7], [], [2], [8, 2]])\n        >>> index = ak.argsort(data)\n        >>> index\n        <Array [[1, 0, 2], [], [0], [1, 0]] type='4 * var * int64'>\n        >>> data[index]\n        <Array [[5, 7, 7], [], [2], [2, 8]] type='4 * var * int64'>\n    \"\"\"\n    with ak._errors.OperationErrorContext(\n        \"ak.argsort\",\n        dict(\n            array=array,\n            axis=axis,\n            ascending=ascending,\n            stable=stable,\n            highlevel=highlevel,\n            behavior=behavior,\n        ),\n    ):\n        return _impl(array, axis, ascending, stable, highlevel, behavior)\n\n\ndef _impl(array, axis, ascending, stable, highlevel, behavior):\n    layout = ak.operations.to_layout(array, allow_record=False, allow_other=False)\n    out = ak._do.argsort(layout, axis, ascending, stable)\n    return ak._util.wrap(out, behavior, highlevel, like=array)\n\n\n@ak._connect.numpy.implements(\"argsort\")\ndef _nep_18_impl(a, axis=-1, kind=None, order=unsupported):\n    if kind is None:\n        stable = False\n    elif kind == \"stable\":\n        stable = True\n    elif kind == \"heapsort\":\n        stable = False\n    else:\n        raise ak._errors.wrap_error(\n            ValueError(\n                f\"unsupported value for 'kind' passed to overloaded NumPy function 'argsort': {kind!r}\"\n            )\n        )\n    return argsort(a, axis=axis, stable=stable)\n", "path": "src/awkward/operations/ak_argsort.py"}], "after_files": [{"content": "# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE\n\nimport awkward as ak\nfrom awkward._connect.numpy import unsupported\n\nnp = ak._nplikes.NumpyMetadata.instance()\n\n\ndef sort(array, axis=-1, *, ascending=True, stable=True, highlevel=True, behavior=None):\n    \"\"\"\n    Args:\n        array: Array-like data (anything #ak.to_layout recognizes).\n        axis (int): The dimension at which this operation is applied. The\n            outermost dimension is `0`, followed by `1`, etc., and negative\n            values count backward from the innermost: `-1` is the innermost\n            dimension, `-2` is the next level up, etc.\n        ascending (bool): If True, the first value in each sorted group\n            will be smallest, the last value largest; if False, the order\n            is from largest to smallest.\n        stable (bool): If True, use a stable sorting algorithm (introsort:\n            a hybrid of quicksort, heapsort, and insertion sort); if False,\n            use a sorting algorithm that is not guaranteed to be stable\n            (heapsort).\n        highlevel (bool): If True, return an #ak.Array; otherwise, return\n            a low-level #ak.contents.Content subclass.\n        behavior (None or dict): Custom #ak.behavior for the output array, if\n            high-level.\n\n    Returns a sorted array.\n\n    For example,\n\n        >>> ak.sort(ak.Array([[7, 5, 7], [], [2], [8, 2]]))\n        <Array [[5, 7, 7], [], [2], [2, 8]] type='4 * var * int64'>\n    \"\"\"\n    with ak._errors.OperationErrorContext(\n        \"ak.sort\",\n        dict(\n            array=array,\n            axis=axis,\n            ascending=ascending,\n            stable=stable,\n            highlevel=highlevel,\n            behavior=behavior,\n        ),\n    ):\n        return _impl(array, axis, ascending, stable, highlevel, behavior)\n\n\ndef _impl(array, axis, ascending, stable, highlevel, behavior):\n    layout = ak.operations.to_layout(array, allow_record=False, allow_other=False)\n    out = ak._do.sort(layout, axis, ascending, stable)\n    return ak._util.wrap(out, behavior, highlevel, like=array)\n\n\n@ak._connect.numpy.implements(\"sort\")\ndef _nep_18_impl(a, axis=-1, kind=None, order=unsupported):\n    if kind is None:\n        stable = False\n    elif kind in (\"stable\", \"mergesort\"):\n        stable = True\n    elif kind in (\"heapsort\", \"quicksort\"):\n        stable = False\n    else:\n        raise ak._errors.wrap_error(\n            ValueError(\n                f\"unsupported value for 'kind' passed to overloaded NumPy function 'sort': {kind!r}\"\n            )\n        )\n    return sort(a, axis=axis, stable=stable)\n", "path": "src/awkward/operations/ak_sort.py"}, {"content": "# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE\n\nimport awkward as ak\nfrom awkward._connect.numpy import unsupported\n\nnp = ak._nplikes.NumpyMetadata.instance()\n\n\ndef argsort(\n    array, axis=-1, *, ascending=True, stable=True, highlevel=True, behavior=None\n):\n    \"\"\"\n    Args:\n        array: Array-like data (anything #ak.to_layout recognizes).\n        axis (int): The dimension at which this operation is applied. The\n            outermost dimension is `0`, followed by `1`, etc., and negative\n            values count backward from the innermost: `-1` is the innermost\n            dimension, `-2` is the next level up, etc.\n        ascending (bool): If True, the first value in each sorted group\n            will be smallest, the last value largest; if False, the order\n            is from largest to smallest.\n        stable (bool): If True, use a stable sorting algorithm (introsort:\n            a hybrid of quicksort, heapsort, and insertion sort); if False,\n            use a sorting algorithm that is not guaranteed to be stable\n            (heapsort).\n        highlevel (bool): If True, return an #ak.Array; otherwise, return\n            a low-level #ak.contents.Content subclass.\n        behavior (None or dict): Custom #ak.behavior for the output array, if\n            high-level.\n\n    Returns an array of integer indexes that would sort the array if applied\n    as an integer-array slice.\n\n    For example,\n\n        >>> ak.argsort(ak.Array([[7.7, 5.5, 7.7], [], [2.2], [8.8, 2.2]]))\n        <Array [[1, 0, 2], [], [0], [1, 0]] type='4 * var * int64'>\n\n    The result of this function can be used to index other arrays with the\n    same shape:\n\n        >>> data = ak.Array([[7, 5, 7], [], [2], [8, 2]])\n        >>> index = ak.argsort(data)\n        >>> index\n        <Array [[1, 0, 2], [], [0], [1, 0]] type='4 * var * int64'>\n        >>> data[index]\n        <Array [[5, 7, 7], [], [2], [2, 8]] type='4 * var * int64'>\n    \"\"\"\n    with ak._errors.OperationErrorContext(\n        \"ak.argsort\",\n        dict(\n            array=array,\n            axis=axis,\n            ascending=ascending,\n            stable=stable,\n            highlevel=highlevel,\n            behavior=behavior,\n        ),\n    ):\n        return _impl(array, axis, ascending, stable, highlevel, behavior)\n\n\ndef _impl(array, axis, ascending, stable, highlevel, behavior):\n    layout = ak.operations.to_layout(array, allow_record=False, allow_other=False)\n    out = ak._do.argsort(layout, axis, ascending, stable)\n    return ak._util.wrap(out, behavior, highlevel, like=array)\n\n\n@ak._connect.numpy.implements(\"argsort\")\ndef _nep_18_impl(a, axis=-1, kind=None, order=unsupported):\n    if kind is None:\n        stable = False\n    elif kind in (\"stable\", \"mergesort\"):\n        stable = True\n    elif kind in (\"heapsort\", \"quicksort\"):\n        stable = False\n    else:\n        raise ak._errors.wrap_error(\n            ValueError(\n                f\"unsupported value for 'kind' passed to overloaded NumPy function 'argsort': {kind!r}\"\n            )\n        )\n    return argsort(a, axis=axis, stable=stable)\n", "path": "src/awkward/operations/ak_argsort.py"}]}