We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
StaticFilesConfig and virtual directories
I'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. 

This is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.

https://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `tools/build_docs.py`
Content:
```
1 from __future__ import annotations
2 
3 import argparse
4 import importlib.metadata
5 import json
6 import os
7 import shutil
8 import subprocess
9 from contextlib import contextmanager
10 from pathlib import Path
11 from typing import TypedDict
12 
13 REDIRECT_TEMPLATE = """
14 <!DOCTYPE HTML>
15 <html lang="en-US">
16     <head>
17         <title>Page Redirection</title>
18         <meta charset="UTF-8">
19         <meta http-equiv="refresh" content="0; url={target}">
20         <script type="text/javascript">window.location.href = "{target}"</script>
21     </head>
22     <body>
23         You are being redirected. If this does not work, click <a href='{target}'>this link</a>
24     </body>
25 </html>
26 """
27 
28 parser = argparse.ArgumentParser()
29 parser.add_argument("--version", required=False)
30 parser.add_argument("--ignore-missing-examples-output", action="store_true", default=False)
31 parser.add_argument("output")
32 
33 
34 class VersionSpec(TypedDict):
35     versions: list[str]
36     latest: str
37 
38 
39 @contextmanager
40 def checkout(branch: str) -> None:
41     subprocess.run(["git", "checkout", branch], check=True)  # noqa: S603 S607
42     yield
43     subprocess.run(["git", "checkout", "-"], check=True)  # noqa: S603 S607
44 
45 
46 def load_version_spec() -> VersionSpec:
47     versions_file = Path("docs/_static/versions.json")
48     if versions_file.exists():
49         return json.loads(versions_file.read_text())
50     return {"versions": [], "latest": ""}
51 
52 
53 def build(output_dir: str, version: str | None, ignore_missing_output: bool) -> None:
54     if version is None:
55         version = importlib.metadata.version("litestar").rsplit(".")[0]
56     else:
57         os.environ["_LITESTAR_DOCS_BUILD_VERSION"] = version
58 
59     if ignore_missing_output:
60         os.environ["_LITESTAR_DOCS_IGNORE_MISSING_EXAMPLE_OUTPUT"] = "1"
61 
62     subprocess.run(["make", "docs"], check=True)  # noqa: S603 S607
63 
64     output_dir = Path(output_dir)
65     output_dir.mkdir()
66     output_dir.joinpath(".nojekyll").touch(exist_ok=True)
67 
68     version_spec = load_version_spec()
69     is_latest = version == version_spec["latest"]
70 
71     docs_src_path = Path("docs/_build/html")
72 
73     output_dir.joinpath("index.html").write_text(REDIRECT_TEMPLATE.format(target="latest"))
74 
75     if is_latest:
76         shutil.copytree(docs_src_path, output_dir / "latest", dirs_exist_ok=True)
77     shutil.copytree(docs_src_path, output_dir / version, dirs_exist_ok=True)
78 
79     # copy existing versions into our output dir to preserve them when cleaning the branch
80     with checkout("gh-pages"):
81         for other_version in [*version_spec["versions"], "latest"]:
82             other_version_path = Path(other_version)
83             other_version_target_path = output_dir / other_version
84             if other_version_path.exists() and not other_version_target_path.exists():
85                 shutil.copytree(other_version_path, other_version_target_path)
86 
87 
88 def main() -> None:
89     args = parser.parse_args()
90     build(
91         output_dir=args.output,
92         version=args.version,
93         ignore_missing_output=args.ignore_missing_output,
94     )
95 
96 
97 if __name__ == "__main__":
98     main()
99
```
--- 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/tools/build_docs.py b/tools/build_docs.py
--- a/tools/build_docs.py
+++ b/tools/build_docs.py
@@ -90,7 +90,7 @@
     build(
         output_dir=args.output,
         version=args.version,
-        ignore_missing_output=args.ignore_missing_output,
+        ignore_missing_output=args.ignore_missing_examples_output,
     )

