nebius/SWE-bench-extra huggingface dataset:
Repository: dwavesystems/dimod

Issue:
Add fix_variables (fix multiple variables at once)
**Application**
For example, given a multiplication circuit CSP, I'd like to do this:

```
In [142]: bqm.fix_variables({'a0': 1, 'a1': 0, 'a2': 1, 'b0': 1, 'b1': 1, 'b2': 0})
```

Instead of this:

```
In [142]: bqm.fix_variable('a0', 1)
In [143]: bqm.fix_variable('a1', 0)
In [144]: bqm.fix_variable('a2', 1)
In [145]: bqm.fix_variable('b0', 1)
In [146]: bqm.fix_variable('b1', 1)
In [147]: bqm.fix_variable('b2', 0)
```

**Proposed Solution**
Enable fixing multiple variables in a single command.

**Alternatives Considered**
Using fix_variables multiple times.

**Additional Context**
I think there are lots of situation where users will fix multiple variables and would like to manipulate the values using dicts.


Comments:

Patch:
diff --git a/dimod/binary_quadratic_model.py b/dimod/binary_quadratic_model.py
index f6121123..28996cd9 100644
--- a/dimod/binary_quadratic_model.py
+++ b/dimod/binary_quadratic_model.py
@@ -981,6 +981,22 @@ class BinaryQuadraticModel(abc.Sized, abc.Container, abc.Iterable):
         self.add_offset(value * linear[v])
         self.remove_variable(v)
 
+    def fix_variables(self, fixed):
+        """Fix the value of the variables and remove it from a binary quadratic model.
+
+        Args:
+            fixed (dict):
+                A dictionary of variable assignments.
+
+        Examples:
+            >>> bqm = dimod.BinaryQuadraticModel({'a': -.5, 'b': 0., 'c': 5}, {('a', 'b'): -1}, 0.0, dimod.SPIN)
+            >>> bqm.fix_variables({'a': -1, 'b': +1})
+
+        """
+        for v, val in fixed.items():
+            self.fix_variable(v, val)
+
+
     def flip_variable(self, v):
         """Flip variable v in a binary quadratic model.
 
diff --git a/docs/reference/binary_quadratic_model.rst b/docs/reference/binary_quadratic_model.rst
index 882831e2..76150d8e 100644
--- a/docs/reference/binary_quadratic_model.rst
+++ b/docs/reference/binary_quadratic_model.rst
@@ -59,6 +59,7 @@ Transformations
 
    BinaryQuadraticModel.contract_variables
    BinaryQuadraticModel.fix_variable
+   BinaryQuadraticModel.fix_variables
    BinaryQuadraticModel.flip_variable
    BinaryQuadraticModel.relabel_variables
    BinaryQuadraticModel.scale


Test patch:
diff --git a/tests/test_binary_quadratic_model.py b/tests/test_binary_quadratic_model.py
index b43d8e27..7442c21a 100644
--- a/tests/test_binary_quadratic_model.py
+++ b/tests/test_binary_quadratic_model.py
@@ -757,6 +757,11 @@ class TestBinaryQuadraticModel(unittest.TestCase):
         self.assertConsistentBQM(bqm)
         self.assertEqual(bqm, dimod.BinaryQuadraticModel({0: -1, 1: 1}, {(0, 1): -1.}, .5, dimod.SPIN))
 
+    def test_fix_variables(self):
+        bqm = dimod.BinaryQuadraticModel({'a': .3}, {('a', 'b'): -1}, 1.2, dimod.SPIN)
+        bqm.fix_variables({'a': -1, 'b': +1})
+
+
     def test_fix_variable(self):
         # spin model, fix variable to +1
         bqm = dimod.BinaryQuadraticModel({'a': .3}, {('a', 'b'): -1}, 1.2, dimod.SPIN)
Repository: dwavesystems/dwave-cloud-client

Issue:
Expose lower_noise solver property
Create a derived property based on solver `tags`.

Comments:

Patch:
diff --git a/dwave/cloud/solver.py b/dwave/cloud/solver.py
index 35b6221..d04eeec 100644
--- a/dwave/cloud/solver.py
+++ b/dwave/cloud/solver.py
@@ -143,7 +143,8 @@ class Solver(object):
 
         # Derived solver properties (not present in solver data properties dict)
         self.derived_properties = {
-            'qpu', 'software', 'online', 'num_active_qubits', 'avg_load', 'name'
+            'qpu', 'software', 'online', 'num_active_qubits', 'avg_load', 'name',
+            'lower_noise'
         }
 
     def __repr__(self):
@@ -219,6 +220,10 @@ class Solver(object):
         "Nominal number of qubits on chip (includes active AND inactive)."
         return self.properties.get('num_qubits')
 
+    @property
+    def lower_noise(self):
+        return "lower_noise" in self.properties.get("tags", [])
+
     def max_num_reads(self, **params):
         """Returns the maximum number of reads for the given solver parameters.
 


