We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Suggestion: 'undeprecate' extensions
I can't think of a single reason why it is deprecated. Python package management is really bad to rely on pip, packing small personal customization extensions is a massive overkill and can lead to potential pip conflicts in the future and publishing it is a horrendous waste of time (and might not even be possible in some cases). Extensions folder was perfect for very simple personal extensions and now using it constantly shows warnings that can't be disabled. Startup scripts aren't a good alternative because they clutter globals space and trying to do something without putting anything into globals leads to extremely ugly code in startup scripts.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `IPython/core/extensions.py`
Content:
```
1 # encoding: utf-8
2 """A class for managing IPython extensions."""
3 
4 # Copyright (c) IPython Development Team.
5 # Distributed under the terms of the Modified BSD License.
6 
7 import os
8 import os.path
9 import sys
10 from importlib import import_module, reload
11 
12 from traitlets.config.configurable import Configurable
13 from IPython.utils.path import ensure_dir_exists, compress_user
14 from IPython.utils.decorators import undoc
15 from traitlets import Instance
16 
17 
18 #-----------------------------------------------------------------------------
19 # Main class
20 #-----------------------------------------------------------------------------
21 
22 BUILTINS_EXTS = {"storemagic": False, "autoreload": False}
23 
24 
25 class ExtensionManager(Configurable):
26     """A class to manage IPython extensions.
27 
28     An IPython extension is an importable Python module that has
29     a function with the signature::
30 
31         def load_ipython_extension(ipython):
32             # Do things with ipython
33 
34     This function is called after your extension is imported and the
35     currently active :class:`InteractiveShell` instance is passed as
36     the only argument.  You can do anything you want with IPython at
37     that point, including defining new magic and aliases, adding new
38     components, etc.
39     
40     You can also optionally define an :func:`unload_ipython_extension(ipython)`
41     function, which will be called if the user unloads or reloads the extension.
42     The extension manager will only call :func:`load_ipython_extension` again
43     if the extension is reloaded.
44 
45     You can put your extension modules anywhere you want, as long as
46     they can be imported by Python's standard import mechanism.  However,
47     to make it easy to write extensions, you can also put your extensions
48     in ``os.path.join(self.ipython_dir, 'extensions')``.  This directory
49     is added to ``sys.path`` automatically.
50     """
51 
52     shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)
53 
54     def __init__(self, shell=None, **kwargs):
55         super(ExtensionManager, self).__init__(shell=shell, **kwargs)
56         self.shell.observe(
57             self._on_ipython_dir_changed, names=('ipython_dir',)
58         )
59         self.loaded = set()
60 
61     @property
62     def ipython_extension_dir(self):
63         return os.path.join(self.shell.ipython_dir, u'extensions')
64 
65     def _on_ipython_dir_changed(self, change):
66         ensure_dir_exists(self.ipython_extension_dir)
67 
68     def load_extension(self, module_str: str):
69         """Load an IPython extension by its module name.
70 
71         Returns the string "already loaded" if the extension is already loaded,
72         "no load function" if the module doesn't have a load_ipython_extension
73         function, or None if it succeeded.
74         """
75         try:
76             return self._load_extension(module_str)
77         except ModuleNotFoundError:
78             if module_str in BUILTINS_EXTS:
79                 BUILTINS_EXTS[module_str] = True
80                 return self._load_extension("IPython.extensions." + module_str)
81             raise
82 
83     def _load_extension(self, module_str: str):
84         if module_str in self.loaded:
85             return "already loaded"
86 
87         from IPython.utils.syspathcontext import prepended_to_syspath
88 
89         with self.shell.builtin_trap:
90             if module_str not in sys.modules:
91                 with prepended_to_syspath(self.ipython_extension_dir):
92                     mod = import_module(module_str)
93                     if mod.__file__.startswith(self.ipython_extension_dir):
94                         print(("Loading extensions from {dir} is deprecated. "
95                                "We recommend managing extensions like any "
96                                "other Python packages, in site-packages.").format(
97                               dir=compress_user(self.ipython_extension_dir)))
98             mod = sys.modules[module_str]
99             if self._call_load_ipython_extension(mod):
100                 self.loaded.add(module_str)
101             else:
102                 return "no load function"
103 
104     def unload_extension(self, module_str: str):
105         """Unload an IPython extension by its module name.
106 
107         This function looks up the extension's name in ``sys.modules`` and
108         simply calls ``mod.unload_ipython_extension(self)``.
109 
110         Returns the string "no unload function" if the extension doesn't define
111         a function to unload itself, "not loaded" if the extension isn't loaded,
112         otherwise None.
113         """
114         if BUILTINS_EXTS.get(module_str, False) is True:
115             module_str = "IPython.extensions." + module_str
116         if module_str not in self.loaded:
117             return "not loaded"
118 
119         if module_str in sys.modules:
120             mod = sys.modules[module_str]
121             if self._call_unload_ipython_extension(mod):
122                 self.loaded.discard(module_str)
123             else:
124                 return "no unload function"
125 
126     def reload_extension(self, module_str: str):
127         """Reload an IPython extension by calling reload.
128 
129         If the module has not been loaded before,
130         :meth:`InteractiveShell.load_extension` is called. Otherwise
131         :func:`reload` is called and then the :func:`load_ipython_extension`
132         function of the module, if it exists is called.
133         """
134         from IPython.utils.syspathcontext import prepended_to_syspath
135 
136         if BUILTINS_EXTS.get(module_str, False) is True:
137             module_str = "IPython.extensions." + module_str
138 
139         if (module_str in self.loaded) and (module_str in sys.modules):
140             self.unload_extension(module_str)
141             mod = sys.modules[module_str]
142             with prepended_to_syspath(self.ipython_extension_dir):
143                 reload(mod)
144             if self._call_load_ipython_extension(mod):
145                 self.loaded.add(module_str)
146         else:
147             self.load_extension(module_str)
148 
149     def _call_load_ipython_extension(self, mod):
150         if hasattr(mod, 'load_ipython_extension'):
151             mod.load_ipython_extension(self.shell)
152             return True
153 
154     def _call_unload_ipython_extension(self, mod):
155         if hasattr(mod, 'unload_ipython_extension'):
156             mod.unload_ipython_extension(self.shell)
157             return True
158 
159     @undoc
160     def install_extension(self, url, filename=None):
161         """
162         Deprecated.
163         """
164         # Ensure the extension directory exists
165         raise DeprecationWarning(
166             '`install_extension` and the `install_ext` magic have been deprecated since IPython 4.0'
167             'Use pip or other package managers to manage ipython extensions.')
168
```
--- 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/IPython/core/extensions.py b/IPython/core/extensions.py
--- a/IPython/core/extensions.py
+++ b/IPython/core/extensions.py
@@ -88,13 +88,7 @@
 
         with self.shell.builtin_trap:
             if module_str not in sys.modules:
