internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: litestar-org/litestar

Issue:
Bug: `SessionCookieConfig` import DeprecationWarning - suggested import path does not exist
**Describe the bug**
In Starlite >= 1.47, the statement `from starlite.middleware.session.cookie_backend import CookieBackendConfig` raises a DeprecationWarning:
```
DeprecationWarning: Import of deprecated import 'SessionCookieConfig from starlite.middleware.session'.
Deprecated in starlite 1.47.0. This import will be removed in the next major version.
Use "'from startlite.middleware.sessions.cookie_backend import CookieBackendConfig'" instead
```
The suggested import path does not exist and contains a typo.




Discussion:
Quick searches against the codebase show this also has that `startlite` typo
https://github.com/starlite-api/starlite/blob/abc0ff41ac917afd8d8af718949de2ea935ca44c/starlite/app.py#L466

Resolving patch:
diff --git a/starlite/middleware/session/__init__.py b/starlite/middleware/session/__init__.py
--- a/starlite/middleware/session/__init__.py
+++ b/starlite/middleware/session/__init__.py
@@ -8,7 +8,7 @@
 def __getattr__(name: str) -> Any:
     """Provide lazy importing as per https://peps.python.org/pep-0562/"""
 
-    if name != "SessionCookieConfig":
+    if name != "CookieBackendConfig":
         raise AttributeError(f"Module {__package__} has no attribute {name}")
 
     from .cookie_backend import CookieBackendConfig
@@ -16,7 +16,7 @@ def __getattr__(name: str) -> Any:
     warn_deprecation(
         deprecated_name=f"{name} from {__package__}",
         kind="import",
-        alternative="'from startlite.middleware.sessions.cookie_backend import CookieBackendConfig'",
+        alternative="'from starlite.middleware.session.cookie_backend import CookieBackendConfig'",
         version="1.47.0",
     )
 
diff --git a/starlite/template/__init__.py b/starlite/template/__init__.py
--- a/starlite/template/__init__.py
+++ b/starlite/template/__init__.py
@@ -32,7 +32,7 @@ def __getattr__(name: str) -> Any:
     warn_deprecation(
         deprecated_name=f"{name} from {__package__}",
         kind="import",
-        alternative=f"'from startlite.contrib.{module} import {name}'",
+        alternative=f"'from starlite.contrib.{module} import {name}'",
         version="1.46.0",
     )
 


Test patch:
Repository: litestar-org/litestar

Issue:
Fix typo in from_config class method
Quick searches against the codebase show this also has that `startlite` typo
https://github.com/starlite-api/starlite/blob/abc0ff41ac917afd8d8af718949de2ea935ca44c/starlite/app.py#L466

_Originally posted by @JacobCoffee in https://github.com/starlite-api/starlite/issues/1284#issuecomment-1455183603_
            


Discussion:

Resolving patch:
diff --git a/starlite/app.py b/starlite/app.py
--- a/starlite/app.py
+++ b/starlite/app.py
@@ -463,7 +463,7 @@ def from_config(cls, config: AppConfig) -> Self:
         """Initialize a ``Starlite`` application from a configuration instance.
 
         Args:
-            config: An instance of :class:`AppConfig` <startlite.config.AppConfig>
+            config: An instance of :class:`AppConfig` <starlite.config.AppConfig>
 
         Returns:
             An instance of ``Starlite`` application.


Test patch:
Repository: litestar-org/litestar

Issue:
Rule exceptions using noqa should be very specific 
I think this would ignore all linting here instead of maybe the one we want. May be best to be specific?

https://beta.ruff.rs/docs/configuration/#error-suppression

_Originally posted by @JacobCoffee in https://github.com/starlite-api/starlite/pull/1323#discussion_r1135989720_
            


Discussion:

Resolving patch:
diff --git a/starlite/contrib/sqlalchemy_1/config.py b/starlite/contrib/sqlalchemy_1/config.py
--- a/starlite/contrib/sqlalchemy_1/config.py
+++ b/starlite/contrib/sqlalchemy_1/config.py
@@ -265,7 +265,7 @@ def session_maker(self) -> sessionmaker:
             )
         return cast("sessionmaker", self.session_maker_instance)
 
-    def create_db_session_dependency(self, state: State, scope: Scope) -> Union[Session, AsyncSession]:  # noqa
+    def create_db_session_dependency(self, state: State, scope: Scope) -> Union[Session, AsyncSession]:  # noqa: F821
         """Create a session instance.
 
         Args:


Test patch:
Repository: litestar-org/litestar

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


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
diff --git a/starlite/contrib/sqlalchemy_1/plugin.py b/starlite/contrib/sqlalchemy_1/plugin.py
--- a/starlite/contrib/sqlalchemy_1/plugin.py
+++ b/starlite/contrib/sqlalchemy_1/plugin.py
@@ -223,6 +223,8 @@ def providers_map(self) -> Dict[Type[TypeEngine], Callable[[Union[TypeEngine, Ty
             sqlalchemy_type.TupleType: self.handle_tuple_type,  # pyright: ignore
             sqlalchemy_type.Unicode: self.handle_string_type,
             sqlalchemy_type.UnicodeText: self.handle_string_type,
+            sqlalchemy_type.Uuid: lambda x: UUID,
+            sqlalchemy_type.UUID: lambda x: UUID,
             sqlalchemy_type.VARBINARY: self.handle_string_type,
             sqlalchemy_type.VARCHAR: self.handle_string_type,
             # mssql


Test patch:
Repository: litestar-org/litestar

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


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
diff --git a/starlite/openapi/controller.py b/starlite/openapi/controller.py
--- a/starlite/openapi/controller.py
+++ b/starlite/openapi/controller.py
@@ -332,7 +332,7 @@ def render_swagger_ui(self, request: Request) -> str:
             <div id='swagger-container'/>
             <script type="text/javascript">
             const ui = SwaggerUIBundle({{
-                spec: JSON.parse({self._dumped_modified_schema}),
+                spec: {self._dumped_modified_schema},
                 dom_id: '#swagger-container',
                 deepLinking: true,
                 showExtensions: true,
@@ -442,7 +442,7 @@ def render_redoc(self, request: Request) -> str:  # pragma: no cover
             <div id='redoc-container'/>
             <script type="text/javascript">
                 Redoc.init(
-                    JSON.parse({self._dumped_schema}),
+                    {self._dumped_schema},
                     undefined,
                     document.getElementById('redoc-container')
                 )


Test patch:
Repository: litestar-org/litestar

Issue:
Bug: msgspec version needs updating
### Description

Starlite currently needs msgspec >= 0.11.0 from here https://github.com/starlite-api/starlite/blob/8a49aff754d5b409397183eb395cac5a44193d72/pyproject.toml#L52.

Starlite uses msgspec.inspect:
https://github.com/starlite-api/starlite/blob/41089a2d5dff696a25c78a58322d3a8a08ebcac3/starlite/constants.py#L3

msgspec.inspect wasn't introduced in msgspec until 0.12.0:
https://github.com/jcrist/msgspec/releases/tag/0.12.0

### URL to code causing the issue

_No response_

### MCVE

_No response_

### Steps to reproduce

```bash
1. In a new environment, pip install starlite msgspec==0.11.0
2. Try to import starlite
```


### Screenshots

_No response_

### Logs

_No response_

### Starlite Version

1.51.7

### Platform

- [ ] Linux
- [ ] Mac
- [ ] Windows
- [ ] Other (Please specify in the description above)


Discussion:

Resolving patch:
diff --git a/starlite/constants.py b/starlite/constants.py
--- a/starlite/constants.py
+++ b/starlite/constants.py
@@ -1,6 +1,5 @@
 from inspect import Signature
 
-from msgspec.inspect import UNSET
 from pydantic.fields import Undefined
 
 from starlite.types import Empty
@@ -15,5 +14,5 @@
 SCOPE_STATE_DEPENDENCY_CACHE = "dependency_cache"
 SCOPE_STATE_NAMESPACE = "__starlite__"
 SCOPE_STATE_RESPONSE_COMPRESSED = "response_compressed"
-UNDEFINED_SENTINELS = {Undefined, Signature.empty, UNSET, Empty, Ellipsis}
+UNDEFINED_SENTINELS = {Undefined, Signature.empty, Empty, Ellipsis}
 SKIP_VALIDATION_NAMES = {"request", "socket", "scope", "receive", "send"}


Test patch:
Repository: litestar-org/litestar

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


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
diff --git a/starlite/events/emitter.py b/starlite/events/emitter.py
--- a/starlite/events/emitter.py
+++ b/starlite/events/emitter.py
@@ -93,7 +93,7 @@ async def _worker(self) -> None:
         """
         while self._queue:
             fn, args, kwargs = await self._queue.get()
-            await fn(*args, *kwargs)
+            await fn(*args, **kwargs)
             self._queue.task_done()
 
     async def on_startup(self) -> None:


Test patch:
diff --git a/tests/events/test_listener.py b/tests/events/test_listener.py
--- a/tests/events/test_listener.py
+++ b/tests/events/test_listener.py
@@ -38,17 +38,15 @@ async def listener_fn(*args: Any, **kwargs: Any) -> None:
 
 @pytest.mark.parametrize("listener", [lazy_fixture("sync_listener"), lazy_fixture("async_listener")])
 def test_event_listener(mock: MagicMock, listener: EventListener) -> None:
-    test_value = {"key": "123"}
-
     @get("/")
     def route_handler(request: Request[Any, Any, Any]) -> None:
-        request.app.emit("test_event", test_value)
+        request.app.emit("test_event", "positional", keyword="keyword-value")
 
     with create_test_client(route_handlers=[route_handler], listeners=[listener]) as client:
         response = client.get("/")
         assert response.status_code == HTTP_200_OK
         sleep(0.01)
-        mock.assert_called_with(test_value)
+        mock.assert_called_with("positional", keyword="keyword-value")
 
 
 async def test_shutdown_awaits_pending(async_listener: EventListener, mock: MagicMock) -> None:
Repository: litestar-org/litestar

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


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
diff --git a/starlite/_signature/utils.py b/starlite/_signature/utils.py
--- a/starlite/_signature/utils.py
+++ b/starlite/_signature/utils.py
@@ -75,4 +75,4 @@ def get_fn_type_hints(fn: Any, namespace: dict[str, Any] | None = None) -> dict[
         **vars(sys.modules[fn_to_inspect.__module__]),
         **(namespace or {}),
     }
-    return get_type_hints(fn_to_inspect, globalns=namespace)
+    return get_type_hints(fn_to_inspect, globalns=namespace, include_extras=True)


Test patch:
diff --git a/tests/signature/test_parsing.py b/tests/signature/test_parsing.py
--- a/tests/signature/test_parsing.py
+++ b/tests/signature/test_parsing.py
@@ -4,10 +4,11 @@
 
 import pytest
 from pydantic import BaseModel
+from typing_extensions import Annotated
 
 from starlite import get
 from starlite._signature import create_signature_model
-from starlite._signature.parsing import ParsedSignatureParameter
+from starlite._signature.parsing import ParsedSignatureParameter, parse_fn_signature
 from starlite.di import Provide
 from starlite.exceptions import ImproperlyConfiguredException, ValidationException
 from starlite.params import Dependency, Parameter
@@ -228,3 +229,20 @@ def func(a: "int") -> None:
     obj = object()
     parsed_param = ParsedSignatureParameter.from_parameter("func", "a", signature.parameters["a"], {"a": obj})
     assert parsed_param.annotation is obj
+
+
+@pytest.mark.parametrize("with_future_annotations", [True, False])
+def test_parsed_parameters_with_annotated_types(
+    with_future_annotations: bool, create_module: "Callable[[str], ModuleType]"
+) -> None:
+    module = create_module(
+        f"""
+{'from __future__ import annotations' if with_future_annotations else ''}
+from typing_extensions import Annotated
+
+def fn(a: Annotated[int, "a"]) -> None:
+    pass
+"""
+    )
+    (param, *_), _, __, ___ = parse_fn_signature(module.fn, [], set(), {})
+    assert param.annotation == Annotated[int, "a"]
Repository: litestar-org/litestar

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


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
diff --git a/starlite/contrib/sqlalchemy_1/plugin.py b/starlite/contrib/sqlalchemy_1/plugin.py
--- a/starlite/contrib/sqlalchemy_1/plugin.py
+++ b/starlite/contrib/sqlalchemy_1/plugin.py
@@ -223,8 +223,6 @@ def providers_map(self) -> Dict[Type[TypeEngine], Callable[[Union[TypeEngine, Ty
             sqlalchemy_type.TupleType: self.handle_tuple_type,  # pyright: ignore
             sqlalchemy_type.Unicode: self.handle_string_type,
             sqlalchemy_type.UnicodeText: self.handle_string_type,
-            sqlalchemy_type.Uuid: lambda x: UUID,
-            sqlalchemy_type.UUID: lambda x: UUID,
             sqlalchemy_type.VARBINARY: self.handle_string_type,
             sqlalchemy_type.VARCHAR: self.handle_string_type,
             # mssql


Test patch:
Repository: litestar-org/litestar

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


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
diff --git a/starlite/contrib/sqlalchemy/init_plugin/config/common.py b/starlite/contrib/sqlalchemy/init_plugin/config/common.py
--- a/starlite/contrib/sqlalchemy/init_plugin/config/common.py
+++ b/starlite/contrib/sqlalchemy/init_plugin/config/common.py
@@ -239,3 +239,11 @@ def create_app_state_items(self) -> dict[str, Any]:
             self.engine_app_state_key: self.create_engine(),
             self.session_maker_app_state_key: self.create_session_maker(),
         }
+
+    def update_app_state(self, state: State) -> None:
+        """Set the app state with engine and session.
+
+        Args:
+            state: The ``Starlite.state`` instance.
+        """
+        state.update(self.create_app_state_items())
diff --git a/starlite/contrib/sqlalchemy/init_plugin/plugin.py b/starlite/contrib/sqlalchemy/init_plugin/plugin.py
--- a/starlite/contrib/sqlalchemy/init_plugin/plugin.py
+++ b/starlite/contrib/sqlalchemy/init_plugin/plugin.py
@@ -39,7 +39,7 @@ def on_app_init(self, app_config: AppConfig) -> AppConfig:
             }
         )
         app_config.before_send.append(self._config.before_send_handler)
+        app_config.on_startup.append(self._config.update_app_state)
         app_config.on_shutdown.append(self._config.on_shutdown)
-        app_config.state.update(self._config.create_app_state_items())
         app_config.signature_namespace.update(self._config.signature_namespace)
         return app_config


Test patch:
Repository: litestar-org/litestar

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


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
diff --git a/litestar/app.py b/litestar/app.py
--- a/litestar/app.py
+++ b/litestar/app.py
@@ -348,7 +348,7 @@ def __init__(
             opt=dict(opt or {}),
             parameters=parameters or {},
             plugins=list(plugins or []),
-            preferred_validation_backend=preferred_validation_backend or "attrs",
+            preferred_validation_backend=preferred_validation_backend or "pydantic",
             request_class=request_class,
             response_cache_config=response_cache_config or ResponseCacheConfig(),
             response_class=response_class,


Test patch:
Repository: litestar-org/litestar

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


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
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 @@ def run_command(
     """
 
     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")


Test patch: