We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add list of constants to docs
Currently if one wants to know what constants `sunpy.sun` has built in you have to run `sunpy.sun.constants.print_all()`, but it would be nice to have a table that lists the constants here: https://docs.sunpy.org/en/latest/code_ref/sun.html#module-sunpy.sun.constants (like AstroPy: http://docs.astropy.org/en/stable/constants/index.html#reference-api)

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `sunpy/sun/constants.py`
Content:
```
1 """
2 This module provides fundamental solar physical constants.
3 """
4 from astropy.table import Table
5 
6 from sunpy.sun import _constants as _con
7 
8 __all__ = [
9     'get', 'find', 'print_all', 'spectral_classification', 'au', 'mass', 'equatorial_radius',
10     'volume', 'surface_area', 'average_density', 'equatorial_surface_gravity',
11     'effective_temperature', 'luminosity', 'mass_conversion_rate', 'escape_velocity', 'sfu',
12     'average_angular_size'
13 ]
14 
15 constants = _con.physical_constants
16 
17 
18 def get(key):
19     """
20     Retrieve a constant by key. This is just a short cut into a dictionary.
21 
22     Parameters
23     ----------
24     key : `str`
25         Key in dictionary in ``constants``.
26 
27     Returns
28     -------
29     constant : `~astropy.units.Constant`
30 
31     See Also
32     --------
33     `sunpy.sun.constants`
34         Contains the description of ``constants``, which, as a dictionary literal object, does not itself possess a docstring.
35 
36     Examples
37     --------
38     >>> from sunpy.sun import constants
39     >>> constants.get('mass')
40     <<class 'astropy.constants.iau2015.IAU2015'> name='Solar mass' value=1.9884754153381438e+30 uncertainty=9.236140093538353e+25 unit='kg' reference='IAU 2015 Resolution B 3 + CODATA 2014'>
41     """
42     return constants[key]
43 
44 
45 def find(sub=None):
46     """
47     Return list of constants keys containing a given string.
48 
49     Parameters
50     ----------
51     sub : `str`, optional
52         Sub-string to search keys for. By default set to `None` and returns all keys.
53 
54     Returns
55     -------
56     `None`, `list`
57         The matching keys.
58 
59     See Also
60     --------
61     `sunpy.sun.constants`
62         Contains the description of ``constants``, which, as a dictionary literal object, does not itself possess a docstring.
63     """
64     if sub is None:
65         result = list(constants.keys())
66     else:
67         result = [key for key in constants if sub.lower() in key.lower()]
68 
69     result.sort()
70     return result
71 
72 
73 def print_all():
74     """
75     Provides a table of the complete list of constants.
76 
77     Returns
78     -------
79     `astropy.table.Table`
80     """
81     data_rows = []
82     for key, this_constant in constants.items():
83         data_rows.append([
84             key, this_constant.name, this_constant.value, this_constant.uncertainty,
85             str(this_constant.unit), this_constant.reference
86         ])
87 
88     t = Table(rows=data_rows, names=('key', 'name', 'value', 'uncertainty', 'unit', 'Reference'))
89     return t
90 
91 
92 # Spectral class is not included in physical constants since it is not a number
93 spectral_classification = 'G2V'
94 au = astronomical_unit = get('mean distance')
95 # The following variables from _gets are brought out by making them
96 # accessible through a call such as sun.volume
97 mass = get('mass')
98 equatorial_radius = radius = get('radius')
99 volume = get('volume')
100 surface_area = get('surface area')
101 average_density = density = get('average density')
102 equatorial_surface_gravity = surface_gravity = get('surface gravity')
103 effective_temperature = get('effective temperature')
104 luminosity = get('luminosity')
105 mass_conversion_rate = get('mass conversion rate')
106 escape_velocity = get('escape velocity')
107 sfu = get('solar flux unit')
108 # Observable parameters
109 average_angular_size = get('average angular size')
110
```
--- 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/sunpy/sun/constants.py b/sunpy/sun/constants.py
--- a/sunpy/sun/constants.py
+++ b/sunpy/sun/constants.py
@@ -89,6 +89,20 @@
     return t
 
 
+# Add a list of constants to the docs
+_lines = [
+    'The following constants are available:\n',
+    '====================== ============== ================ =================================',
+    '         Name              Value            Unit                 Description',
+    '====================== ============== ================ =================================',
+]
+for key, const in constants.items():
+    _lines.append('{0:^22} {1:^14.9g} {2:^16} {3}'.format(
+        key, const.value, const._unit_string, const.name))
+_lines.append(_lines[1])
+if __doc__ is not None:
+    __doc__ += '\n'.join(_lines)
+
 # Spectral class is not included in physical constants since it is not a number
 spectral_classification = 'G2V'
 au = astronomical_unit = get('mean distance')

