We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
DOC: error in 0.23.0 concat sort warning?
#### Problem description

Pandas 0.23.0 adds a new warning when calling `concat` with misaligned axes (#20613):

```
FutureWarning: Sorting because non-concatenation axis is not aligned. A future version
of pandas will change to not sort by default.

To accept the future behavior, pass 'sort=True'.

To retain the current behavior and silence the warning, pass sort=False
```

This seems strange; I'd assume that `sort=True` would give the current behaviour, and `sort=False` the future behaviour, as in the docs for `concat`: 

```
Explicitly pass sort=True to silence the warning and sort. Explicitly pass
sort=False to silence the warning and not sort.
```

I'm assuming the docs are right and the warning is wrong?

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pandas/core/indexes/api.py`
Content:
```
1 import textwrap
2 import warnings
3 
4 from pandas.core.indexes.base import (Index,
5                                       _new_Index,
6                                       _ensure_index,
7                                       _ensure_index_from_sequences,
8                                       InvalidIndexError)  # noqa
9 from pandas.core.indexes.category import CategoricalIndex  # noqa
10 from pandas.core.indexes.multi import MultiIndex  # noqa
11 from pandas.core.indexes.interval import IntervalIndex  # noqa
12 from pandas.core.indexes.numeric import (NumericIndex, Float64Index,  # noqa
13                                     Int64Index, UInt64Index)
14 from pandas.core.indexes.range import RangeIndex  # noqa
15 from pandas.core.indexes.timedeltas import TimedeltaIndex
16 from pandas.core.indexes.period import PeriodIndex
17 from pandas.core.indexes.datetimes import DatetimeIndex
18 
19 import pandas.core.common as com
20 from pandas._libs import lib
21 from pandas._libs.tslib import NaT
22 
23 _sort_msg = textwrap.dedent("""\
24 Sorting because non-concatenation axis is not aligned. A future version
25 of pandas will change to not sort by default.
26 
27 To accept the future behavior, pass 'sort=True'.
28 
29 To retain the current behavior and silence the warning, pass sort=False
30 """)
31 
32 
33 # TODO: there are many places that rely on these private methods existing in
34 # pandas.core.index
35 __all__ = ['Index', 'MultiIndex', 'NumericIndex', 'Float64Index', 'Int64Index',
36            'CategoricalIndex', 'IntervalIndex', 'RangeIndex', 'UInt64Index',
37            'InvalidIndexError', 'TimedeltaIndex',
38            'PeriodIndex', 'DatetimeIndex',
39            '_new_Index', 'NaT',
40            '_ensure_index', '_ensure_index_from_sequences',
41            '_get_combined_index',
42            '_get_objs_combined_axis', '_union_indexes',
43            '_get_consensus_names',
44            '_all_indexes_same']
45 
46 
47 def _get_objs_combined_axis(objs, intersect=False, axis=0, sort=True):
48     # Extract combined index: return intersection or union (depending on the
49     # value of "intersect") of indexes on given axis, or None if all objects
50     # lack indexes (e.g. they are numpy arrays)
51     obs_idxes = [obj._get_axis(axis) for obj in objs
52                  if hasattr(obj, '_get_axis')]
53     if obs_idxes:
54         return _get_combined_index(obs_idxes, intersect=intersect, sort=sort)
55 
56 
57 def _get_combined_index(indexes, intersect=False, sort=False):
58     # TODO: handle index names!
59     indexes = com._get_distinct_objs(indexes)
60     if len(indexes) == 0:
61         index = Index([])
62     elif len(indexes) == 1:
63         index = indexes[0]
64     elif intersect:
65         index = indexes[0]
66         for other in indexes[1:]:
67             index = index.intersection(other)
68     else:
69         index = _union_indexes(indexes, sort=sort)
70         index = _ensure_index(index)
71 
72     if sort:
73         try:
74             index = index.sort_values()
75         except TypeError:
76             pass
77     return index
78 
79 
80 def _union_indexes(indexes, sort=True):
81     if len(indexes) == 0:
82         raise AssertionError('Must have at least 1 Index to union')
83     if len(indexes) == 1:
84         result = indexes[0]
85         if isinstance(result, list):
86             result = Index(sorted(result))
87         return result
88 
89     indexes, kind = _sanitize_and_check(indexes)
90 
91     def _unique_indices(inds):
92         def conv(i):
93             if isinstance(i, Index):
94                 i = i.tolist()
95             return i
96 
97         return Index(
98             lib.fast_unique_multiple_list([conv(i) for i in inds], sort=sort))
99 
100     if kind == 'special':
101         result = indexes[0]
102 
103         if hasattr(result, 'union_many'):
104             return result.union_many(indexes[1:])
105         else:
106             for other in indexes[1:]:
107                 result = result.union(other)
108             return result
109     elif kind == 'array':
110         index = indexes[0]
111         for other in indexes[1:]:
112             if not index.equals(other):
113 
114                 if sort is None:
115                     # TODO: remove once pd.concat sort default changes
116                     warnings.warn(_sort_msg, FutureWarning, stacklevel=8)
117                     sort = True
118 
119                 return _unique_indices(indexes)
120 
121         name = _get_consensus_names(indexes)[0]
122         if name != index.name:
123             index = index._shallow_copy(name=name)
124         return index
125     else:  # kind='list'
126         return _unique_indices(indexes)
127 
128 
129 def _sanitize_and_check(indexes):
130     kinds = list({type(index) for index in indexes})
131 
132     if list in kinds:
133         if len(kinds) > 1:
134             indexes = [Index(com._try_sort(x))
135                        if not isinstance(x, Index) else
136                        x for x in indexes]
137             kinds.remove(list)
138         else:
139             return indexes, 'list'
140 
141     if len(kinds) > 1 or Index not in kinds:
142         return indexes, 'special'
143     else:
144         return indexes, 'array'
145 
146 
147 def _get_consensus_names(indexes):
148 
149     # find the non-none names, need to tupleify to make
150     # the set hashable, then reverse on return
151     consensus_names = set(tuple(i.names) for i in indexes
152                           if com._any_not_none(*i.names))
153     if len(consensus_names) == 1:
154         return list(list(consensus_names)[0])
155     return [None] * indexes[0].nlevels
156 
157 
158 def _all_indexes_same(indexes):
159     first = indexes[0]
160     for index in indexes[1:]:
161         if not first.equals(index):
162             return False
163     return True
164
```
--- 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/pandas/core/indexes/api.py b/pandas/core/indexes/api.py
--- a/pandas/core/indexes/api.py
+++ b/pandas/core/indexes/api.py
@@ -24,9 +24,9 @@
 Sorting because non-concatenation axis is not aligned. A future version
 of pandas will change to not sort by default.
 
-To accept the future behavior, pass 'sort=True'.
+To accept the future behavior, pass 'sort=False'.
 
-To retain the current behavior and silence the warning, pass sort=False
+To retain the current behavior and silence the warning, pass 'sort=True'.
 """)

{"golden_diff": "diff --git a/pandas/core/indexes/api.py b/pandas/core/indexes/api.py\n--- a/pandas/core/indexes/api.py\n+++ b/pandas/core/indexes/api.py\n@@ -24,9 +24,9 @@\n Sorting because non-concatenation axis is not aligned. A future version\n of pandas will change to not sort by default.\n \n-To accept the future behavior, pass 'sort=True'.\n+To accept the future behavior, pass 'sort=False'.\n \n-To retain the current behavior and silence the warning, pass sort=False\n+To retain the current behavior and silence the warning, pass 'sort=True'.\n \"\"\")\n", "issue": "DOC: error in 0.23.0 concat sort warning?\n#### Problem description\r\n\r\nPandas 0.23.0 adds a new warning when calling `concat` with misaligned axes (#20613):\r\n\r\n```\r\nFutureWarning: Sorting because non-concatenation axis is not aligned. A future version\r\nof pandas will change to not sort by default.\r\n\r\nTo accept the future behavior, pass 'sort=True'.\r\n\r\nTo retain the current behavior and silence the warning, pass sort=False\r\n```\r\n\r\nThis seems strange; I'd assume that `sort=True` would give the current behaviour, and `sort=False` the future behaviour, as in the docs for `concat`: \r\n\r\n```\r\nExplicitly pass sort=True to silence the warning and sort. Explicitly pass\r\nsort=False to silence the warning and not sort.\r\n```\r\n\r\nI'm assuming the docs are right and the warning is wrong?\n", "before_files": [{"content": "import textwrap\nimport warnings\n\nfrom pandas.core.indexes.base import (Index,\n                                      _new_Index,\n                                      _ensure_index,\n                                      _ensure_index_from_sequences,\n                                      InvalidIndexError)  # noqa\nfrom pandas.core.indexes.category import CategoricalIndex  # noqa\nfrom pandas.core.indexes.multi import MultiIndex  # noqa\nfrom pandas.core.indexes.interval import IntervalIndex  # noqa\nfrom pandas.core.indexes.numeric import (NumericIndex, Float64Index,  # noqa\n                                    Int64Index, UInt64Index)\nfrom pandas.core.indexes.range import RangeIndex  # noqa\nfrom pandas.core.indexes.timedeltas import TimedeltaIndex\nfrom pandas.core.indexes.period import PeriodIndex\nfrom pandas.core.indexes.datetimes import DatetimeIndex\n\nimport pandas.core.common as com\nfrom pandas._libs import lib\nfrom pandas._libs.tslib import NaT\n\n_sort_msg = textwrap.dedent(\"\"\"\\\nSorting because non-concatenation axis is not aligned. A future version\nof pandas will change to not sort by default.\n\nTo accept the future behavior, pass 'sort=True'.\n\nTo retain the current behavior and silence the warning, pass sort=False\n\"\"\")\n\n\n# TODO: there are many places that rely on these private methods existing in\n# pandas.core.index\n__all__ = ['Index', 'MultiIndex', 'NumericIndex', 'Float64Index', 'Int64Index',\n           'CategoricalIndex', 'IntervalIndex', 'RangeIndex', 'UInt64Index',\n           'InvalidIndexError', 'TimedeltaIndex',\n           'PeriodIndex', 'DatetimeIndex',\n           '_new_Index', 'NaT',\n           '_ensure_index', '_ensure_index_from_sequences',\n           '_get_combined_index',\n           '_get_objs_combined_axis', '_union_indexes',\n           '_get_consensus_names',\n           '_all_indexes_same']\n\n\ndef _get_objs_combined_axis(objs, intersect=False, axis=0, sort=True):\n    # Extract combined index: return intersection or union (depending on the\n    # value of \"intersect\") of indexes on given axis, or None if all objects\n    # lack indexes (e.g. they are numpy arrays)\n    obs_idxes = [obj._get_axis(axis) for obj in objs\n                 if hasattr(obj, '_get_axis')]\n    if obs_idxes:\n        return _get_combined_index(obs_idxes, intersect=intersect, sort=sort)\n\n\ndef _get_combined_index(indexes, intersect=False, sort=False):\n    # TODO: handle index names!\n    indexes = com._get_distinct_objs(indexes)\n    if len(indexes) == 0:\n        index = Index([])\n    elif len(indexes) == 1:\n        index = indexes[0]\n    elif intersect:\n        index = indexes[0]\n        for other in indexes[1:]:\n            index = index.intersection(other)\n    else:\n        index = _union_indexes(indexes, sort=sort)\n        index = _ensure_index(index)\n\n    if sort:\n        try:\n            index = index.sort_values()\n        except TypeError:\n            pass\n    return index\n\n\ndef _union_indexes(indexes, sort=True):\n    if len(indexes) == 0:\n        raise AssertionError('Must have at least 1 Index to union')\n    if len(indexes) == 1:\n        result = indexes[0]\n        if isinstance(result, list):\n            result = Index(sorted(result))\n        return result\n\n    indexes, kind = _sanitize_and_check(indexes)\n\n    def _unique_indices(inds):\n        def conv(i):\n            if isinstance(i, Index):\n                i = i.tolist()\n            return i\n\n        return Index(\n            lib.fast_unique_multiple_list([conv(i) for i in inds], sort=sort))\n\n    if kind == 'special':\n        result = indexes[0]\n\n        if hasattr(result, 'union_many'):\n            return result.union_many(indexes[1:])\n        else:\n            for other in indexes[1:]:\n                result = result.union(other)\n            return result\n    elif kind == 'array':\n        index = indexes[0]\n        for other in indexes[1:]:\n            if not index.equals(other):\n\n                if sort is None:\n                    # TODO: remove once pd.concat sort default changes\n                    warnings.warn(_sort_msg, FutureWarning, stacklevel=8)\n                    sort = True\n\n                return _unique_indices(indexes)\n\n        name = _get_consensus_names(indexes)[0]\n        if name != index.name:\n            index = index._shallow_copy(name=name)\n        return index\n    else:  # kind='list'\n        return _unique_indices(indexes)\n\n\ndef _sanitize_and_check(indexes):\n    kinds = list({type(index) for index in indexes})\n\n    if list in kinds:\n        if len(kinds) > 1:\n            indexes = [Index(com._try_sort(x))\n                       if not isinstance(x, Index) else\n                       x for x in indexes]\n            kinds.remove(list)\n        else:\n            return indexes, 'list'\n\n    if len(kinds) > 1 or Index not in kinds:\n        return indexes, 'special'\n    else:\n        return indexes, 'array'\n\n\ndef _get_consensus_names(indexes):\n\n    # find the non-none names, need to tupleify to make\n    # the set hashable, then reverse on return\n    consensus_names = set(tuple(i.names) for i in indexes\n                          if com._any_not_none(*i.names))\n    if len(consensus_names) == 1:\n        return list(list(consensus_names)[0])\n    return [None] * indexes[0].nlevels\n\n\ndef _all_indexes_same(indexes):\n    first = indexes[0]\n    for index in indexes[1:]:\n        if not first.equals(index):\n            return False\n    return True\n", "path": "pandas/core/indexes/api.py"}], "after_files": [{"content": "import textwrap\nimport warnings\n\nfrom pandas.core.indexes.base import (Index,\n                                      _new_Index,\n                                      _ensure_index,\n                                      _ensure_index_from_sequences,\n                                      InvalidIndexError)  # noqa\nfrom pandas.core.indexes.category import CategoricalIndex  # noqa\nfrom pandas.core.indexes.multi import MultiIndex  # noqa\nfrom pandas.core.indexes.interval import IntervalIndex  # noqa\nfrom pandas.core.indexes.numeric import (NumericIndex, Float64Index,  # noqa\n                                    Int64Index, UInt64Index)\nfrom pandas.core.indexes.range import RangeIndex  # noqa\nfrom pandas.core.indexes.timedeltas import TimedeltaIndex\nfrom pandas.core.indexes.period import PeriodIndex\nfrom pandas.core.indexes.datetimes import DatetimeIndex\n\nimport pandas.core.common as com\nfrom pandas._libs import lib\nfrom pandas._libs.tslib import NaT\n\n_sort_msg = textwrap.dedent(\"\"\"\\\nSorting because non-concatenation axis is not aligned. A future version\nof pandas will change to not sort by default.\n\nTo accept the future behavior, pass 'sort=False'.\n\nTo retain the current behavior and silence the warning, pass 'sort=True'.\n\"\"\")\n\n\n# TODO: there are many places that rely on these private methods existing in\n# pandas.core.index\n__all__ = ['Index', 'MultiIndex', 'NumericIndex', 'Float64Index', 'Int64Index',\n           'CategoricalIndex', 'IntervalIndex', 'RangeIndex', 'UInt64Index',\n           'InvalidIndexError', 'TimedeltaIndex',\n           'PeriodIndex', 'DatetimeIndex',\n           '_new_Index', 'NaT',\n           '_ensure_index', '_ensure_index_from_sequences',\n           '_get_combined_index',\n           '_get_objs_combined_axis', '_union_indexes',\n           '_get_consensus_names',\n           '_all_indexes_same']\n\n\ndef _get_objs_combined_axis(objs, intersect=False, axis=0, sort=True):\n    # Extract combined index: return intersection or union (depending on the\n    # value of \"intersect\") of indexes on given axis, or None if all objects\n    # lack indexes (e.g. they are numpy arrays)\n    obs_idxes = [obj._get_axis(axis) for obj in objs\n                 if hasattr(obj, '_get_axis')]\n    if obs_idxes:\n        return _get_combined_index(obs_idxes, intersect=intersect, sort=sort)\n\n\ndef _get_combined_index(indexes, intersect=False, sort=False):\n    # TODO: handle index names!\n    indexes = com._get_distinct_objs(indexes)\n    if len(indexes) == 0:\n        index = Index([])\n    elif len(indexes) == 1:\n        index = indexes[0]\n    elif intersect:\n        index = indexes[0]\n        for other in indexes[1:]:\n            index = index.intersection(other)\n    else:\n        index = _union_indexes(indexes, sort=sort)\n        index = _ensure_index(index)\n\n    if sort:\n        try:\n            index = index.sort_values()\n        except TypeError:\n            pass\n    return index\n\n\ndef _union_indexes(indexes, sort=True):\n    if len(indexes) == 0:\n        raise AssertionError('Must have at least 1 Index to union')\n    if len(indexes) == 1:\n        result = indexes[0]\n        if isinstance(result, list):\n            result = Index(sorted(result))\n        return result\n\n    indexes, kind = _sanitize_and_check(indexes)\n\n    def _unique_indices(inds):\n        def conv(i):\n            if isinstance(i, Index):\n                i = i.tolist()\n            return i\n\n        return Index(\n            lib.fast_unique_multiple_list([conv(i) for i in inds], sort=sort))\n\n    if kind == 'special':\n        result = indexes[0]\n\n        if hasattr(result, 'union_many'):\n            return result.union_many(indexes[1:])\n        else:\n            for other in indexes[1:]:\n                result = result.union(other)\n            return result\n    elif kind == 'array':\n        index = indexes[0]\n        for other in indexes[1:]:\n            if not index.equals(other):\n\n                if sort is None:\n                    # TODO: remove once pd.concat sort default changes\n                    warnings.warn(_sort_msg, FutureWarning, stacklevel=8)\n                    sort = True\n\n                return _unique_indices(indexes)\n\n        name = _get_consensus_names(indexes)[0]\n        if name != index.name:\n            index = index._shallow_copy(name=name)\n        return index\n    else:  # kind='list'\n        return _unique_indices(indexes)\n\n\ndef _sanitize_and_check(indexes):\n    kinds = list({type(index) for index in indexes})\n\n    if list in kinds:\n        if len(kinds) > 1:\n            indexes = [Index(com._try_sort(x))\n                       if not isinstance(x, Index) else\n                       x for x in indexes]\n            kinds.remove(list)\n        else:\n            return indexes, 'list'\n\n    if len(kinds) > 1 or Index not in kinds:\n        return indexes, 'special'\n    else:\n        return indexes, 'array'\n\n\ndef _get_consensus_names(indexes):\n\n    # find the non-none names, need to tupleify to make\n    # the set hashable, then reverse on return\n    consensus_names = set(tuple(i.names) for i in indexes\n                          if com._any_not_none(*i.names))\n    if len(consensus_names) == 1:\n        return list(list(consensus_names)[0])\n    return [None] * indexes[0].nlevels\n\n\ndef _all_indexes_same(indexes):\n    first = indexes[0]\n    for index in indexes[1:]:\n        if not first.equals(index):\n            return False\n    return True\n", "path": "pandas/core/indexes/api.py"}]}