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: `docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py`
Content:
```
1 import json
2 from pathlib import Path
3 from typing import Any
4 
5 from rich import get_console
6 from sqlalchemy import create_engine
7 from sqlalchemy.orm import Mapped, Session, sessionmaker
8 
9 from litestar.contrib.sqlalchemy.base import UUIDBase
10 from litestar.contrib.sqlalchemy.repository import SQLAlchemySyncRepository
11 from litestar.repository.filters import LimitOffset
12 
13 here = Path(__file__).parent
14 console = get_console()
15 
16 
17 class USState(UUIDBase):
18     # you can optionally override the generated table name by manually setting it.
19     __tablename__ = "us_state_lookup"  # type: ignore[assignment]
20     abbreviation: Mapped[str]
21     name: Mapped[str]
22 
23 
24 class USStateRepository(SQLAlchemySyncRepository[USState]):
25     """US State repository."""
26 
27     model_type = USState
28 
29 
30 engine = create_engine(
31     "duckdb:///:memory:",
32     future=True,
33 )
34 session_factory: sessionmaker[Session] = sessionmaker(engine, expire_on_commit=False)
35 
36 
37 def open_fixture(fixtures_path: Path, fixture_name: str) -> Any:
38     """Loads JSON file with the specified fixture name
39 
40     Args:
41         fixtures_path (Path): The path to look for fixtures
42         fixture_name (str): The fixture name to load.
43 
44     Raises:
45         FileNotFoundError: Fixtures not found.
46 
47     Returns:
48         Any: The parsed JSON data
49     """
50     fixture = Path(fixtures_path / f"{fixture_name}.json")
51     if fixture.exists():
52         with fixture.open(mode="r", encoding="utf-8") as f:
53             f_data = f.read()
54         return json.loads(f_data)
55     raise FileNotFoundError(f"Could not find the {fixture_name} fixture")
56 
57 
58 def run_script() -> None:
59     """Load data from a fixture."""
60 
61     # Initializes the database.
62     with engine.begin() as conn:
63         USState.metadata.create_all(conn)
64 
65     with session_factory() as db_session:
66         # 1) load the JSON data into the US States table
67         repo = USStateRepository(session=db_session)
68         fixture = open_fixture(here, USStateRepository.model_type.__tablename__)  # type: ignore
69         objs = repo.add_many([USStateRepository.model_type(**raw_obj) for raw_obj in fixture])
70         db_session.commit()
71         console.print(f"Created {len(objs)} new objects.")
72 
73         # 2) Select paginated data and total row count.
74         created_objs, total_objs = repo.list_and_count(LimitOffset(limit=10, offset=0))
75         console.print(f"Selected {len(created_objs)} records out of a total of {total_objs}.")
76 
77         # 2) Let's remove the batch of records selected.
78         deleted_objs = repo.delete_many([new_obj.id for new_obj in created_objs])
79         console.print(f"Removed {len(deleted_objs)} records out of a total of {total_objs}.")
80 
81         # 3) Le'ts count the remaining rows
82         remaining_count = repo.count()
83         console.print(f"Found {remaining_count} remaining records after delete.")
84 
85 
86 if __name__ == "__main__":
87     run_script()
88
```
--- 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/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py b/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py
--- a/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py
+++ b/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py
@@ -63,7 +63,7 @@
         USState.metadata.create_all(conn)
 
     with session_factory() as db_session:
-        # 1) load the JSON data into the US States table
+        # 1) Load the JSON data into the US States table.
         repo = USStateRepository(session=db_session)
         fixture = open_fixture(here, USStateRepository.model_type.__tablename__)  # type: ignore
         objs = repo.add_many([USStateRepository.model_type(**raw_obj) for raw_obj in fixture])
@@ -74,11 +74,11 @@
         created_objs, total_objs = repo.list_and_count(LimitOffset(limit=10, offset=0))
         console.print(f"Selected {len(created_objs)} records out of a total of {total_objs}.")
 
-        # 2) Let's remove the batch of records selected.
+        # 3) Let's remove the batch of records selected.
         deleted_objs = repo.delete_many([new_obj.id for new_obj in created_objs])
         console.print(f"Removed {len(deleted_objs)} records out of a total of {total_objs}.")
 
-        # 3) Le'ts count the remaining rows
+        # 4) Let's count the remaining rows
         remaining_count = repo.count()
         console.print(f"Found {remaining_count} remaining records after delete.")

{"golden_diff": "diff --git a/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py b/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py\n--- a/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py\n+++ b/docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py\n@@ -63,7 +63,7 @@\n         USState.metadata.create_all(conn)\n \n     with session_factory() as db_session:\n-        # 1) load the JSON data into the US States table\n+        # 1) Load the JSON data into the US States table.\n         repo = USStateRepository(session=db_session)\n         fixture = open_fixture(here, USStateRepository.model_type.__tablename__)  # type: ignore\n         objs = repo.add_many([USStateRepository.model_type(**raw_obj) for raw_obj in fixture])\n@@ -74,11 +74,11 @@\n         created_objs, total_objs = repo.list_and_count(LimitOffset(limit=10, offset=0))\n         console.print(f\"Selected {len(created_objs)} records out of a total of {total_objs}.\")\n \n-        # 2) Let's remove the batch of records selected.\n+        # 3) Let's remove the batch of records selected.\n         deleted_objs = repo.delete_many([new_obj.id for new_obj in created_objs])\n         console.print(f\"Removed {len(deleted_objs)} records out of a total of {total_objs}.\")\n \n-        # 3) Le'ts count the remaining rows\n+        # 4) Let's count the remaining rows\n         remaining_count = repo.count()\n         console.print(f\"Found {remaining_count} remaining records after delete.\")\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": "import json\nfrom pathlib import Path\nfrom typing import Any\n\nfrom rich import get_console\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.orm import Mapped, Session, sessionmaker\n\nfrom litestar.contrib.sqlalchemy.base import UUIDBase\nfrom litestar.contrib.sqlalchemy.repository import SQLAlchemySyncRepository\nfrom litestar.repository.filters import LimitOffset\n\nhere = Path(__file__).parent\nconsole = get_console()\n\n\nclass USState(UUIDBase):\n    # you can optionally override the generated table name by manually setting it.\n    __tablename__ = \"us_state_lookup\"  # type: ignore[assignment]\n    abbreviation: Mapped[str]\n    name: Mapped[str]\n\n\nclass USStateRepository(SQLAlchemySyncRepository[USState]):\n    \"\"\"US State repository.\"\"\"\n\n    model_type = USState\n\n\nengine = create_engine(\n    \"duckdb:///:memory:\",\n    future=True,\n)\nsession_factory: sessionmaker[Session] = sessionmaker(engine, expire_on_commit=False)\n\n\ndef open_fixture(fixtures_path: Path, fixture_name: str) -> Any:\n    \"\"\"Loads JSON file with the specified fixture name\n\n    Args:\n        fixtures_path (Path): The path to look for fixtures\n        fixture_name (str): The fixture name to load.\n\n    Raises:\n        FileNotFoundError: Fixtures not found.\n\n    Returns:\n        Any: The parsed JSON data\n    \"\"\"\n    fixture = Path(fixtures_path / f\"{fixture_name}.json\")\n    if fixture.exists():\n        with fixture.open(mode=\"r\", encoding=\"utf-8\") as f:\n            f_data = f.read()\n        return json.loads(f_data)\n    raise FileNotFoundError(f\"Could not find the {fixture_name} fixture\")\n\n\ndef run_script() -> None:\n    \"\"\"Load data from a fixture.\"\"\"\n\n    # Initializes the database.\n    with engine.begin() as conn:\n        USState.metadata.create_all(conn)\n\n    with session_factory() as db_session:\n        # 1) load the JSON data into the US States table\n        repo = USStateRepository(session=db_session)\n        fixture = open_fixture(here, USStateRepository.model_type.__tablename__)  # type: ignore\n        objs = repo.add_many([USStateRepository.model_type(**raw_obj) for raw_obj in fixture])\n        db_session.commit()\n        console.print(f\"Created {len(objs)} new objects.\")\n\n        # 2) Select paginated data and total row count.\n        created_objs, total_objs = repo.list_and_count(LimitOffset(limit=10, offset=0))\n        console.print(f\"Selected {len(created_objs)} records out of a total of {total_objs}.\")\n\n        # 2) Let's remove the batch of records selected.\n        deleted_objs = repo.delete_many([new_obj.id for new_obj in created_objs])\n        console.print(f\"Removed {len(deleted_objs)} records out of a total of {total_objs}.\")\n\n        # 3) Le'ts count the remaining rows\n        remaining_count = repo.count()\n        console.print(f\"Found {remaining_count} remaining records after delete.\")\n\n\nif __name__ == \"__main__\":\n    run_script()\n", "path": "docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py"}], "after_files": [{"content": "import json\nfrom pathlib import Path\nfrom typing import Any\n\nfrom rich import get_console\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.orm import Mapped, Session, sessionmaker\n\nfrom litestar.contrib.sqlalchemy.base import UUIDBase\nfrom litestar.contrib.sqlalchemy.repository import SQLAlchemySyncRepository\nfrom litestar.repository.filters import LimitOffset\n\nhere = Path(__file__).parent\nconsole = get_console()\n\n\nclass USState(UUIDBase):\n    # you can optionally override the generated table name by manually setting it.\n    __tablename__ = \"us_state_lookup\"  # type: ignore[assignment]\n    abbreviation: Mapped[str]\n    name: Mapped[str]\n\n\nclass USStateRepository(SQLAlchemySyncRepository[USState]):\n    \"\"\"US State repository.\"\"\"\n\n    model_type = USState\n\n\nengine = create_engine(\n    \"duckdb:///:memory:\",\n    future=True,\n)\nsession_factory: sessionmaker[Session] = sessionmaker(engine, expire_on_commit=False)\n\n\ndef open_fixture(fixtures_path: Path, fixture_name: str) -> Any:\n    \"\"\"Loads JSON file with the specified fixture name\n\n    Args:\n        fixtures_path (Path): The path to look for fixtures\n        fixture_name (str): The fixture name to load.\n\n    Raises:\n        FileNotFoundError: Fixtures not found.\n\n    Returns:\n        Any: The parsed JSON data\n    \"\"\"\n    fixture = Path(fixtures_path / f\"{fixture_name}.json\")\n    if fixture.exists():\n        with fixture.open(mode=\"r\", encoding=\"utf-8\") as f:\n            f_data = f.read()\n        return json.loads(f_data)\n    raise FileNotFoundError(f\"Could not find the {fixture_name} fixture\")\n\n\ndef run_script() -> None:\n    \"\"\"Load data from a fixture.\"\"\"\n\n    # Initializes the database.\n    with engine.begin() as conn:\n        USState.metadata.create_all(conn)\n\n    with session_factory() as db_session:\n        # 1) Load the JSON data into the US States table.\n        repo = USStateRepository(session=db_session)\n        fixture = open_fixture(here, USStateRepository.model_type.__tablename__)  # type: ignore\n        objs = repo.add_many([USStateRepository.model_type(**raw_obj) for raw_obj in fixture])\n        db_session.commit()\n        console.print(f\"Created {len(objs)} new objects.\")\n\n        # 2) Select paginated data and total row count.\n        created_objs, total_objs = repo.list_and_count(LimitOffset(limit=10, offset=0))\n        console.print(f\"Selected {len(created_objs)} records out of a total of {total_objs}.\")\n\n        # 3) Let's remove the batch of records selected.\n        deleted_objs = repo.delete_many([new_obj.id for new_obj in created_objs])\n        console.print(f\"Removed {len(deleted_objs)} records out of a total of {total_objs}.\")\n\n        # 4) Let's count the remaining rows\n        remaining_count = repo.count()\n        console.print(f\"Found {remaining_count} remaining records after delete.\")\n\n\nif __name__ == \"__main__\":\n    run_script()\n", "path": "docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py"}]}