Test patch:
diff --git a/tests/test_client.py b/tests/test_client.py
index f6c3a75..009e167 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -250,7 +250,8 @@ class FeatureBasedSolverSelection(unittest.TestCase):
                 "topology": {
                     "type": "chimera",
                     "shape": [16, 16, 4]
-                }
+                },
+                "tags": ["lower_noise"]
             },
             "id": "solver1",
             "description": "A test solver 1",
@@ -293,7 +294,8 @@ class FeatureBasedSolverSelection(unittest.TestCase):
                 # the following are only present in this solver
                 "some_set": [1, 2],
                 "some_range": [1, 2],
-                "some_string": "x"
+                "some_string": "x",
+                "tags": ["tag"]
             },
             "id": "c4-sw_solver3",
             "description": "A test of software solver",
@@ -339,6 +341,10 @@ class FeatureBasedSolverSelection(unittest.TestCase):
         self.assertSolvers(self.client.get_solvers(num_active_qubits=2), [self.solver3])
         self.assertSolvers(self.client.get_solvers(num_active_qubits__in=[2, 3]), [self.solver1, self.solver3])
 
+    def test_lower_noise_derived_property(self):
+        self.assertSolvers(self.client.get_solvers(lower_noise=True), [self.solver1])
+        self.assertSolvers(self.client.get_solvers(lower_noise=False), [self.solver2, self.solver3])
+
     def test_parameter_availability_check(self):
         self.assertSolvers(self.client.get_solvers(postprocess__available=True), [self.solver1])
         self.assertSolvers(self.client.get_solvers(postprocess=True), [self.solver1])
Repository: dwavesystems/dwave-cloud-client

Issue:
User-Agent is missing dwave-cloud-client version
The bug was introduced in 331c37b67, and released in [0.7.5](https://github.com/dwavesystems/dwave-cloud-client/compare/0.7.4...0.7.5), so it affects 0.7.5 and 0.7.6.

Comments:

Patch:
diff --git a/dwave/cloud/utils.py b/dwave/cloud/utils.py
index fbc82ad..41a026c 100644
--- a/dwave/cloud/utils.py
+++ b/dwave/cloud/utils.py
@@ -321,13 +321,13 @@ def user_agent(name=None, version=None):
     if name and version:
         tags.append((name, version))
 
-    tags = [
+    tags.extend([
         ("python", platform.python_version()),
         _interpreter(),
         ("machine", platform.machine() or 'unknown'),
         ("system", platform.system() or 'unknown'),
         ("platform", platform.platform() or 'unknown'),
-    ]
+    ])
 
     # add platform-specific tags
     tags.extend(get_platform_tags())


Test patch:
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 162456b..887f6e1 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -348,6 +348,19 @@ class TestCli(unittest.TestCase):
 
         self.assertEqual(result.exit_code, 0)
 
+    def test_platform(self):
+        runner = CliRunner()
+        result = runner.invoke(cli, ['--platform'])
+
+        # verify exit code and stdout printout
+        self.assertEqual(result.exit_code, 0)
+
+        from dwave.cloud.package_info import __packagename__, __version__
+        self.assertNotIn(__packagename__, result.output)
+        required = ['python', 'machine', 'system', 'platform']
+        for key in required:
+            self.assertIn(key, result.output)
+
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 1ea5bda..2ec424f 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -22,7 +22,8 @@ from datetime import datetime
 from dwave.cloud.utils import (
     uniform_iterator, uniform_get, strip_head, strip_tail,
     active_qubits, generate_random_ising_problem,
-    default_text_input, utcnow, cached, retried, parse_loglevel)
+    default_text_input, utcnow, cached, retried, parse_loglevel,
+    user_agent)
 
 
 class TestSimpleUtils(unittest.TestCase):
