nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: manusa/electronim
Pull request #402 (2024-05-14 07:21:46)

🐛 support new OpenAI ChatGPT OAuth subdomains

sonarcloud[bot]: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=manusa_electronim&pullRequest=402) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=manusa_electronim&pullRequest=402&resolved=false&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/component_measures?id=manusa_electronim&pullRequest=402&metric=new_accepted_issues&view=list)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=manusa_electronim&pullRequest=402&resolved=false&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/no-data-16px.png '') No data about Coverage  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=manusa_electronim&pullRequest=402&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=manusa_electronim&pullRequest=402)



Patch:
diff --git a/src/tab-manager/redirect.js b/src/tab-manager/redirect.js
index c22b2bb..6cec087 100644
--- a/src/tab-manager/redirect.js
+++ b/src/tab-manager/redirect.js
@@ -28,6 +28,7 @@ const isOAuth = matchUrls([
   /^https:\/\/account\.live\.com\/.*/, // NOSONAR
   /^https:\/\/login\.live\.com\/.*/, // NOSONAR
   /^https:\/\/login\.microsoftonline\.com\/.*/, // NOSONAR
+  /^https:\/\/auth\.openai\.com\/.*/, // NOSONAR
   /^https:\/\/auth0\.openai\.com\/.*/, // NOSONAR
   /^https:\/\/auth\.redhat\.com\/auth\/.*/, // NOSONAR
   /^https:\/\/sso\.secureserver\.net\/.*/, // NOSONAR


Test patch:
diff --git a/src/tab-manager/__tests__/redirect.test.js b/src/tab-manager/__tests__/redirect.test.js
index 6341155..48115de 100644
--- a/src/tab-manager/__tests__/redirect.test.js
+++ b/src/tab-manager/__tests__/redirect.test.js
@@ -119,12 +119,12 @@ describe('Tab Manager Redirect module test suite', () => {
       });
     });
     describe('OpenAI OAuth', () => {
-      test('From Slack to OAuth, should return false', () => {
+      test.each(['auth0', 'auth'])('From Slack to OAuth (%s), should return false', subdomain => {
         // Given
         mockBrowserViewUrl = 'https://alberto.slack.com';
         // When
         const result = redirect.shouldOpenInExternalBrowser(mockBrowserView,
-          new URL('https://auth0.openai.com/u/login/identifier?state=1337'));
+          new URL(`https://${subdomain}.openai.com/u/login/identifier?state=1337`));
         // Then
         expect(result).toBe(false);
       });
Repository: osbuild/osbuild
Pull request #1538 (2024-01-16 13:58:38)

stages/org.osbuild.mkfs.ext4: add ext4 options
Add optional flags to the org.osbuild.mkfs.ext4 stage enabling/disabling the metadata_csum_seed and orphan_file features.

dustymabe: Enabled auto merge since @mvo5 previously approved this PR and the most recent push was to implement an optional suggestion for test improvement. 

Patch:
diff --git a/stages/org.osbuild.mkfs.ext4 b/stages/org.osbuild.mkfs.ext4
index d88ae23a..697691ad 100755
--- a/stages/org.osbuild.mkfs.ext4
+++ b/stages/org.osbuild.mkfs.ext4
@@ -38,6 +38,14 @@ SCHEMA_2 = r"""
       "type": "string",
       "maxLength": 16
     },
+    "metadata_csum_seed": {
+      "description": "Enable metadata_csum_seed support",
+      "type": "boolean"
+    },
+    "orphan_file": {
+      "description": "Enable orphan_file support",
+      "type": "boolean"
+    },
     "verity": {
       "description": "Enable fs-verity support",
       "type": "boolean"
@@ -52,17 +60,18 @@ def main(devices, options):
 
     uuid = options["uuid"]
     label = options.get("label")
-    verity = options.get("verity")
     opts = []
 
     if label:
         opts = ["-L", label]
 
-    if verity is not None:
-        if verity:
-            opts += ["-O", "verity"]
-        else:
-            opts += ["-O", "^verity"]
+    for fsopt in ["verity", "orphan_file", "metadata_csum_seed"]:
+        val = options.get(fsopt)
+        if val is not None:
+            if val:
+                opts += ["-O", fsopt]
+            else:
+                opts += ["-O", f"^{fsopt}"]
 
     subprocess.run(["mkfs.ext4", "-U", uuid] + opts + [device],
                    encoding='utf8', check=True)


Test patch:
diff --git a/stages/test/test_mkfs_ext4.py b/stages/test/test_mkfs_ext4.py
index 0c0ea2f0..e807272c 100644
--- a/stages/test/test_mkfs_ext4.py
+++ b/stages/test/test_mkfs_ext4.py
@@ -82,6 +82,11 @@ def test_mkfs_ext4_integration(tmp_path):
     ({}, []),
     ({"verity": True}, ["-O", "verity"]),
     ({"verity": False}, ["-O", "^verity"]),
+    ({"orphan_file": True}, ["-O", "orphan_file"]),
+    ({"orphan_file": False}, ["-O", "^orphan_file"]),
+    ({"metadata_csum_seed": True}, ["-O", "metadata_csum_seed"]),
+    ({"metadata_csum_seed": False}, ["-O", "^metadata_csum_seed"]),
+    ({"verity": True, "orphan_file": True, "metadata_csum_seed": True}, ["-O", "verity", "-O", "orphan_file", "-O", "metadata_csum_seed"]),
 ])
 @mock.patch("subprocess.run")
 def test_mkfs_ext4_cmdline(mock_run, test_input, expected):
Repository: osbuild/osbuild
Pull request #1593 (2024-02-15 12:40:52)

stages/bootc.install-to-fs: fix root mount handling
The bootc.install-to-filesystem code needs to run against the root directory of a mounted tree, i.e. with /boot, /boot/efi mounted. So change the code so that the target dir is the the "mounts" paths. This is similar to how bootupd works and the caller need to arrange the right mount setup there.

This was discovered during the final end-to-end work of osbuild+images+bib


Patch:
diff --git a/stages/org.osbuild.bootc.install-to-filesystem b/stages/org.osbuild.bootc.install-to-filesystem
index 6b8c376a..19ca4d69 100755
--- a/stages/org.osbuild.bootc.install-to-filesystem
+++ b/stages/org.osbuild.bootc.install-to-filesystem
@@ -2,7 +2,9 @@
 """Run bootc install to-filesystem
 
 Note that this needs the disk.img in the inputs as one continous
-devices so that bootupd can install grub to the mbr.
+devices so that bootupd can install grub to the mbr. It also needs
+all relevant mount points for booting (e.g. /boot, /boot/efi) in
+mounted in the "mounts" path.
 
 Buildhost commands used: bootc
 """
@@ -40,23 +42,23 @@ SCHEMA_2 = r"""
 """
 
 
-def main(inputs, mounts):
+def main(inputs, paths):
     images = containers.parse_containers_input(inputs)
     assert len(images) == 1
     image = list(images.values())[0]
 
     with containers.container_source(image) as (_, source):
-        dst = mounts["root"]["path"]
+        dst = paths["mounts"]
         subprocess.run(
             ["bootc", "install", "to-filesystem",
              "--source-imgref", source,
              "--skip-fetch-check", "--generic-image",
              dst],
-            check=True
+            check=True,
         )
 
 
 if __name__ == "__main__":
     args = osbuild.api.arguments()
-    r = main(args["inputs"], args["mounts"])
+    r = main(args["inputs"], args["paths"])
     sys.exit(r)


Test patch:
diff --git a/stages/test/test_bootc_install_to_fs.py b/stages/test/test_bootc_install_to_fs.py
index a87d7139..4d424aa8 100644
--- a/stages/test/test_bootc_install_to_fs.py
+++ b/stages/test/test_bootc_install_to_fs.py
@@ -25,22 +25,20 @@ def test_bootc_install_to_fs(mock_run, tmp_path):
             },
         },
     }
-    mounts = {
-        "root": {
-            "path": "/path/to/root",
-        },
+    paths = {
+        "mounts": "/path/to/mounts",
     }
 
     @contextmanager
     def faked_tmp_dir():
         yield tmp_path
     with patch("tempfile.TemporaryDirectory", side_effect=faked_tmp_dir):
-        stage.main(inputs, mounts)
+        stage.main(inputs, paths)
 
     assert len(mock_run.call_args_list) == 1
     assert mock_run.call_args_list == [
         call(["bootc", "install", "to-filesystem",
               "--source-imgref", f"oci-archive:{tmp_path}/image",
               "--skip-fetch-check", "--generic-image",
-              "/path/to/root"], check=True)
+              "/path/to/mounts"], check=True)
     ]
Repository: osbuild/osbuild
Pull request #1614 (2024-02-26 21:13:42)

stages/org.osbuild.tar: add sparse option
Add a sparse option to the tar stage which make files in the archive sparse if they are sparse on disk. This is needed for CoreOS Assember.


Patch:
diff --git a/stages/org.osbuild.tar b/stages/org.osbuild.tar
index 4068c551..2c53e637 100755
--- a/stages/org.osbuild.tar
+++ b/stages/org.osbuild.tar
@@ -82,6 +82,11 @@ SCHEMA_2 = """
         "type": "string",
         "description": "If specified, the archive will only contain the specified paths, in the specified order"
       }
+    },
+    "sparse": {
+      "description": "Make archive files sparse",
+      "type": "boolean",
+      "default": false
     }
   }
 },