{"golden_diff": "diff --git a/sunpy/sun/constants.py b/sunpy/sun/constants.py\n--- a/sunpy/sun/constants.py\n+++ b/sunpy/sun/constants.py\n@@ -89,6 +89,20 @@\n     return t\n \n \n+# Add a list of constants to the docs\n+_lines = [\n+    'The following constants are available:\\n',\n+    '====================== ============== ================ =================================',\n+    '         Name              Value            Unit                 Description',\n+    '====================== ============== ================ =================================',\n+]\n+for key, const in constants.items():\n+    _lines.append('{0:^22} {1:^14.9g} {2:^16} {3}'.format(\n+        key, const.value, const._unit_string, const.name))\n+_lines.append(_lines[1])\n+if __doc__ is not None:\n+    __doc__ += '\\n'.join(_lines)\n+\n # Spectral class is not included in physical constants since it is not a number\n spectral_classification = 'G2V'\n au = astronomical_unit = get('mean distance')\n", "issue": "Add list of constants to docs\nCurrently if one wants to know what constants `sunpy.sun` has built in you have to run `sunpy.sun.constants.print_all()`, but it would be nice to have a table that lists the constants here: https://docs.sunpy.org/en/latest/code_ref/sun.html#module-sunpy.sun.constants (like AstroPy: http://docs.astropy.org/en/stable/constants/index.html#reference-api)\n", "before_files": [{"content": "\"\"\"\nThis module provides fundamental solar physical constants.\n\"\"\"\nfrom astropy.table import Table\n\nfrom sunpy.sun import _constants as _con\n\n__all__ = [\n    'get', 'find', 'print_all', 'spectral_classification', 'au', 'mass', 'equatorial_radius',\n    'volume', 'surface_area', 'average_density', 'equatorial_surface_gravity',\n    'effective_temperature', 'luminosity', 'mass_conversion_rate', 'escape_velocity', 'sfu',\n    'average_angular_size'\n]\n\nconstants = _con.physical_constants\n\n\ndef get(key):\n    \"\"\"\n    Retrieve a constant by key. This is just a short cut into a dictionary.\n\n    Parameters\n    ----------\n    key : `str`\n        Key in dictionary in ``constants``.\n\n    Returns\n    -------\n    constant : `~astropy.units.Constant`\n\n    See Also\n    --------\n    `sunpy.sun.constants`\n        Contains the description of ``constants``, which, as a dictionary literal object, does not itself possess a docstring.\n\n    Examples\n    --------\n    >>> from sunpy.sun import constants\n    >>> constants.get('mass')\n    <<class 'astropy.constants.iau2015.IAU2015'> name='Solar mass' value=1.9884754153381438e+30 uncertainty=9.236140093538353e+25 unit='kg' reference='IAU 2015 Resolution B 3 + CODATA 2014'>\n    \"\"\"\n    return constants[key]\n\n\ndef find(sub=None):\n    \"\"\"\n    Return list of constants keys containing a given string.\n\n    Parameters\n    ----------\n    sub : `str`, optional\n        Sub-string to search keys for. By default set to `None` and returns all keys.\n\n    Returns\n    -------\n    `None`, `list`\n        The matching keys.\n\n    See Also\n    --------\n    `sunpy.sun.constants`\n        Contains the description of ``constants``, which, as a dictionary literal object, does not itself possess a docstring.\n    \"\"\"\n    if sub is None:\n        result = list(constants.keys())\n    else:\n        result = [key for key in constants if sub.lower() in key.lower()]\n\n    result.sort()\n    return result\n\n\ndef print_all():\n    \"\"\"\n    Provides a table of the complete list of constants.\n\n    Returns\n    -------\n    `astropy.table.Table`\n    \"\"\"\n    data_rows = []\n    for key, this_constant in constants.items():\n        data_rows.append([\n            key, this_constant.name, this_constant.value, this_constant.uncertainty,\n            str(this_constant.unit), this_constant.reference\n        ])\n\n    t = Table(rows=data_rows, names=('key', 'name', 'value', 'uncertainty', 'unit', 'Reference'))\n    return t\n\n\n# Spectral class is not included in physical constants since it is not a number\nspectral_classification = 'G2V'\nau = astronomical_unit = get('mean distance')\n# The following variables from _gets are brought out by making them\n# accessible through a call such as sun.volume\nmass = get('mass')\nequatorial_radius = radius = get('radius')\nvolume = get('volume')\nsurface_area = get('surface area')\naverage_density = density = get('average density')\nequatorial_surface_gravity = surface_gravity = get('surface gravity')\neffective_temperature = get('effective temperature')\nluminosity = get('luminosity')\nmass_conversion_rate = get('mass conversion rate')\nescape_velocity = get('escape velocity')\nsfu = get('solar flux unit')\n# Observable parameters\naverage_angular_size = get('average angular size')\n", "path": "sunpy/sun/constants.py"}], "after_files": [{"content": "\"\"\"\nThis module provides fundamental solar physical constants.\n\"\"\"\nfrom astropy.table import Table\n\nfrom sunpy.sun import _constants as _con\n\n__all__ = [\n    'get', 'find', 'print_all', 'spectral_classification', 'au', 'mass', 'equatorial_radius',\n    'volume', 'surface_area', 'average_density', 'equatorial_surface_gravity',\n    'effective_temperature', 'luminosity', 'mass_conversion_rate', 'escape_velocity', 'sfu',\n    'average_angular_size'\n]\n\nconstants = _con.physical_constants\n\n\ndef get(key):\n    \"\"\"\n    Retrieve a constant by key. This is just a short cut into a dictionary.\n\n    Parameters\n    ----------\n    key : `str`\n        Key in dictionary in ``constants``.\n\n    Returns\n    -------\n    constant : `~astropy.units.Constant`\n\n    See Also\n    --------\n    `sunpy.sun.constants`\n        Contains the description of ``constants``, which, as a dictionary literal object, does not itself possess a docstring.\n\n    Examples\n    --------\n    >>> from sunpy.sun import constants\n    >>> constants.get('mass')\n    <<class 'astropy.constants.iau2015.IAU2015'> name='Solar mass' value=1.9884754153381438e+30 uncertainty=9.236140093538353e+25 unit='kg' reference='IAU 2015 Resolution B 3 + CODATA 2014'>\n    \"\"\"\n    return constants[key]\n\n\ndef find(sub=None):\n    \"\"\"\n    Return list of constants keys containing a given string.\n\n    Parameters\n    ----------\n    sub : `str`, optional\n        Sub-string to search keys for. By default set to `None` and returns all keys.\n\n    Returns\n    -------\n    `None`, `list`\n        The matching keys.\n\n    See Also\n    --------\n    `sunpy.sun.constants`\n        Contains the description of ``constants``, which, as a dictionary literal object, does not itself possess a docstring.\n    \"\"\"\n    if sub is None:\n        result = list(constants.keys())\n    else:\n        result = [key for key in constants if sub.lower() in key.lower()]\n\n    result.sort()\n    return result\n\n\ndef print_all():\n    \"\"\"\n    Provides a table of the complete list of constants.\n\n    Returns\n    -------\n    `astropy.table.Table`\n    \"\"\"\n    data_rows = []\n    for key, this_constant in constants.items():\n        data_rows.append([\n            key, this_constant.name, this_constant.value, this_constant.uncertainty,\n            str(this_constant.unit), this_constant.reference\n        ])\n\n    t = Table(rows=data_rows, names=('key', 'name', 'value', 'uncertainty', 'unit', 'Reference'))\n    return t\n\n\n# Add a list of constants to the docs\n_lines = [\n    'The following constants are available:\\n',\n    '====================== ============== ================ =================================',\n    '         Name              Value            Unit                 Description',\n    '====================== ============== ================ =================================',\n]\nfor key, const in constants.items():\n    _lines.append('{0:^22} {1:^14.9g} {2:^16} {3}'.format(\n        key, const.value, const._unit_string, const.name))\n_lines.append(_lines[1])\nif __doc__ is not None:\n    __doc__ += '\\n'.join(_lines)\n\n# Spectral class is not included in physical constants since it is not a number\nspectral_classification = 'G2V'\nau = astronomical_unit = get('mean distance')\n# The following variables from _gets are brought out by making them\n# accessible through a call such as sun.volume\nmass = get('mass')\nequatorial_radius = radius = get('radius')\nvolume = get('volume')\nsurface_area = get('surface area')\naverage_density = density = get('average density')\nequatorial_surface_gravity = surface_gravity = get('surface gravity')\neffective_temperature = get('effective temperature')\nluminosity = get('luminosity')\nmass_conversion_rate = get('mass conversion rate')\nescape_velocity = get('escape velocity')\nsfu = get('solar flux unit')\n# Observable parameters\naverage_angular_size = get('average angular size')\n", "path": "sunpy/sun/constants.py"}]}