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 litestar/contrib/pydantic.py]
  1 from __future__ import annotations
  2 
  3 from typing import TYPE_CHECKING, Generic, TypeVar
  4 
  5 from pydantic import BaseModel
  6 
  7 from litestar.dto.factory.abc import AbstractDTOFactory
  8 from litestar.dto.factory.field import DTO_FIELD_META_KEY, DTOField
  9 from litestar.dto.factory.types import FieldDefinition
  10 from litestar.dto.factory.utils import get_model_type_hints
  11 from litestar.types.empty import Empty
  12 from litestar.utils.helpers import get_fully_qualified_class_name
  13 
  14 if TYPE_CHECKING:
  15     from typing import Any, ClassVar, Collection, Generator
  16 
  17     from pydantic.fields import ModelField
  18 
  19     from litestar.typing import ParsedType
  20 
  21 __all__ = ("PydanticDTO",)
  22 
  23 T = TypeVar("T", bound="BaseModel | Collection[BaseModel]")
  24 
  25 
  26 class PydanticDTO(AbstractDTOFactory[T], Generic[T]):
  27     """Support for domain modelling with Pydantic."""
  28 
  29     __slots__ = ()
  30 
  31     model_type: ClassVar[type[BaseModel]]
  32 
  33     @classmethod
  34     def generate_field_definitions(cls, model_type: type[BaseModel]) -> Generator[FieldDefinition, None, None]:
  35         for key, parsed_type in get_model_type_hints(model_type).items():
  36             model_field = model_type.__fields__[key]
  37 
  38             dto_field: DTOField | None = model_field.field_info.extra.get(DTO_FIELD_META_KEY)
  39 
  40             def determine_default(_parsed_type: ParsedType, _model_field: ModelField) -> Any:
  41                 if (
  42                     _model_field.default is Ellipsis
  43                     or _model_field.default_factory is not None
  44                     or (_model_field.default is None and not _parsed_type.is_optional)
  45                 ):
  46                     return Empty
  47 
  48                 return _model_field.default
  49 
  50             field_def = FieldDefinition(
  51                 name=key,
  52                 default=determine_default(parsed_type, model_field),
  53                 parsed_type=parsed_type,
  54                 default_factory=model_field.default_factory or Empty,
  55                 dto_field=dto_field,
  56                 unique_model_name=get_fully_qualified_class_name(model_type),
  57             )
  58 
  59             yield field_def
  60 
  61     @classmethod
  62     def detect_nested_field(cls, parsed_type: ParsedType) -> bool:
  63         return parsed_type.is_subclass_of(BaseModel)
  64
  [end of litestar/contrib/pydantic.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/litestar/contrib/pydantic.py b/litestar/contrib/pydantic.py
  --- a/litestar/contrib/pydantic.py
  +++ b/litestar/contrib/pydantic.py
  @@ -32,9 +32,10 @@
   
       @classmethod
       def generate_field_definitions(cls, model_type: type[BaseModel]) -> Generator[FieldDefinition, None, None]:
  -        for key, parsed_type in get_model_type_hints(model_type).items():
  +        model_parsed_types = get_model_type_hints(model_type)
  +        for key, model_field in model_type.__fields__.items():
  +            parsed_type = model_parsed_types[key]
               model_field = model_type.__fields__[key]
  -
               dto_field: DTOField | None = model_field.field_info.extra.get(DTO_FIELD_META_KEY)
   
               def determine_default(_parsed_type: ParsedType, _model_field: ModelField) -> Any:
  
verification_info: {"golden_diff": "diff --git a/litestar/contrib/pydantic.py b/litestar/contrib/pydantic.py\n--- a/litestar/contrib/pydantic.py\n+++ b/litestar/contrib/pydantic.py\n@@ -32,9 +32,10 @@\n \n     @classmethod\n     def generate_field_definitions(cls, model_type: type[BaseModel]) -> Generator[FieldDefinition, None, None]:\n-        for key, parsed_type in get_model_type_hints(model_type).items():\n+        model_parsed_types = get_model_type_hints(model_type)\n+        for key, model_field in model_type.__fields__.items():\n+            parsed_type = model_parsed_types[key]\n             model_field = model_type.__fields__[key]\n-\n             dto_field: DTOField | None = model_field.field_info.extra.get(DTO_FIELD_META_KEY)\n \n             def determine_default(_parsed_type: ParsedType, _model_field: ModelField) -> Any:\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\nfrom typing import TYPE_CHECKING, Generic, TypeVar\n\nfrom pydantic import BaseModel\n\nfrom litestar.dto.factory.abc import AbstractDTOFactory\nfrom litestar.dto.factory.field import DTO_FIELD_META_KEY, DTOField\nfrom litestar.dto.factory.types import FieldDefinition\nfrom litestar.dto.factory.utils import get_model_type_hints\nfrom litestar.types.empty import Empty\nfrom litestar.utils.helpers import get_fully_qualified_class_name\n\nif TYPE_CHECKING:\n    from typing import Any, ClassVar, Collection, Generator\n\n    from pydantic.fields import ModelField\n\n    from litestar.typing import ParsedType\n\n__all__ = (\"PydanticDTO\",)\n\nT = TypeVar(\"T\", bound=\"BaseModel | Collection[BaseModel]\")\n\n\nclass PydanticDTO(AbstractDTOFactory[T], Generic[T]):\n    \"\"\"Support for domain modelling with Pydantic.\"\"\"\n\n    __slots__ = ()\n\n    model_type: ClassVar[type[BaseModel]]\n\n    @classmethod\n    def generate_field_definitions(cls, model_type: type[BaseModel]) -> Generator[FieldDefinition, None, None]:\n        for key, parsed_type in get_model_type_hints(model_type).items():\n            model_field = model_type.__fields__[key]\n\n            dto_field: DTOField | None = model_field.field_info.extra.get(DTO_FIELD_META_KEY)\n\n            def determine_default(_parsed_type: ParsedType, _model_field: ModelField) -> Any:\n                if (\n                    _model_field.default is Ellipsis\n                    or _model_field.default_factory is not None\n                    or (_model_field.default is None and not _parsed_type.is_optional)\n                ):\n                    return Empty\n\n                return _model_field.default\n\n            field_def = FieldDefinition(\n                name=key,\n                default=determine_default(parsed_type, model_field),\n                parsed_type=parsed_type,\n                default_factory=model_field.default_factory or Empty,\n                dto_field=dto_field,\n                unique_model_name=get_fully_qualified_class_name(model_type),\n            )\n\n            yield field_def\n\n    @classmethod\n    def detect_nested_field(cls, parsed_type: ParsedType) -> bool:\n        return parsed_type.is_subclass_of(BaseModel)\n", "path": "litestar/contrib/pydantic.py"}]}