@@ -138,6 +139,14 @@ class TestSimpleUtils(unittest.TestCase):
         self.assertEqual(parse_loglevel(str(logging.INFO)), logging.INFO)
         self.assertEqual(parse_loglevel('  %d  ' % logging.INFO), logging.INFO)
 
+    def test_user_agent(self):
+        from dwave.cloud.package_info import __packagename__, __version__
+        ua = user_agent(__packagename__, __version__)
+
+        required = [__packagename__, 'python', 'machine', 'system', 'platform']
+        for key in required:
+            self.assertIn(key, ua)
+
 
 class TestCachedDecorator(unittest.TestCase):
Repository: dwavesystems/dwave-cloud-client

Issue:
Client.get_solver mutates instance defaults
```
defaults = dict(solver=dict(order_by='id'))

with Client.from_config(defaults=defaults) as client:
    assert 'order_by' in client.defaults['solver']
    solver = client.get_solver()
    assert 'order_by' not in client.defaults['solver']
```

Comments:

Patch:
diff --git a/dwave/cloud/client.py b/dwave/cloud/client.py
index dd68167..abace57 100644
--- a/dwave/cloud/client.py
+++ b/dwave/cloud/client.py
@@ -1068,11 +1068,13 @@ class Client(object):
 
         # in absence of other filters, config/env solver filters/name are used
         if not filters and self.default_solver:
-            filters = self.default_solver
+            filters = copy.deepcopy(self.default_solver)
 
         # allow `order_by` from default config/init override
         if order_by is None:
             order_by = filters.pop('order_by', 'avg_load')
+        else:
+            filters.pop('order_by', None)
 
         # get the first solver that satisfies all filters
         try:


Test patch:
diff --git a/tests/test_mock_solver_loading.py b/tests/test_mock_solver_loading.py
index e6fa54e..a4db844 100644
--- a/tests/test_mock_solver_loading.py
+++ b/tests/test_mock_solver_loading.py
@@ -208,6 +208,22 @@ class MockSolverLoading(unittest.TestCase):
                 with self.assertRaises(ValueError):
                     client.get_solver(solver_name)
 
+    def test_get_solver_reproducible(self):
+        """get_solver should return same solver (assuming cache hasn't changed)"""
+
+        with requests_mock.mock() as m:
+            setup_server(m)
+
+            # prefer solvers with longer name: that's our second solver
+            defaults = dict(solver=dict(order_by=lambda s: -len(s.id)))
+
+            with Client(url, token, defaults=defaults) as client:
+                solver = client.get_solver()
+                self.assertEqual(solver.id, second_solver_name)
+
+                solver = client.get_solver()
+                self.assertEqual(solver.id, second_solver_name)
+
     def test_solver_filtering_in_client(self):
         # base client
         self.assertTrue(Client.is_solver_handled(solver_object('test', 'qpu')))
Repository: dwavesystems/dwave-cloud-client