-                with prepended_to_syspath(self.ipython_extension_dir):
-                    mod = import_module(module_str)
-                    if mod.__file__.startswith(self.ipython_extension_dir):
-                        print(("Loading extensions from {dir} is deprecated. "
-                               "We recommend managing extensions like any "
-                               "other Python packages, in site-packages.").format(
-                              dir=compress_user(self.ipython_extension_dir)))
+                mod = import_module(module_str)
             mod = sys.modules[module_str]
             if self._call_load_ipython_extension(mod):
                 self.loaded.add(module_str)
@@ -155,13 +149,3 @@
         if hasattr(mod, 'unload_ipython_extension'):
             mod.unload_ipython_extension(self.shell)
             return True
-
-    @undoc
-    def install_extension(self, url, filename=None):
-        """
-        Deprecated.
-        """
-        # Ensure the extension directory exists
-        raise DeprecationWarning(
-            '`install_extension` and the `install_ext` magic have been deprecated since IPython 4.0'
-            'Use pip or other package managers to manage ipython extensions.')

{"golden_diff": "diff --git a/IPython/core/extensions.py b/IPython/core/extensions.py\n--- a/IPython/core/extensions.py\n+++ b/IPython/core/extensions.py\n@@ -88,13 +88,7 @@\n \n         with self.shell.builtin_trap:\n             if module_str not in sys.modules:\n-                with prepended_to_syspath(self.ipython_extension_dir):\n-                    mod = import_module(module_str)\n-                    if mod.__file__.startswith(self.ipython_extension_dir):\n-                        print((\"Loading extensions from {dir} is deprecated. \"\n-                               \"We recommend managing extensions like any \"\n-                               \"other Python packages, in site-packages.\").format(\n-                              dir=compress_user(self.ipython_extension_dir)))\n+                mod = import_module(module_str)\n             mod = sys.modules[module_str]\n             if self._call_load_ipython_extension(mod):\n                 self.loaded.add(module_str)\n@@ -155,13 +149,3 @@\n         if hasattr(mod, 'unload_ipython_extension'):\n             mod.unload_ipython_extension(self.shell)\n             return True\n-\n-    @undoc\n-    def install_extension(self, url, filename=None):\n-        \"\"\"\n-        Deprecated.\n-        \"\"\"\n-        # Ensure the extension directory exists\n-        raise DeprecationWarning(\n-            '`install_extension` and the `install_ext` magic have been deprecated since IPython 4.0'\n-            'Use pip or other package managers to manage ipython extensions.')\n", "issue": "Suggestion: 'undeprecate' extensions\nI can't think of a single reason why it is deprecated. Python package management is really bad to rely on pip, packing small personal customization extensions is a massive overkill and can lead to potential pip conflicts in the future and publishing it is a horrendous waste of time (and might not even be possible in some cases). Extensions folder was perfect for very simple personal extensions and now using it constantly shows warnings that can't be disabled. Startup scripts aren't a good alternative because they clutter globals space and trying to do something without putting anything into globals leads to extremely ugly code in startup scripts.\n", "before_files": [{"content": "# encoding: utf-8\n\"\"\"A class for managing IPython extensions.\"\"\"\n\n# Copyright (c) IPython Development Team.\n# Distributed under the terms of the Modified BSD License.\n\nimport os\nimport os.path\nimport sys\nfrom importlib import import_module, reload\n\nfrom traitlets.config.configurable import Configurable\nfrom IPython.utils.path import ensure_dir_exists, compress_user\nfrom IPython.utils.decorators import undoc\nfrom traitlets import Instance\n\n\n#-----------------------------------------------------------------------------\n# Main class\n#-----------------------------------------------------------------------------\n\nBUILTINS_EXTS = {\"storemagic\": False, \"autoreload\": False}\n\n\nclass ExtensionManager(Configurable):\n    \"\"\"A class to manage IPython extensions.\n\n    An IPython extension is an importable Python module that has\n    a function with the signature::\n\n        def load_ipython_extension(ipython):\n            # Do things with ipython\n\n    This function is called after your extension is imported and the\n    currently active :class:`InteractiveShell` instance is passed as\n    the only argument.  You can do anything you want with IPython at\n    that point, including defining new magic and aliases, adding new\n    components, etc.\n    \n    You can also optionally define an :func:`unload_ipython_extension(ipython)`\n    function, which will be called if the user unloads or reloads the extension.\n    The extension manager will only call :func:`load_ipython_extension` again\n    if the extension is reloaded.\n\n    You can put your extension modules anywhere you want, as long as\n    they can be imported by Python's standard import mechanism.  However,\n    to make it easy to write extensions, you can also put your extensions\n    in ``os.path.join(self.ipython_dir, 'extensions')``.  This directory\n    is added to ``sys.path`` automatically.\n    \"\"\"\n\n    shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)\n\n    def __init__(self, shell=None, **kwargs):\n        super(ExtensionManager, self).__init__(shell=shell, **kwargs)\n        self.shell.observe(\n            self._on_ipython_dir_changed, names=('ipython_dir',)\n        )\n        self.loaded = set()\n\n    @property\n    def ipython_extension_dir(self):\n        return os.path.join(self.shell.ipython_dir, u'extensions')\n\n    def _on_ipython_dir_changed(self, change):\n        ensure_dir_exists(self.ipython_extension_dir)\n\n    def load_extension(self, module_str: str):\n        \"\"\"Load an IPython extension by its module name.\n\n        Returns the string \"already loaded\" if the extension is already loaded,\n        \"no load function\" if the module doesn't have a load_ipython_extension\n        function, or None if it succeeded.\n        \"\"\"\n        try:\n            return self._load_extension(module_str)\n        except ModuleNotFoundError:\n            if module_str in BUILTINS_EXTS:\n                BUILTINS_EXTS[module_str] = True\n                return self._load_extension(\"IPython.extensions.\" + module_str)\n            raise\n\n    def _load_extension(self, module_str: str):\n        if module_str in self.loaded:\n            return \"already loaded\"\n\n        from IPython.utils.syspathcontext import prepended_to_syspath\n\n        with self.shell.builtin_trap:\n            if module_str not in sys.modules:\n                with prepended_to_syspath(self.ipython_extension_dir):\n                    mod = import_module(module_str)\n                    if mod.__file__.startswith(self.ipython_extension_dir):\n                        print((\"Loading extensions from {dir} is deprecated. \"\n                               \"We recommend managing extensions like any \"\n                               \"other Python packages, in site-packages.\").format(\n                              dir=compress_user(self.ipython_extension_dir)))\n            mod = sys.modules[module_str]\n            if self._call_load_ipython_extension(mod):\n                self.loaded.add(module_str)\n            else:\n                return \"no load function\"\n\n    def unload_extension(self, module_str: str):\n        \"\"\"Unload an IPython extension by its module name.\n\n        This function looks up the extension's name in ``sys.modules`` and\n        simply calls ``mod.unload_ipython_extension(self)``.\n\n        Returns the string \"no unload function\" if the extension doesn't define\n        a function to unload itself, \"not loaded\" if the extension isn't loaded,\n        otherwise None.\n        \"\"\"\n        if BUILTINS_EXTS.get(module_str, False) is True:\n            module_str = \"IPython.extensions.\" + module_str\n        if module_str not in self.loaded:\n            return \"not loaded\"\n\n        if module_str in sys.modules:\n            mod = sys.modules[module_str]\n            if self._call_unload_ipython_extension(mod):\n                self.loaded.discard(module_str)\n            else:\n                return \"no unload function\"\n\n    def reload_extension(self, module_str: str):\n        \"\"\"Reload an IPython extension by calling reload.\n\n        If the module has not been loaded before,\n        :meth:`InteractiveShell.load_extension` is called. Otherwise\n        :func:`reload` is called and then the :func:`load_ipython_extension`\n        function of the module, if it exists is called.\n        \"\"\"\n        from IPython.utils.syspathcontext import prepended_to_syspath\n\n        if BUILTINS_EXTS.get(module_str, False) is True:\n            module_str = \"IPython.extensions.\" + module_str\n\n        if (module_str in self.loaded) and (module_str in sys.modules):\n            self.unload_extension(module_str)\n            mod = sys.modules[module_str]\n            with prepended_to_syspath(self.ipython_extension_dir):\n                reload(mod)\n            if self._call_load_ipython_extension(mod):\n                self.loaded.add(module_str)\n        else:\n            self.load_extension(module_str)\n\n    def _call_load_ipython_extension(self, mod):\n        if hasattr(mod, 'load_ipython_extension'):\n            mod.load_ipython_extension(self.shell)\n            return True\n\n    def _call_unload_ipython_extension(self, mod):\n        if hasattr(mod, 'unload_ipython_extension'):\n            mod.unload_ipython_extension(self.shell)\n            return True\n\n    @undoc\n    def install_extension(self, url, filename=None):\n        \"\"\"\n        Deprecated.\n        \"\"\"\n        # Ensure the extension directory exists\n        raise DeprecationWarning(\n            '`install_extension` and the `install_ext` magic have been deprecated since IPython 4.0'\n            'Use pip or other package managers to manage ipython extensions.')\n", "path": "IPython/core/extensions.py"}], "after_files": [{"content": "# encoding: utf-8\n\"\"\"A class for managing IPython extensions.\"\"\"\n\n# Copyright (c) IPython Development Team.\n# Distributed under the terms of the Modified BSD License.\n\nimport os\nimport os.path\nimport sys\nfrom importlib import import_module, reload\n\nfrom traitlets.config.configurable import Configurable\nfrom IPython.utils.path import ensure_dir_exists, compress_user\nfrom IPython.utils.decorators import undoc\nfrom traitlets import Instance\n\n\n#-----------------------------------------------------------------------------\n# Main class\n#-----------------------------------------------------------------------------\n\nBUILTINS_EXTS = {\"storemagic\": False, \"autoreload\": False}\n\n\nclass ExtensionManager(Configurable):\n    \"\"\"A class to manage IPython extensions.\n\n    An IPython extension is an importable Python module that has\n    a function with the signature::\n\n        def load_ipython_extension(ipython):\n            # Do things with ipython\n\n    This function is called after your extension is imported and the\n    currently active :class:`InteractiveShell` instance is passed as\n    the only argument.  You can do anything you want with IPython at\n    that point, including defining new magic and aliases, adding new\n    components, etc.\n    \n    You can also optionally define an :func:`unload_ipython_extension(ipython)`\n    function, which will be called if the user unloads or reloads the extension.\n    The extension manager will only call :func:`load_ipython_extension` again\n    if the extension is reloaded.\n\n    You can put your extension modules anywhere you want, as long as\n    they can be imported by Python's standard import mechanism.  However,\n    to make it easy to write extensions, you can also put your extensions\n    in ``os.path.join(self.ipython_dir, 'extensions')``.  This directory\n    is added to ``sys.path`` automatically.\n    \"\"\"\n\n    shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)\n\n    def __init__(self, shell=None, **kwargs):\n        super(ExtensionManager, self).__init__(shell=shell, **kwargs)\n        self.shell.observe(\n            self._on_ipython_dir_changed, names=('ipython_dir',)\n        )\n        self.loaded = set()\n\n    @property\n    def ipython_extension_dir(self):\n        return os.path.join(self.shell.ipython_dir, u'extensions')\n\n    def _on_ipython_dir_changed(self, change):\n        ensure_dir_exists(self.ipython_extension_dir)\n\n    def load_extension(self, module_str: str):\n        \"\"\"Load an IPython extension by its module name.\n\n        Returns the string \"already loaded\" if the extension is already loaded,\n        \"no load function\" if the module doesn't have a load_ipython_extension\n        function, or None if it succeeded.\n        \"\"\"\n        try:\n            return self._load_extension(module_str)\n        except ModuleNotFoundError:\n            if module_str in BUILTINS_EXTS:\n                BUILTINS_EXTS[module_str] = True\n                return self._load_extension(\"IPython.extensions.\" + module_str)\n            raise\n\n    def _load_extension(self, module_str: str):\n        if module_str in self.loaded:\n            return \"already loaded\"\n\n        from IPython.utils.syspathcontext import prepended_to_syspath\n\n        with self.shell.builtin_trap:\n            if module_str not in sys.modules:\n                mod = import_module(module_str)\n            mod = sys.modules[module_str]\n            if self._call_load_ipython_extension(mod):\n                self.loaded.add(module_str)\n            else:\n                return \"no load function\"\n\n    def unload_extension(self, module_str: str):\n        \"\"\"Unload an IPython extension by its module name.\n\n        This function looks up the extension's name in ``sys.modules`` and\n        simply calls ``mod.unload_ipython_extension(self)``.\n\n        Returns the string \"no unload function\" if the extension doesn't define\n        a function to unload itself, \"not loaded\" if the extension isn't loaded,\n        otherwise None.\n        \"\"\"\n        if BUILTINS_EXTS.get(module_str, False) is True:\n            module_str = \"IPython.extensions.\" + module_str\n        if module_str not in self.loaded:\n            return \"not loaded\"\n\n        if module_str in sys.modules:\n            mod = sys.modules[module_str]\n            if self._call_unload_ipython_extension(mod):\n                self.loaded.discard(module_str)\n            else:\n                return \"no unload function\"\n\n    def reload_extension(self, module_str: str):\n        \"\"\"Reload an IPython extension by calling reload.\n\n        If the module has not been loaded before,\n        :meth:`InteractiveShell.load_extension` is called. Otherwise\n        :func:`reload` is called and then the :func:`load_ipython_extension`\n        function of the module, if it exists is called.\n        \"\"\"\n        from IPython.utils.syspathcontext import prepended_to_syspath\n\n        if BUILTINS_EXTS.get(module_str, False) is True:\n            module_str = \"IPython.extensions.\" + module_str\n\n        if (module_str in self.loaded) and (module_str in sys.modules):\n            self.unload_extension(module_str)\n            mod = sys.modules[module_str]\n            with prepended_to_syspath(self.ipython_extension_dir):\n                reload(mod)\n            if self._call_load_ipython_extension(mod):\n                self.loaded.add(module_str)\n        else:\n            self.load_extension(module_str)\n\n    def _call_load_ipython_extension(self, mod):\n        if hasattr(mod, 'load_ipython_extension'):\n            mod.load_ipython_extension(self.shell)\n            return True\n\n    def _call_unload_ipython_extension(self, mod):\n        if hasattr(mod, 'unload_ipython_extension'):\n            mod.unload_ipython_extension(self.shell)\n            return True\n", "path": "IPython/core/extensions.py"}]}