{"golden_diff": "diff --git a/tools/build_docs.py b/tools/build_docs.py\n--- a/tools/build_docs.py\n+++ b/tools/build_docs.py\n@@ -90,7 +90,7 @@\n     build(\n         output_dir=args.output,\n         version=args.version,\n-        ignore_missing_output=args.ignore_missing_output,\n+        ignore_missing_output=args.ignore_missing_examples_output,\n     )\n", "issue": "StaticFilesConfig and virtual directories\nI'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. \r\n\r\nThis is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.\r\n\r\nhttps://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32\n", "before_files": [{"content": "from __future__ import annotations\n\nimport argparse\nimport importlib.metadata\nimport json\nimport os\nimport shutil\nimport subprocess\nfrom contextlib import contextmanager\nfrom pathlib import Path\nfrom typing import TypedDict\n\nREDIRECT_TEMPLATE = \"\"\"\n<!DOCTYPE HTML>\n<html lang=\"en-US\">\n    <head>\n        <title>Page Redirection</title>\n        <meta charset=\"UTF-8\">\n        <meta http-equiv=\"refresh\" content=\"0; url={target}\">\n        <script type=\"text/javascript\">window.location.href = \"{target}\"</script>\n    </head>\n    <body>\n        You are being redirected. If this does not work, click <a href='{target}'>this link</a>\n    </body>\n</html>\n\"\"\"\n\nparser = argparse.ArgumentParser()\nparser.add_argument(\"--version\", required=False)\nparser.add_argument(\"--ignore-missing-examples-output\", action=\"store_true\", default=False)\nparser.add_argument(\"output\")\n\n\nclass VersionSpec(TypedDict):\n    versions: list[str]\n    latest: str\n\n\n@contextmanager\ndef checkout(branch: str) -> None:\n    subprocess.run([\"git\", \"checkout\", branch], check=True)  # noqa: S603 S607\n    yield\n    subprocess.run([\"git\", \"checkout\", \"-\"], check=True)  # noqa: S603 S607\n\n\ndef load_version_spec() -> VersionSpec:\n    versions_file = Path(\"docs/_static/versions.json\")\n    if versions_file.exists():\n        return json.loads(versions_file.read_text())\n    return {\"versions\": [], \"latest\": \"\"}\n\n\ndef build(output_dir: str, version: str | None, ignore_missing_output: bool) -> None:\n    if version is None:\n        version = importlib.metadata.version(\"litestar\").rsplit(\".\")[0]\n    else:\n        os.environ[\"_LITESTAR_DOCS_BUILD_VERSION\"] = version\n\n    if ignore_missing_output:\n        os.environ[\"_LITESTAR_DOCS_IGNORE_MISSING_EXAMPLE_OUTPUT\"] = \"1\"\n\n    subprocess.run([\"make\", \"docs\"], check=True)  # noqa: S603 S607\n\n    output_dir = Path(output_dir)\n    output_dir.mkdir()\n    output_dir.joinpath(\".nojekyll\").touch(exist_ok=True)\n\n    version_spec = load_version_spec()\n    is_latest = version == version_spec[\"latest\"]\n\n    docs_src_path = Path(\"docs/_build/html\")\n\n    output_dir.joinpath(\"index.html\").write_text(REDIRECT_TEMPLATE.format(target=\"latest\"))\n\n    if is_latest:\n        shutil.copytree(docs_src_path, output_dir / \"latest\", dirs_exist_ok=True)\n    shutil.copytree(docs_src_path, output_dir / version, dirs_exist_ok=True)\n\n    # copy existing versions into our output dir to preserve them when cleaning the branch\n    with checkout(\"gh-pages\"):\n        for other_version in [*version_spec[\"versions\"], \"latest\"]:\n            other_version_path = Path(other_version)\n            other_version_target_path = output_dir / other_version\n            if other_version_path.exists() and not other_version_target_path.exists():\n                shutil.copytree(other_version_path, other_version_target_path)\n\n\ndef main() -> None:\n    args = parser.parse_args()\n    build(\n        output_dir=args.output,\n        version=args.version,\n        ignore_missing_output=args.ignore_missing_output,\n    )\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "tools/build_docs.py"}], "after_files": [{"content": "from __future__ import annotations\n\nimport argparse\nimport importlib.metadata\nimport json\nimport os\nimport shutil\nimport subprocess\nfrom contextlib import contextmanager\nfrom pathlib import Path\nfrom typing import TypedDict\n\nREDIRECT_TEMPLATE = \"\"\"\n<!DOCTYPE HTML>\n<html lang=\"en-US\">\n    <head>\n        <title>Page Redirection</title>\n        <meta charset=\"UTF-8\">\n        <meta http-equiv=\"refresh\" content=\"0; url={target}\">\n        <script type=\"text/javascript\">window.location.href = \"{target}\"</script>\n    </head>\n    <body>\n        You are being redirected. If this does not work, click <a href='{target}'>this link</a>\n    </body>\n</html>\n\"\"\"\n\nparser = argparse.ArgumentParser()\nparser.add_argument(\"--version\", required=False)\nparser.add_argument(\"--ignore-missing-examples-output\", action=\"store_true\", default=False)\nparser.add_argument(\"output\")\n\n\nclass VersionSpec(TypedDict):\n    versions: list[str]\n    latest: str\n\n\n@contextmanager\ndef checkout(branch: str) -> None:\n    subprocess.run([\"git\", \"checkout\", branch], check=True)  # noqa: S603 S607\n    yield\n    subprocess.run([\"git\", \"checkout\", \"-\"], check=True)  # noqa: S603 S607\n\n\ndef load_version_spec() -> VersionSpec:\n    versions_file = Path(\"docs/_static/versions.json\")\n    if versions_file.exists():\n        return json.loads(versions_file.read_text())\n    return {\"versions\": [], \"latest\": \"\"}\n\n\ndef build(output_dir: str, version: str | None, ignore_missing_output: bool) -> None:\n    if version is None:\n        version = importlib.metadata.version(\"litestar\").rsplit(\".\")[0]\n    else:\n        os.environ[\"_LITESTAR_DOCS_BUILD_VERSION\"] = version\n\n    if ignore_missing_output:\n        os.environ[\"_LITESTAR_DOCS_IGNORE_MISSING_EXAMPLE_OUTPUT\"] = \"1\"\n\n    subprocess.run([\"make\", \"docs\"], check=True)  # noqa: S603 S607\n\n    output_dir = Path(output_dir)\n    output_dir.mkdir()\n    output_dir.joinpath(\".nojekyll\").touch(exist_ok=True)\n\n    version_spec = load_version_spec()\n    is_latest = version == version_spec[\"latest\"]\n\n    docs_src_path = Path(\"docs/_build/html\")\n\n    output_dir.joinpath(\"index.html\").write_text(REDIRECT_TEMPLATE.format(target=\"latest\"))\n\n    if is_latest:\n        shutil.copytree(docs_src_path, output_dir / \"latest\", dirs_exist_ok=True)\n    shutil.copytree(docs_src_path, output_dir / version, dirs_exist_ok=True)\n\n    # copy existing versions into our output dir to preserve them when cleaning the branch\n    with checkout(\"gh-pages\"):\n        for other_version in [*version_spec[\"versions\"], \"latest\"]:\n            other_version_path = Path(other_version)\n            other_version_target_path = output_dir / other_version\n            if other_version_path.exists() and not other_version_target_path.exists():\n                shutil.copytree(other_version_path, other_version_target_path)\n\n\ndef main() -> None:\n    args = parser.parse_args()\n    build(\n        output_dir=args.output,\n        version=args.version,\n        ignore_missing_output=args.ignore_missing_examples_output,\n    )\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "tools/build_docs.py"}]}