Issue:
PKCE `code_verifier` absent from fetch token request
Although `code_challenge` is present in the initial authorization request ([rfc7636, section 4.3](https://datatracker.ietf.org/doc/html/rfc7636#section-4.3)), and `code_verifier` is generated client-side, it's missing in the code exchange request (see [section 4.5](https://datatracker.ietf.org/doc/html/rfc7636#section-4.5)).

This represents a security vulnerability for public clients.

Comments:

Patch:
diff --git a/dwave/cloud/auth/flows.py b/dwave/cloud/auth/flows.py
index 9776baa..679d752 100644
--- a/dwave/cloud/auth/flows.py
+++ b/dwave/cloud/auth/flows.py
@@ -189,6 +189,7 @@ class AuthFlow:
             url=self.token_endpoint,
             grant_type='authorization_code',
             code=code,
+            code_verifier=self.code_verifier,
             **kwargs)
 
         logger.debug(f"{type(self).__name__}.fetch_token() = {token!r}")
diff --git a/releasenotes/notes/fix-pkce-missing-code-verifier-in-fetch-token-b5cc871cc9d6dfac.yaml b/releasenotes/notes/fix-pkce-missing-code-verifier-in-fetch-token-b5cc871cc9d6dfac.yaml
new file mode 100644
index 0000000..4b6df21
--- /dev/null
+++ b/releasenotes/notes/fix-pkce-missing-code-verifier-in-fetch-token-b5cc871cc9d6dfac.yaml
@@ -0,0 +1,6 @@
+---
+fixes:
+  - |
+    Fix PKCE support in ``dwave.cloud.auth.flow.AuthFlow`` by properly including
+    ``code_verifier`` in fetch token (code exchange) requests.
+    See `#605 <https://github.com/dwavesystems/dwave-cloud-client/issues/605>`_.


Test patch:
diff --git a/tests/auth/test_flows.py b/tests/auth/test_flows.py
index 1506b19..8c897a4 100644
--- a/tests/auth/test_flows.py
+++ b/tests/auth/test_flows.py
@@ -91,14 +91,18 @@ class TestAuthFlow(unittest.TestCase):
 
         m.get(requests_mock.ANY, status_code=404)
         m.post(requests_mock.ANY, status_code=404)
+        m.post(self.token_endpoint, json=dict(error="error", error_description="bad request"))
         m.post(self.token_endpoint, additional_matcher=post_body_matcher, json=self.token)
 
         # reset creds
         self.creds.clear()
 
-        # verify token fetch flow
+        # make auth request to generate all request params (like PKCE's verifier)
         flow = AuthFlow(**self.test_args)
+        _ = flow.get_authorization_url()
+        expected_params.update(code_verifier=flow.code_verifier)
 
+        # verify token fetch flow
         response = flow.fetch_token(code=code)
         self.assertEqual(response, self.token)
Repository: eWaterCycle/grpc4bmi

Issue:
Singularity version on Cartesius cluster @SURFSara gives ValueError
The version installed is `3.7.1-1.el7_9`. the semver package gives ValueError

Comments:

Patch:
diff --git a/grpc4bmi/bmi_client_apptainer.py b/grpc4bmi/bmi_client_apptainer.py
index 9daccf4..8692bf8 100644
--- a/grpc4bmi/bmi_client_apptainer.py
+++ b/grpc4bmi/bmi_client_apptainer.py
@@ -17,7 +17,7 @@ SUPPORTED_APPTAINER_VERSIONS = '>=1.0.0-rc.2'  # First apptainer release with bi
 
 def check_apptainer_version_string(version_output: str) -> bool:
     version = version_output.split(' ').pop()
-    local_version = Version(version)
+    local_version = Version(version.replace('.el', ''))
     if local_version not in SpecifierSet(SUPPORTED_APPTAINER_VERSIONS):
         raise ApptainerVersionException(f'Unsupported version ({version_output}) of apptainer found, '
                                         f'supported versions {SUPPORTED_APPTAINER_VERSIONS}')
diff --git a/grpc4bmi/bmi_client_singularity.py b/grpc4bmi/bmi_client_singularity.py
index c3d3a61..9d240b7 100644
--- a/grpc4bmi/bmi_client_singularity.py
+++ b/grpc4bmi/bmi_client_singularity.py
@@ -18,7 +18,7 @@ SUPPORTED_APPTAINER_VERSIONS = '>=1.0.0-rc.2'  # First apptainer release with bi
 
 def check_singularity_version_string(version_output: str) -> bool:
     (app, _, version) = version_output.split(' ')
-    local_version = Version(version)
+    local_version = Version(version.replace('.el', ''))
     if app == 'singularity' and local_version not in SpecifierSet(SUPPORTED_SINGULARITY_VERSIONS):
         raise SingularityVersionException(f'Unsupported version ({version_output}) of singularity found, '
                                           f'supported versions {SUPPORTED_SINGULARITY_VERSIONS}')


Test patch:
diff --git a/test/test_apptainer.py b/test/test_apptainer.py
index cd5ea5e..3a144b8 100644
--- a/test/test_apptainer.py
+++ b/test/test_apptainer.py
@@ -14,6 +14,8 @@ class Test_check_apptainer_version_string:
         ('apptainer version 1.0.3'),
         ('apptainer version 1.1.0-rc.3'),
         ('apptainer version 1.1.2'),
+        # From snellius cluster at SURF.
+        ('apptainer version 1.1.5-2.el8'),
     ])
     def test_ok(self, test_input: str):
         result = check_apptainer_version_string(test_input)
diff --git a/test/test_singularity.py b/test/test_singularity.py
index 1f9d8b1..73c1e12 100644
--- a/test/test_singularity.py
+++ b/test/test_singularity.py
@@ -235,6 +235,8 @@ class Test_check_singularity_version_string:
         ('apptainer version 1.0.3'),
         ('apptainer version 1.1.0-rc.3'),
         ('apptainer version 1.1.2'),
+        # From snellius cluster at SURF.
+        ('apptainer version 1.1.5-2.el8'),
     ])
     def test_ok(self, test_input: str):
         result = check_singularity_version_string(test_input)
Repository: eigenfoo/littlemcmc

Issue:
New commits to pymc3/step_methods/hmc/
> This is an auto-generated issue, triggered by the `even-with-pymc3` workflow.

There have been new commits to `pymc3/step_methods/hmc/` since yesterday: please see
[the latest run of the `even-with-pymc3` GitHub Action](https://github.com/eigenfoo/littlemcmc/actions?query=workflow%3Aeven-with-pymc3)
and consider if these commits are worth mirroring in `littlemcmc`.



Comments:

Patch:
diff --git a/littlemcmc/sampling.py b/littlemcmc/sampling.py
index 2c13ed8..87d046a 100644
--- a/littlemcmc/sampling.py
+++ b/littlemcmc/sampling.py
@@ -248,8 +248,10 @@ def init_nuts(
           on the variance of the tuning samples.
         * jitter+adapt_diag : Same as `'adapt_diag'`, but use uniform jitter in [-1, 1]
           as starting point in each chain.
-        * adapt_full: Sample as `'adapt_diag'`, but adapts a dense mass matrix using the
+        * adapt_full: Same as `'adapt_diag'`, but adapts a dense mass matrix using the
           sample covariances.
+        * jitter+adapt_full: Same as `'adapt_full'`, but use uniform jitter in [-1, 1]
+          as starting point in each chain.
     **kwargs: keyword arguments
         Extra keyword arguments are forwarded to littlemcmc.NUTS.
 
@@ -290,6 +292,11 @@ def init_nuts(
         mean = start
         cov = np.eye(size)
         potential = QuadPotentialFullAdapt(size, mean, cov, 10)
+    elif init == "jitter+adapt_full":
+        start = 2 * np.random.rand(size) - 1
+        mean = start
+        cov = np.eye(size)
+        potential = QuadPotentialFullAdapt(size, mean, cov, 10)
     else:
         raise ValueError("Unknown initializer: {}.".format(init))
 
diff --git a/requirements-dev.txt b/requirements-dev.txt
index abd5ec6..8cae25b 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,3 +1,4 @@
+# Development tools
 black
 jupyter
 mypy
@@ -10,7 +11,6 @@ pytest-html
 # Packaging requirements
 setuptools
 twine
-wheel
 
 # Sphinx requirements
 numpydoc
diff --git a/requirements.txt b/requirements.txt
index 5fcd45a..e48c91e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,4 @@
+wheel
 joblib>=0.14.1
 numpy
 scipy>=0.18.1


Test patch:
diff --git a/tests/test_sampling.py b/tests/test_sampling.py
index 1892c73..d47e49f 100644
--- a/tests/test_sampling.py
+++ b/tests/test_sampling.py
@@ -13,17 +13,19 @@
 #  limitations under the License.
 
 import numpy as np
+import pytest
 import littlemcmc as lmc
 from test_utils import logp_dlogp_func
 
 
-def test_init_nuts():
-    size = 1
-    init = "auto"
-    random_seed = 42
-    foo = lmc.init_nuts(
-        logp_dlogp_func=logp_dlogp_func, size=size, init=init, random_seed=random_seed,
-    )
+@pytest.mark.parametrize(
+    "method", ["adapt_diag", "jitter+adapt_diag", "adapt_full", "jitter+adapt_full",],
+)
+def test_init_nuts(method):
+    start, step = lmc.init_nuts(logp_dlogp_func=logp_dlogp_func, size=1, init=method)
+    assert isinstance(start, np.ndarray)
+    assert len(start) == 1
+    assert isinstance(step, lmc.NUTS)
 
 
 def test_hmc_sampling_runs():