@@ -113,7 +118,7 @@ def main(inputs, output_dir, options):
         "XZ_OPT": "--threads 0"
     }
 
-    # SELinux context, ACLs and extended attributes
+    # SELinux context, ACLs, extended attributes, and sparse
     if options.get("acls", True):
         extra_args += ["--acls"]
 
@@ -123,6 +128,9 @@ def main(inputs, output_dir, options):
     if options.get("xattrs", True):
         extra_args += ["--xattrs", "--xattrs-include", "*"]
 
+    if options.get("sparse", False):
+        extra_args += ["--sparse"]
+
     # Set up the tar command.
     tar_cmd = [
         "tar",


Test patch:
diff --git a/stages/test/test_tar.py b/stages/test/test_tar.py
index 6a988a69..10db07ab 100644
--- a/stages/test/test_tar.py
+++ b/stages/test/test_tar.py
@@ -22,6 +22,7 @@ STAGE_NAME = "org.osbuild.tar"
     # good
     ({"filename": "out.tar", "root-node": "include"}, ""),
     ({"filename": "out.tar", "paths": ["file1"]}, ""),
+    ({"filename": "out.tar", "sparse": True}, ""),
     ({"filename": "out.tar"}, ""),
 ])
 def test_schema_validation_tar(stage_schema, test_data, expected_err):
Repository: zulip/zulip-terminal
Pull request #1438 (2023-11-07 16:51:10)

docs: Add Alacritty to successfully run terminal list
<!-- See README for documentation, or ask in #zulip-terminal if unclear -->
### What does this PR do, and why?
Add Alaccrity to the successfully run terminal emulators list. Ive encountered no issue after using it for a month with Alaccrity


neiljp: @laomuon Thanks for the feedback :+1: Adjusted text slightly, and will merge shortly :)

Patch:
diff --git a/docs/FAQ.md b/docs/FAQ.md
index b750188..b147444 100644
--- a/docs/FAQ.md
+++ b/docs/FAQ.md
@@ -106,6 +106,7 @@ We have reports of success on the following terminal emulators:
 * Terminator (https://github.com/gnome-terminator/terminator)
 * iterm2 (https://iterm2.com/) **Mac only**
 * mosh (https://mosh.org/)
+* Alaccrity (https://github.com/alacritty/alacritty)
 
 Issues have been reported with the following:
 
diff --git a/zulipterminal/core.py b/zulipterminal/core.py
index 2799210..ddc7e89 100644
--- a/zulipterminal/core.py
+++ b/zulipterminal/core.py
@@ -307,6 +307,7 @@ class Controller:
                 notify_enabled=self.notify_enabled,
                 autohide_enabled=self.autohide,
                 maximum_footlinks=self.maximum_footlinks,
+                exit_confirmation_enabled=self.exit_confirmation,
             ),
             "area:help",
         )
diff --git a/zulipterminal/ui_tools/views.py b/zulipterminal/ui_tools/views.py
index 463478b..fcb1164 100644
--- a/zulipterminal/ui_tools/views.py
+++ b/zulipterminal/ui_tools/views.py
@@ -1086,6 +1086,7 @@ class AboutView(PopUpView):
         autohide_enabled: bool,
         maximum_footlinks: int,
         notify_enabled: bool,
+        exit_confirmation_enabled: bool,
     ) -> None:
         self.feature_level_content = (
             [("Feature level", str(server_feature_level))]
@@ -1103,6 +1104,10 @@ class AboutView(PopUpView):
                     ("Maximum footlinks", str(maximum_footlinks)),
                     ("Color depth", str(color_depth)),
                     ("Notifications", "enabled" if notify_enabled else "disabled"),
+                    (
+                        "Exit confirmation",
+                        "enabled" if exit_confirmation_enabled else "disabled",
+                    ),
                 ],
             ),
             (


Test patch:
diff --git a/tests/ui_tools/test_popups.py b/tests/ui_tools/test_popups.py
index e525397..be9ee49 100644
--- a/tests/ui_tools/test_popups.py
+++ b/tests/ui_tools/test_popups.py
@@ -200,6 +200,7 @@ class TestAboutView:
             notify_enabled=False,
             autohide_enabled=False,
             maximum_footlinks=3,
+            exit_confirmation_enabled=False,
         )
 
     @pytest.mark.parametrize(
@@ -241,6 +242,7 @@ class TestAboutView:
             notify_enabled=False,
             autohide_enabled=False,
             maximum_footlinks=3,
+            exit_confirmation_enabled=False,
         )
 
         assert len(about_view.feature_level_content) == (
Repository: reagento/dishka
Pull request #121 (2024-04-02 20:57:58)

fix protocol init handling


Patch:
diff --git a/src/dishka/dependency_source/make_factory.py b/src/dishka/dependency_source/make_factory.py
index 6c9c9fd..9e1537b 100644
--- a/src/dishka/dependency_source/make_factory.py
+++ b/src/dishka/dependency_source/make_factory.py
@@ -20,6 +20,7 @@ from inspect import (
 )
 from typing import (
     Any,
+    Protocol,
     get_args,
     get_origin,
     get_type_hints,
@@ -43,6 +44,7 @@ from .factory import Factory, FactoryType
 from .unpack_provides import unpack_factory
 
 _empty = signature(lambda a: 0).parameters["a"].annotation
+_protocol_init = type("_stub_proto", (Protocol,), {}).__init__
 
 
 def _is_bound_method(obj):
@@ -157,6 +159,8 @@ def _clean_result_hint(factory_type: FactoryType, possible_dependency: Any):
 def _params_without_hints(func, *, skip_self: bool) -> Sequence[str]:
     if func is object.__init__:
         return []
+    if func is _protocol_init:
+        return []
     params = signature(func).parameters
     return [
         p.name
@@ -200,15 +204,14 @@ def _make_factory_by_class(
     dependencies = list(hints.values())
     if not provides:
         provides = source
-    is_to_bind = False
-    factory_type = FactoryType.FACTORY
+
     return Factory(
         dependencies=hints_to_dependency_keys(dependencies),
-        type_=factory_type,
+        type_=FactoryType.FACTORY,
         source=source,
         scope=scope,
         provides=DependencyKey(provides, None),
-        is_to_bind=is_to_bind,
+        is_to_bind=False,
         cache=cache,
     )
 


Test patch:
diff --git a/tests/unit/test_provider.py b/tests/unit/test_provider.py
index d594392..d698670 100644
--- a/tests/unit/test_provider.py
+++ b/tests/unit/test_provider.py
@@ -1,4 +1,4 @@
-from typing import Any
+from typing import Any, Protocol
 
 import pytest
 
@@ -232,3 +232,18 @@ def test_provide_external_method():
     factory = foo.dependency_sources[0]
     assert factory.provides == hint_to_dependency_key(str)
     assert factory.dependencies == []
+
+
+def test_provide_protocol_impl():
+    class MyProto(Protocol):
+        pass
+
+    class MyImpl(MyProto):
+        pass
+
+    provider = Provider(scope=Scope.REQUEST)
+    impl = provider.provide(MyImpl)
+    assert len(impl.dependency_sources) == 1
+    factory = impl.dependency_sources[0]
+    assert factory.provides == hint_to_dependency_key(MyImpl)
+    assert factory.dependencies == []
Repository: reagento/dishka
Pull request #163 (2024-05-26 13:40:01)

add support join providers


Patch:
diff --git a/docs/provider/provide_all.rst b/docs/provider/provide_all.rst
index ce07443..30c13eb 100644
--- a/docs/provider/provide_all.rst
+++ b/docs/provider/provide_all.rst
@@ -28,4 +28,32 @@ It is also available as a method:
 .. code-block:: python
 
     provider = Provider(scope=Scope.APP)
-    provider.provide_all(ClassA, ClassB)
\ No newline at end of file
+    provider.provide_all(ClassA, ClassB)
+
+You can combine different ``provide``, ``alias``, ``decorate``, ``from_context``, ``provide_all``, ``from_context`` and others with each other without thinking about the variable names for each of them.
+
+These two providers are equal for the container
+
+.. code-block:: python
+
+    from dishka import alias, decorate, provide, provide_all, Provider, Scope
+
+    class OneByOne(Provider):
+        scope = Scope.APP
+
+        data = from_context(Data)
+        a = provide(A, provides=AProtocol)
+        b = provide(B, providesAProtocol)
+        b_alias = alias(source=C, provides=B)
+        c_decorate = decorate(CDecorator, provides=C)
+
+    class AllAtOnce(Provider):
+        scope = Scope.APP
+
+        provides = (
+            provide(A, provides=AProtocol)
+            + provide(B, provides=AProtocol)
+            + alias(source=C, provides=B)
+            + decorate(CDecorator, provides=C)
+            + from_context(Data)
+        )
\ No newline at end of file
diff --git a/src/dishka/dependency_source/composite.py b/src/dishka/dependency_source/composite.py
index 29825a3..b7024ff 100644
--- a/src/dishka/dependency_source/composite.py
+++ b/src/dishka/dependency_source/composite.py
@@ -37,6 +37,15 @@ class CompositeDependencySource:
     def __call__(self, *args, **kwargs) -> Any:
         return self.origin(*args, **kwargs)
 
+    def __add__(
+            self, other: "CompositeDependencySource",
+    ) -> "CompositeDependencySource":
+        dependency_sources = self.dependency_sources + other.dependency_sources
+        return CompositeDependencySource(
+            origin=None,
+            dependency_sources=dependency_sources,
+        )
+
 
 def ensure_composite(
         origin: Callable | CompositeDependencySource,


Test patch:
diff --git a/tests/unit/test_provider.py b/tests/unit/test_provider.py
index acf7ecb..40bb617 100644
--- a/tests/unit/test_provider.py
+++ b/tests/unit/test_provider.py
@@ -276,7 +276,17 @@ def test_provide_all_instance():
     assert provides == [A, B]
 
 
-def test_privde_random():
+def test_provide_random():
     source = provide(source=random, provides=float)
     assert len(source.dependency_sources) == 1
     assert not source.dependency_sources[0].dependencies
+
+
+def test_provide_join_provides_cls():
+    class MyProvider(Provider):
+        x = provide(A) + provide(B)
+
+    provider = MyProvider(scope=Scope.APP)
+    assert len(provider.factories) == 2
+    provides = [f.provides.type_hint for f in provider.factories]
+    assert provides == [A, B]
Repository: reagento/dishka
Pull request #169 (2024-06-09 08:23:56)

Skip not DI-related annotations
Rare case, but anyway we shouldn't call `None.component` if there's no DI-related annotation found


Patch:
diff --git a/docs/integrations/index.rst b/docs/integrations/index.rst
index 2c40551..427a19e 100644
--- a/docs/integrations/index.rst
+++ b/docs/integrations/index.rst
@@ -114,7 +114,7 @@ With some frameworks we provide an option to inject dependencies in handlers wit
 
     setup_dishka(container, app)
 
-* For **FastStream** (**0.5.0** version and higher) you need to provide ``auto_inject=True`` when calling ``setup_dishka``. E.g:
+* For **FasStream** (**0.5.0** version and higher) you need to provide ``auto_inject=True`` when calling ``setup_dishka``. E.g:
 
 .. code-block:: python
 
diff --git a/examples/integrations/aiogram_bot.py b/examples/integrations/aiogram_bot.py
index b8defb2..9792ab4 100644
--- a/examples/integrations/aiogram_bot.py
+++ b/examples/integrations/aiogram_bot.py
@@ -3,6 +3,7 @@ import logging
 import os
 import random
 from collections.abc import AsyncIterator
+from typing import Annotated
 
 from aiogram import Bot, Dispatcher, Router
 from aiogram.types import Message, TelegramObject, User
@@ -24,8 +25,8 @@ class MyProvider(Provider):
         yield random.randint(0, 10000)
 
     @provide(scope=Scope.REQUEST)
-    async def get_user(self, obj: TelegramObject) -> User:
-        return obj.from_user
+    async def get_name(self, request: TelegramObject) -> User:
+        return request.from_user
 
 
 # app
@@ -41,7 +42,7 @@ async def start(
     user: FromDishka[User],
     value: FromDishka[int],
 ):
-    await message.answer(f"Hello, {value}, {user.full_name}!")
+    await message.answer(f"Hello, {1}, {user.full_name}!")
 
 
 async def main():
diff --git a/src/dishka/entities/key.py b/src/dishka/entities/key.py
index 6cf96b6..a8e67c1 100644
--- a/src/dishka/entities/key.py
+++ b/src/dishka/entities/key.py
@@ -31,6 +31,8 @@ def hint_to_dependency_key(hint: Any) -> DependencyKey:
         (arg for arg in args if isinstance(arg, FromComponent)),
         None,
     )
+    if from_component is None:
+        return DependencyKey(args[0], None)
     return DependencyKey(args[0], from_component.component)
 
 


Test patch:
diff --git a/tests/unit/test_entities.py b/tests/unit/test_entities.py
new file mode 100644
index 0000000..216e5c0
--- /dev/null
+++ b/tests/unit/test_entities.py
@@ -0,0 +1,26 @@
+from typing import Annotated, Any
+
+import pytest
+
+from dishka.entities.key import FromComponent, hint_to_dependency_key
+
+
+class TestDependencyKey:
+    @pytest.mark.parametrize(
+        ("hint", "resolved_type", "component"),
+        [
+            (Any, Any, None),
+            (str, str, None),
+            (Annotated[str, {"foo": "bar"}], str, None),
+            (Annotated[str, FromComponent("baz")], str, "baz"),
+        ],
+    )
+    def test_hint_to_dependency_key(
+        self,
+        hint: Any,
+        resolved_type: Any,
+        component: str | None,
+    ):
+        key = hint_to_dependency_key(hint)
+        assert key.type_hint == resolved_type
+        assert key.component == component