prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <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
  
  </issue>
  <code>
  [start of docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py]
  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 of docs/examples/contrib/sqlalchemy/sqlalchemy_repository_bulk_operations.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: 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.")
  
verification_info: {"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"}]}