We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Upgrade ruff target version to Python 3.8
### Initial Checks

- [X] I confirm that I'm using Pydantic V2

### Description

I deemed this as an action left out from [Dropping Python 3.7 Support](https://github.com/pydantic/pydantic/issues/7187)

1. Update ruff's `target-version` to `py38`
2. Run `make format` and adopt minimal changes to conform

### Example Code

```Python
(pydantic-3.12) PS D:\dev\Elkiwa\pydantic> make format
PDM, version 2.10.4
pdm run ruff --fix pydantic tests docs/plugins
pdm run ruff format pydantic tests docs/plugins
164 files left unchanged
```


### Python, Pydantic & OS Version

```Text
             pydantic version: 2.6.0a1
        pydantic-core version: 2.14.5
          pydantic-core build: profile=release pgo=true
                 install path: D:\dev\Elkiwa\pydantic\pydantic
               python version: 3.12.1 (tags/v3.12.1:2305ca5, Dec  7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)]
                     platform: Windows-11-10.0.22631-SP0
             related packages: email-validator-2.1.0.post1 mypy-1.1.1 pydantic-extra-types-2.1.0 pydantic-settings-2.1.0 typing_extensions-4.8.0
                       commit: a3c3037f
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pydantic/plugin/_loader.py`
Content:
```
1 from __future__ import annotations
2 
3 import sys
4 import warnings
5 from typing import TYPE_CHECKING, Iterable
6 
7 from typing_extensions import Final
8 
9 if sys.version_info >= (3, 8):
10     import importlib.metadata as importlib_metadata
11 else:
12     import importlib_metadata
13 
14 
15 if TYPE_CHECKING:
16     from . import PydanticPluginProtocol
17 
18 
19 PYDANTIC_ENTRY_POINT_GROUP: Final[str] = 'pydantic'
20 
21 # cache of plugins
22 _plugins: dict[str, PydanticPluginProtocol] | None = None
23 # return no plugins while loading plugins to avoid recursion and errors while import plugins
24 # this means that if plugins use pydantic
25 _loading_plugins: bool = False
26 
27 
28 def get_plugins() -> Iterable[PydanticPluginProtocol]:
29     """Load plugins for Pydantic.
30 
31     Inspired by: https://github.com/pytest-dev/pluggy/blob/1.3.0/src/pluggy/_manager.py#L376-L402
32     """
33     global _plugins, _loading_plugins
34     if _loading_plugins:
35         # this happens when plugins themselves use pydantic, we return no plugins
36         return ()
37     elif _plugins is None:
38         _plugins = {}
39         # set _loading_plugins so any plugins that use pydantic don't themselves use plugins
40         _loading_plugins = True
41         try:
42             for dist in importlib_metadata.distributions():
43                 for entry_point in dist.entry_points:
44                     if entry_point.group != PYDANTIC_ENTRY_POINT_GROUP:
45                         continue
46                     if entry_point.value in _plugins:
47                         continue
48                     try:
49                         _plugins[entry_point.value] = entry_point.load()
50                     except (ImportError, AttributeError) as e:
51                         warnings.warn(
52                             f'{e.__class__.__name__} while loading the `{entry_point.name}` Pydantic plugin, '
53                             f'this plugin will not be installed.\n\n{e!r}'
54                         )
55         finally:
56             _loading_plugins = False
57 
58     return _plugins.values()
59
```
--- 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/pydantic/plugin/_loader.py b/pydantic/plugin/_loader.py
--- a/pydantic/plugin/_loader.py
+++ b/pydantic/plugin/_loader.py
@@ -1,16 +1,8 @@
 from __future__ import annotations
 
-import sys
+import importlib.metadata as importlib_metadata
 import warnings
-from typing import TYPE_CHECKING, Iterable
-
-from typing_extensions import Final
-
-if sys.version_info >= (3, 8):
-    import importlib.metadata as importlib_metadata
-else:
-    import importlib_metadata
-
+from typing import TYPE_CHECKING, Final, Iterable
 
 if TYPE_CHECKING:
     from . import PydanticPluginProtocol

{"golden_diff": "diff --git a/pydantic/plugin/_loader.py b/pydantic/plugin/_loader.py\n--- a/pydantic/plugin/_loader.py\n+++ b/pydantic/plugin/_loader.py\n@@ -1,16 +1,8 @@\n from __future__ import annotations\n \n-import sys\n+import importlib.metadata as importlib_metadata\n import warnings\n-from typing import TYPE_CHECKING, Iterable\n-\n-from typing_extensions import Final\n-\n-if sys.version_info >= (3, 8):\n-    import importlib.metadata as importlib_metadata\n-else:\n-    import importlib_metadata\n-\n+from typing import TYPE_CHECKING, Final, Iterable\n \n if TYPE_CHECKING:\n     from . import PydanticPluginProtocol\n", "issue": "Upgrade ruff target version to Python 3.8\n### Initial Checks\r\n\r\n- [X] I confirm that I'm using Pydantic V2\r\n\r\n### Description\r\n\r\nI deemed this as an action left out from [Dropping Python 3.7 Support](https://github.com/pydantic/pydantic/issues/7187)\r\n\r\n1. Update ruff's `target-version` to `py38`\r\n2. Run `make format` and adopt minimal changes to conform\r\n\r\n### Example Code\r\n\r\n```Python\r\n(pydantic-3.12) PS D:\\dev\\Elkiwa\\pydantic> make format\r\nPDM, version 2.10.4\r\npdm run ruff --fix pydantic tests docs/plugins\r\npdm run ruff format pydantic tests docs/plugins\r\n164 files left unchanged\r\n```\r\n\r\n\r\n### Python, Pydantic & OS Version\r\n\r\n```Text\r\n             pydantic version: 2.6.0a1\r\n        pydantic-core version: 2.14.5\r\n          pydantic-core build: profile=release pgo=true\r\n                 install path: D:\\dev\\Elkiwa\\pydantic\\pydantic\r\n               python version: 3.12.1 (tags/v3.12.1:2305ca5, Dec  7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)]\r\n                     platform: Windows-11-10.0.22631-SP0\r\n             related packages: email-validator-2.1.0.post1 mypy-1.1.1 pydantic-extra-types-2.1.0 pydantic-settings-2.1.0 typing_extensions-4.8.0\r\n                       commit: a3c3037f\r\n```\r\n\n", "before_files": [{"content": "from __future__ import annotations\n\nimport sys\nimport warnings\nfrom typing import TYPE_CHECKING, Iterable\n\nfrom typing_extensions import Final\n\nif sys.version_info >= (3, 8):\n    import importlib.metadata as importlib_metadata\nelse:\n    import importlib_metadata\n\n\nif TYPE_CHECKING:\n    from . import PydanticPluginProtocol\n\n\nPYDANTIC_ENTRY_POINT_GROUP: Final[str] = 'pydantic'\n\n# cache of plugins\n_plugins: dict[str, PydanticPluginProtocol] | None = None\n# return no plugins while loading plugins to avoid recursion and errors while import plugins\n# this means that if plugins use pydantic\n_loading_plugins: bool = False\n\n\ndef get_plugins() -> Iterable[PydanticPluginProtocol]:\n    \"\"\"Load plugins for Pydantic.\n\n    Inspired by: https://github.com/pytest-dev/pluggy/blob/1.3.0/src/pluggy/_manager.py#L376-L402\n    \"\"\"\n    global _plugins, _loading_plugins\n    if _loading_plugins:\n        # this happens when plugins themselves use pydantic, we return no plugins\n        return ()\n    elif _plugins is None:\n        _plugins = {}\n        # set _loading_plugins so any plugins that use pydantic don't themselves use plugins\n        _loading_plugins = True\n        try:\n            for dist in importlib_metadata.distributions():\n                for entry_point in dist.entry_points:\n                    if entry_point.group != PYDANTIC_ENTRY_POINT_GROUP:\n                        continue\n                    if entry_point.value in _plugins:\n                        continue\n                    try:\n                        _plugins[entry_point.value] = entry_point.load()\n                    except (ImportError, AttributeError) as e:\n                        warnings.warn(\n                            f'{e.__class__.__name__} while loading the `{entry_point.name}` Pydantic plugin, '\n                            f'this plugin will not be installed.\\n\\n{e!r}'\n                        )\n        finally:\n            _loading_plugins = False\n\n    return _plugins.values()\n", "path": "pydantic/plugin/_loader.py"}], "after_files": [{"content": "from __future__ import annotations\n\nimport importlib.metadata as importlib_metadata\nimport warnings\nfrom typing import TYPE_CHECKING, Final, Iterable\n\nif TYPE_CHECKING:\n    from . import PydanticPluginProtocol\n\n\nPYDANTIC_ENTRY_POINT_GROUP: Final[str] = 'pydantic'\n\n# cache of plugins\n_plugins: dict[str, PydanticPluginProtocol] | None = None\n# return no plugins while loading plugins to avoid recursion and errors while import plugins\n# this means that if plugins use pydantic\n_loading_plugins: bool = False\n\n\ndef get_plugins() -> Iterable[PydanticPluginProtocol]:\n    \"\"\"Load plugins for Pydantic.\n\n    Inspired by: https://github.com/pytest-dev/pluggy/blob/1.3.0/src/pluggy/_manager.py#L376-L402\n    \"\"\"\n    global _plugins, _loading_plugins\n    if _loading_plugins:\n        # this happens when plugins themselves use pydantic, we return no plugins\n        return ()\n    elif _plugins is None:\n        _plugins = {}\n        # set _loading_plugins so any plugins that use pydantic don't themselves use plugins\n        _loading_plugins = True\n        try:\n            for dist in importlib_metadata.distributions():\n                for entry_point in dist.entry_points:\n                    if entry_point.group != PYDANTIC_ENTRY_POINT_GROUP:\n                        continue\n                    if entry_point.value in _plugins:\n                        continue\n                    try:\n                        _plugins[entry_point.value] = entry_point.load()\n                    except (ImportError, AttributeError) as e:\n                        warnings.warn(\n                            f'{e.__class__.__name__} while loading the `{entry_point.name}` Pydantic plugin, '\n                            f'this plugin will not be installed.\\n\\n{e!r}'\n                        )\n        finally:\n            _loading_plugins = False\n\n    return _plugins.values()\n", "path": "pydantic/plugin/_loader.py"}]}