internlm/SWE-Fixer-Train-110K huggingface dataset:
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/contrib/htmx/response.py b/litestar/contrib/htmx/response.py
--- a/litestar/contrib/htmx/response.py
+++ b/litestar/contrib/htmx/response.py
@@ -230,11 +230,7 @@ def to_response(
             )
         )
 
-        template = Template(
-            name=self.name,
-            background=self.background,
-            encoding=self.encoding,
-        )
+        template = Template(name=self.name, background=self.background, context=self.context, encoding=self.encoding)
 
         return template.to_response(
             headers=hx_headers, media_type=media_type, app=app, status_code=status_code, request=request


Test patch:
diff --git a/tests/contrib/htmx/test_htmx_response.py b/tests/contrib/htmx/test_htmx_response.py
--- a/tests/contrib/htmx/test_htmx_response.py
+++ b/tests/contrib/htmx/test_htmx_response.py
@@ -233,8 +233,16 @@ def handler() -> HXLocation:
 @pytest.mark.parametrize(
     "engine, template, expected",
     (
-        (JinjaTemplateEngine, "path: {{ request.scope['path'] }}", "path: /"),
-        (MakoTemplateEngine, "path: ${request.scope['path']}", "path: /"),
+        (
+            JinjaTemplateEngine,
+            "path: {{ request.scope['path'] }} custom_key: {{ custom_key }}",
+            "path: / custom_key: custom_value",
+        ),
+        (
+            MakoTemplateEngine,
+            "path: ${request.scope['path']} custom_key: ${custom_key}",
+            "path: / custom_key: custom_value",
+        ),
     ),
 )
 def test_HTMXTemplate_response_success(engine: Any, template: str, expected: str, template_dir: Path) -> None:
@@ -244,7 +252,7 @@ def test_HTMXTemplate_response_success(engine: Any, template: str, expected: str
     def handler() -> HTMXTemplate:
         return HTMXTemplate(
             name="abc.html",
-            context={"request": {"scope": {"path": "nope"}}},
+            context={"request": {"scope": {"path": "nope"}}, "custom_key": "custom_value"},
             push_url="/about",
             re_swap="beforebegin",
             re_target="#new-target-id",
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/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -152,18 +152,35 @@
     "extra_navbar_items": {
         "Documentation": "index",
         "Community": {
-            "Contribution Guide": "contribution-guide",
-            "Code of Conduct": "https://github.com/litestar-org/.github/blob/main/CODE_OF_CONDUCT.md",
+            "Contributing": {
+                "description": "Learn how to contribute to the Litestar project",
+                "link": "https://docs.litestar.dev/2/contribution-guide.html",
+                "icon": "contributing",
+            },
+            "Code of Conduct": {
+                "description": "Review the etiquette for interacting with the Litestar community",
+                "link": "https://github.com/litestar-org/.github/blob/main/CODE_OF_CONDUCT.md",
+                "icon": "coc",
+            },
         },
         "About": {
-            "Organization": "https://litestar.dev/about/organization",
-            "Releases": "https://litestar.dev/about/litestar-releases",
+            "Litestar Organization": {
+                "description": "Details about the Litestar organization",
+                "link": "about/organization",
+                "icon": "org",
+            },
+            "Releases": {
+                "description": "Details about the Litestar release process",
+                "link": "about/litestar-releases",
+                "icon": "releases",
+            },
         },
         "Release notes": {
             "2.0 migration guide": "release-notes/migration_guide_2",
             "2.x Changelog": "https://docs.litestar.dev/2/release-notes/changelog.html",
             "1.x Changelog": "https://docs.litestar.dev/1/release-notes/changelog.html",
         },
+        "Help": "https://github.com/orgs/litestar-org/discussions",
     },
 }
 


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/_signature/models/attrs_signature_model.py b/litestar/_signature/models/attrs_signature_model.py
--- a/litestar/_signature/models/attrs_signature_model.py
+++ b/litestar/_signature/models/attrs_signature_model.py
@@ -15,8 +15,6 @@
 from uuid import UUID
 
 from _decimal import Decimal
-from dateutil.parser import parse
-from pytimeparse.timeparse import timeparse
 from typing_extensions import get_args
 
 from litestar._signature.field import SignatureField
@@ -35,7 +33,17 @@
     import attrs
     import cattrs
 except ImportError as e:
-    raise MissingDependencyException("attrs is not installed") from e
+    raise MissingDependencyException("attrs") from e
+
+try:
+    from dateutil.parser import parse
+except ImportError as e:
+    raise MissingDependencyException("python-dateutil", "attrs") from e
+
+try:
+    from pytimeparse.timeparse import timeparse
+except ImportError as e:
+    raise MissingDependencyException("pytimeparse", "attrs") from e
 
 if TYPE_CHECKING:
     from litestar.plugins import PluginMapping


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/exceptions/base_exceptions.py b/litestar/exceptions/base_exceptions.py
--- a/litestar/exceptions/base_exceptions.py
+++ b/litestar/exceptions/base_exceptions.py
@@ -29,7 +29,7 @@ def __str__(self) -> str:
         return " ".join(self.args).strip()
 
 
-class MissingDependencyException(LitestarException):
+class MissingDependencyException(LitestarException, ImportError):
     """Missing optional dependency.
 
     This exception is raised only when a module depends on a dependency that has not been installed.


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
@@ -653,7 +653,7 @@ def url_for_static_asset(self, name: str, file_path: str) -> str:
             .. code-block: python
 
                 from litestar import Litestar
-                from litestar.config.static_files import StaticFilesConfig
+                from litestar.static_files.config import StaticFilesConfig
 
                 app = Litestar(
                     static_files_config=[StaticFilesConfig(directories=["css"], path="/static/css")]
diff --git a/litestar/middleware/logging.py b/litestar/middleware/logging.py
--- a/litestar/middleware/logging.py
+++ b/litestar/middleware/logging.py
@@ -340,7 +340,7 @@ def middleware(self) -> DefineMiddleware:
             .. code-block: python
 
                 from litestar import Litestar, Request, get
-                from litestar.config.logging import LoggingConfig
+                from litestar.logging import LoggingConfig
                 from litestar.middleware.logging import LoggingMiddlewareConfig
 
                 logging_config = LoggingConfig()


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/contrib/sqlalchemy/base.py b/litestar/contrib/sqlalchemy/base.py
--- a/litestar/contrib/sqlalchemy/base.py
+++ b/litestar/contrib/sqlalchemy/base.py
@@ -24,7 +24,15 @@
 if TYPE_CHECKING:
     from sqlalchemy.sql import FromClause
 
-__all__ = ("AuditBase", "AuditColumns", "Base", "CommonTableAttributes", "UUIDPrimaryKey", "touch_updated_timestamp")
+__all__ = (
+    "AuditBase",
+    "AuditColumns",
+    "Base",
+    "CommonTableAttributes",
+    "ModelProtocol",
+    "touch_updated_timestamp",
+    "UUIDPrimaryKey",
+)
 
 
 BaseT = TypeVar("BaseT", bound="Base")


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/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -64,7 +64,7 @@
 
 suppress_warnings = ["autosectionlabel.*"]
 
-html_theme = "starlite_sphinx_theme"
+html_theme = "litestar_sphinx_theme"
 html_static_path = ["_static"]
 html_js_files = ["versioning.js"]
 html_css_files = ["style.css"]
@@ -74,23 +74,41 @@
 
 html_theme_options = {
     "use_page_nav": False,
-    "github_repo_name": "starlite",
+    "github_repo_name": "litestar",
     "logo": {
-        "link": "https://starliteproject.dev",
+        "link": "https://litestar.dev",
     },
     "extra_navbar_items": {
         "Documentation": "index",
         "Community": {
-            "Contribution Guide": "contribution-guide",
-            "Code of Conduct": "https://github.com/starlite-api/.github/blob/main/CODE_OF_CONDUCT.md",
+            "Contributing": {
+                "description": "Learn how to contribute to the Litestar project",
+                "link": "https://docs.litestar.dev/2/contribution-guide.html",
+                "icon": "contributing",
+            },
+            "Code of Conduct": {
+                "description": "Review the etiquette for interacting with the Litestar community",
+                "link": "https://github.com/litestar-org/.github/blob/main/CODE_OF_CONDUCT.md",
+                "icon": "coc",
+            },
         },
         "About": {
-            "Organization": "https://starliteproject.dev/about/organization",
-            "Releases": "https://starliteproject.dev/about/starlite-releases",
+            "Litestar Organization": {
+                "description": "Details about the Litestar organization",
+                "link": "about/organization",
+                "icon": "org",
+            },
+            "Releases": {
+                "description": "Details about the Litestar release process",
+                "link": "about/litestar-releases",
+                "icon": "releases",
+            },
         },
         "Release notes": {
-            "1.x Changelog": "https://docs.starliteproject.dev/1/release-notes/changelog.html",
+            "2.x Changelog": "https://docs.litestar.dev/2/release-notes/changelog.html",
+            "1.x Changelog": "https://docs.litestar.dev/1/release-notes/changelog.html",
         },
+        "Help": "https://github.com/orgs/litestar-org/discussions",
     },
 }
 


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/connection/base.py b/litestar/connection/base.py
--- a/litestar/connection/base.py
+++ b/litestar/connection/base.py
@@ -287,7 +287,7 @@ def clear_session(self) -> None:
         """
         self.scope["session"] = Empty
 
-    def url_for(self, name: str, **path_parameters: dict[str, Any]) -> str:
+    def url_for(self, name: str, **path_parameters: Any) -> str:
         """Return the url for a given route handler name.
 
         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/tools/build_docs.py b/tools/build_docs.py
--- a/tools/build_docs.py
+++ b/tools/build_docs.py
@@ -27,6 +27,7 @@
 
 parser = argparse.ArgumentParser()
 parser.add_argument("--version", required=False)
+parser.add_argument("--ignore-missing-examples-output", action="store_true", default=False)
 parser.add_argument("output")
 
 
@@ -49,12 +50,15 @@ def load_version_spec() -> VersionSpec:
     return {"versions": [], "latest": ""}
 
 
-def build(output_dir: str, version: str | None) -> None:
+def build(output_dir: str, version: str | None, ignore_missing_output: bool) -> None:
     if version is None:
         version = importlib.metadata.version("litestar").rsplit(".")[0]
     else:
         os.environ["_LITESTAR_DOCS_BUILD_VERSION"] = version
 
+    if ignore_missing_output:
+        os.environ["_LITESTAR_DOCS_IGNORE_MISSING_EXAMPLE_OUTPUT"] = "1"
+
     subprocess.run(["make", "docs"], check=True)  # noqa: S603 S607
 
     output_dir = Path(output_dir)
@@ -83,7 +87,11 @@ def build(output_dir: str, version: str | None) -> None:
 
 def main() -> None:
     args = parser.parse_args()
-    build(output_dir=args.output, version=args.version)
+    build(
+        output_dir=args.output,
+        version=args.version,
+        ignore_missing_output=args.ignore_missing_output,
+    )
 
 
 if __name__ == "__main__":
diff --git a/tools/sphinx_ext/run_examples.py b/tools/sphinx_ext/run_examples.py
--- a/tools/sphinx_ext/run_examples.py
+++ b/tools/sphinx_ext/run_examples.py
@@ -34,6 +34,8 @@
 
 logger = logging.getLogger("sphinx")
 
+ignore_missing_output = os.getenv("_LITESTAR_DOCS_IGNORE_MISSING_EXAMPLE_OUTPUT", "") == "1"
+
 
 def _load_app_from_path(path: Path) -> Litestar:
     module = importlib.import_module(str(path.with_suffix("")).replace("/", "."))
@@ -115,7 +117,9 @@ def exec_examples(app_file: Path, run_configs: list[list[str]]) -> str:
             )
             stdout = proc.stdout.splitlines()
             if not stdout:
-                logger.error(f"Example: {app_file}:{args} yielded no results")
+                logger.debug(proc.stderr)
+                if not ignore_missing_output:
+                    logger.error(f"Example: {app_file}:{args} yielded no results")
                 continue
 
             result = "\n".join(line for line in ("> " + (" ".join(clean_args)), *stdout))


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/tools/build_docs.py b/tools/build_docs.py
--- a/tools/build_docs.py
+++ b/tools/build_docs.py
@@ -90,7 +90,7 @@ def main() -> None:
     build(
         output_dir=args.output,
         version=args.version,
-        ignore_missing_output=args.ignore_missing_output,
+        ignore_missing_output=args.ignore_missing_examples_output,
     )
 
 


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/contrib/repository/filters.py b/litestar/contrib/repository/filters.py
--- a/litestar/contrib/repository/filters.py
+++ b/litestar/contrib/repository/filters.py
@@ -1,13 +1,10 @@
 """Collection filter datastructures."""
 from __future__ import annotations
 
+from collections import abc  # noqa: TCH003
 from dataclasses import dataclass
 from datetime import datetime  # noqa: TCH003
-from typing import TYPE_CHECKING, Generic, Literal, TypeVar
-
-if TYPE_CHECKING:
-    from collections import abc
-
+from typing import Generic, Literal, TypeVar
 
 T = TypeVar("T")
 


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/contrib/sqlalchemy/types.py b/litestar/contrib/sqlalchemy/types.py
--- a/litestar/contrib/sqlalchemy/types.py
+++ b/litestar/contrib/sqlalchemy/types.py
@@ -35,7 +35,7 @@ class GUID(TypeDecorator):
     cache_ok = True
     python_type = type(uuid.UUID)
 
-    def __init__(self, binary: bool = True) -> None:
+    def __init__(self, *args: Any, binary: bool = True, **kwargs: Any) -> None:
         self.binary = binary
 
     def load_dialect_impl(self, dialect: Dialect) -> Any:
@@ -75,13 +75,8 @@ def to_uuid(value: Any) -> uuid.UUID | None:
         return cast("uuid.UUID | None", value)
 
 
-class JSON(_JSON):
-    """Platform-independent JSON type.
+JSON = _JSON().with_variant(PG_JSONB, "postgresql")
+"""Platform-independent JSON type.
 
     Uses JSONB type for postgres, otherwise uses the generic JSON data type.
-    """
-
-    def load_dialect_impl(self, dialect: Dialect) -> Any:
-        if dialect.name == "postgresql":
-            return dialect.type_descriptor(PG_JSONB())  # type: ignore[no-untyped-call]
-        return dialect.type_descriptor(_JSON())
+"""


Test patch: