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 starlite/cli/commands/core.py]
  1 import inspect
  2 
  3 from click import command, option
  4 from rich.tree import Tree
  5 
  6 from starlite import HTTPRoute, Starlite, WebSocketRoute
  7 from starlite.cli.utils import StarliteCLIException, StarliteEnv, console, show_app_info
  8 from starlite.utils.helpers import unwrap_partial
  9 
  10 
  11 @command(name="info")
  12 def info_command(app: Starlite) -> None:
  13     """Show information about the detected Starlite app."""
  14 
  15     show_app_info(app)
  16 
  17 
  18 @command(name="run")
  19 @option("-r", "--reload", help="Reload server on changes", default=False, is_flag=True)
  20 @option("-p", "--port", help="Serve under this port", type=int, default=8000, show_default=True)
  21 @option("--host", help="Server under this host", default="127.0.0.1", show_default=True)
  22 @option("--debug", help="Run app in debug mode", is_flag=True)
  23 def run_command(
  24     reload: bool,
  25     port: int,
  26     host: str,
  27     debug: bool,
  28     env: StarliteEnv,
  29     app: Starlite,
  30 ) -> None:
  31     """Run a Starlite app.
  32 
  33     The app can be either passed as a module path in the form of <module name>.<submodule>:<app instance or factory>,
  34     set as an environment variable STARLITE_APP with the same format or automatically discovered from one of these
  35     canonical paths: app.py, asgi.py, application.py or app/__init__.py. When autodiscovering application factories,
  36     functions with the name ``create_app`` are considered, or functions that are annotated as returning a ``Starlite``
  37     instance.
  38     """
  39 
  40     try:
  41         import uvicorn
  42     except ImportError:
  43         raise StarliteCLIException("Uvicorn needs to be installed to run an app")  # pylint: disable=W0707
  44 
  45     if debug or env.debug:
  46         app.debug = True
  47 
  48     show_app_info(app)
  49 
  50     console.rule("[yellow]Starting server process", align="left")
  51 
  52     uvicorn.run(
  53         env.app_path,
  54         reload=env.reload or reload,
  55         host=env.host or host,
  56         port=env.port or port,
  57         factory=env.is_app_factory,
  58     )
  59 
  60 
  61 @command(name="routes")
  62 def routes_command(app: Starlite) -> None:  # pragma: no cover
  63     """Display information about the application's routes."""
  64 
  65     tree = Tree("", hide_root=True)
  66 
  67     for route in sorted(app.routes, key=lambda r: r.path):
  68         if isinstance(route, HTTPRoute):
  69             branch = tree.add(f"[green]{route.path}[/green] (HTTP)")
  70             for handler in route.route_handlers:
  71                 handler_info = [
  72                     f"[blue]{handler.name or handler.handler_name}[/blue]",
  73                 ]
  74 
  75                 if inspect.iscoroutinefunction(unwrap_partial(handler.fn.value)):
  76                     handler_info.append("[magenta]async[/magenta]")
  77                 else:
  78                     handler_info.append("[yellow]sync[/yellow]")
  79 
  80                 handler_info.append(f'[cyan]{", ".join(sorted(handler.http_methods))}[/cyan]')
  81 
  82                 if len(handler.paths) > 1:
  83                     for path in handler.paths:
  84                         branch.add(" ".join([f"[green]{path}[green]", *handler_info]))
  85                 else:
  86                     branch.add(" ".join(handler_info))
  87 
  88         else:
  89             if isinstance(route, WebSocketRoute):
  90                 route_type = "WS"
  91             else:
  92                 route_type = "ASGI"
  93             branch = tree.add(f"[green]{route.path}[/green] ({route_type})")
  94             branch.add(f"[blue]{route.route_handler.name or route.route_handler.handler_name}[/blue]")
  95 
  96     console.print(tree)
  97
  [end of starlite/cli/commands/core.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/starlite/cli/commands/core.py b/starlite/cli/commands/core.py
  --- a/starlite/cli/commands/core.py
  +++ b/starlite/cli/commands/core.py
  @@ -1,4 +1,6 @@
   import inspect
  +import subprocess
  +from typing import Any, Dict, List
   
   from click import command, option
   from rich.tree import Tree
  @@ -8,6 +10,18 @@
   from starlite.utils.helpers import unwrap_partial
   
   
  +def _convert_uvicorn_args(args: Dict[str, Any]) -> List[str]:
  +    process_args = []
  +    for arg, value in args.items():
  +        if isinstance(value, bool):
  +            if value:
  +                process_args.append(f"--{arg}")
  +        else:
  +            process_args.append(f"--{arg}={value}")
  +
  +    return process_args
  +
  +
   @command(name="info")
   def info_command(app: Starlite) -> None:
       """Show information about the detected Starlite app."""
  @@ -38,24 +52,24 @@
       """
   
       try:
  -        import uvicorn
  +        import uvicorn  # noqa: F401
       except ImportError:
           raise StarliteCLIException("Uvicorn needs to be installed to run an app")  # pylint: disable=W0707
   
       if debug or env.debug:
           app.debug = True
   
  -    show_app_info(app)
  +    # invoke uvicorn in a subprocess to be able to use the --reload flag. see
  +    # https://github.com/litestar-org/litestar/issues/1191 and https://github.com/encode/uvicorn/issues/1045
   
  -    console.rule("[yellow]Starting server process", align="left")
  +    process_args = {
  +        "reload": env.reload or reload,
  +        "host": env.host or host,
  +        "port": env.port or port,
  +        "factory": env.is_app_factory,
  +    }
   
  -    uvicorn.run(
  -        env.app_path,
  -        reload=env.reload or reload,
  -        host=env.host or host,
  -        port=env.port or port,
  -        factory=env.is_app_factory,
  -    )
  +    subprocess.run(["uvicorn", env.app_path, *_convert_uvicorn_args(process_args)], check=True)
   
   
   @command(name="routes")
  
verification_info: {"golden_diff": "diff --git a/starlite/cli/commands/core.py b/starlite/cli/commands/core.py\n--- a/starlite/cli/commands/core.py\n+++ b/starlite/cli/commands/core.py\n@@ -1,4 +1,6 @@\n import inspect\n+import subprocess\n+from typing import Any, Dict, List\n \n from click import command, option\n from rich.tree import Tree\n@@ -8,6 +10,18 @@\n from starlite.utils.helpers import unwrap_partial\n \n \n+def _convert_uvicorn_args(args: Dict[str, Any]) -> List[str]:\n+    process_args = []\n+    for arg, value in args.items():\n+        if isinstance(value, bool):\n+            if value:\n+                process_args.append(f\"--{arg}\")\n+        else:\n+            process_args.append(f\"--{arg}={value}\")\n+\n+    return process_args\n+\n+\n @command(name=\"info\")\n def info_command(app: Starlite) -> None:\n     \"\"\"Show information about the detected Starlite app.\"\"\"\n@@ -38,24 +52,24 @@\n     \"\"\"\n \n     try:\n-        import uvicorn\n+        import uvicorn  # noqa: F401\n     except ImportError:\n         raise StarliteCLIException(\"Uvicorn needs to be installed to run an app\")  # pylint: disable=W0707\n \n     if debug or env.debug:\n         app.debug = True\n \n-    show_app_info(app)\n+    # invoke uvicorn in a subprocess to be able to use the --reload flag. see\n+    # https://github.com/litestar-org/litestar/issues/1191 and https://github.com/encode/uvicorn/issues/1045\n \n-    console.rule(\"[yellow]Starting server process\", align=\"left\")\n+    process_args = {\n+        \"reload\": env.reload or reload,\n+        \"host\": env.host or host,\n+        \"port\": env.port or port,\n+        \"factory\": env.is_app_factory,\n+    }\n \n-    uvicorn.run(\n-        env.app_path,\n-        reload=env.reload or reload,\n-        host=env.host or host,\n-        port=env.port or port,\n-        factory=env.is_app_factory,\n-    )\n+    subprocess.run([\"uvicorn\", env.app_path, *_convert_uvicorn_args(process_args)], check=True)\n \n \n @command(name=\"routes\")\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 inspect\n\nfrom click import command, option\nfrom rich.tree import Tree\n\nfrom starlite import HTTPRoute, Starlite, WebSocketRoute\nfrom starlite.cli.utils import StarliteCLIException, StarliteEnv, console, show_app_info\nfrom starlite.utils.helpers import unwrap_partial\n\n\n@command(name=\"info\")\ndef info_command(app: Starlite) -> None:\n    \"\"\"Show information about the detected Starlite app.\"\"\"\n\n    show_app_info(app)\n\n\n@command(name=\"run\")\n@option(\"-r\", \"--reload\", help=\"Reload server on changes\", default=False, is_flag=True)\n@option(\"-p\", \"--port\", help=\"Serve under this port\", type=int, default=8000, show_default=True)\n@option(\"--host\", help=\"Server under this host\", default=\"127.0.0.1\", show_default=True)\n@option(\"--debug\", help=\"Run app in debug mode\", is_flag=True)\ndef run_command(\n    reload: bool,\n    port: int,\n    host: str,\n    debug: bool,\n    env: StarliteEnv,\n    app: Starlite,\n) -> None:\n    \"\"\"Run a Starlite app.\n\n    The app can be either passed as a module path in the form of <module name>.<submodule>:<app instance or factory>,\n    set as an environment variable STARLITE_APP with the same format or automatically discovered from one of these\n    canonical paths: app.py, asgi.py, application.py or app/__init__.py. When autodiscovering application factories,\n    functions with the name ``create_app`` are considered, or functions that are annotated as returning a ``Starlite``\n    instance.\n    \"\"\"\n\n    try:\n        import uvicorn\n    except ImportError:\n        raise StarliteCLIException(\"Uvicorn needs to be installed to run an app\")  # pylint: disable=W0707\n\n    if debug or env.debug:\n        app.debug = True\n\n    show_app_info(app)\n\n    console.rule(\"[yellow]Starting server process\", align=\"left\")\n\n    uvicorn.run(\n        env.app_path,\n        reload=env.reload or reload,\n        host=env.host or host,\n        port=env.port or port,\n        factory=env.is_app_factory,\n    )\n\n\n@command(name=\"routes\")\ndef routes_command(app: Starlite) -> None:  # pragma: no cover\n    \"\"\"Display information about the application's routes.\"\"\"\n\n    tree = Tree(\"\", hide_root=True)\n\n    for route in sorted(app.routes, key=lambda r: r.path):\n        if isinstance(route, HTTPRoute):\n            branch = tree.add(f\"[green]{route.path}[/green] (HTTP)\")\n            for handler in route.route_handlers:\n                handler_info = [\n                    f\"[blue]{handler.name or handler.handler_name}[/blue]\",\n                ]\n\n                if inspect.iscoroutinefunction(unwrap_partial(handler.fn.value)):\n                    handler_info.append(\"[magenta]async[/magenta]\")\n                else:\n                    handler_info.append(\"[yellow]sync[/yellow]\")\n\n                handler_info.append(f'[cyan]{\", \".join(sorted(handler.http_methods))}[/cyan]')\n\n                if len(handler.paths) > 1:\n                    for path in handler.paths:\n                        branch.add(\" \".join([f\"[green]{path}[green]\", *handler_info]))\n                else:\n                    branch.add(\" \".join(handler_info))\n\n        else:\n            if isinstance(route, WebSocketRoute):\n                route_type = \"WS\"\n            else:\n                route_type = \"ASGI\"\n            branch = tree.add(f\"[green]{route.path}[/green] ({route_type})\")\n            branch.add(f\"[blue]{route.route_handler.name or route.route_handler.handler_name}[/blue]\")\n\n    console.print(tree)\n", "path": "starlite/cli/commands/core.py"}]}