nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: wntrblm/nox
Pull request #958 (2025-05-01 06:49:09)

fix: support forcing Python on parametrized session
Fix https://github.com/wntrblm/nox/issues/949.



Patch:
diff --git a/nox/manifest.py b/nox/manifest.py
index 8b7d9e7..403dfd5 100644
--- a/nox/manifest.py
+++ b/nox/manifest.py
@@ -358,8 +358,11 @@ class Manifest:
         calls = Call.generate_calls(func, parametrize)
         for call in calls:
             long_names = []
-            if not multi:
+            if not multi or (
+                self._config.force_pythons and call.python in self._config.extra_pythons
+            ):
                 long_names.append(f"{name}{call.session_signature}")
+
             if func.python:
                 long_names.append(f"{name}-{func.python}{call.session_signature}")
                 # Ensure that specifying session-python will run all parameterizations.
diff --git a/nox/virtualenv.py b/nox/virtualenv.py
index b4b1a83..a97e3ac 100644
--- a/nox/virtualenv.py
+++ b/nox/virtualenv.py
@@ -77,6 +77,7 @@ _BLACKLISTED_ENV_VARS = frozenset(
         "PIP_REQUIRE_VIRTUALENV",
         "__PYVENV_LAUNCHER__",
         "UV_SYSTEM_PYTHON",
+        "UV_PYTHON",
     ]
 )
 


Test patch:
diff --git a/tests/resources/noxfile_parametrize.py b/tests/resources/noxfile_parametrize.py
new file mode 100644
index 0000000..0007703
--- /dev/null
+++ b/tests/resources/noxfile_parametrize.py
@@ -0,0 +1,11 @@
+import nox
+
+
+@nox.session
+@nox.parametrize(
+    ["version"],
+    [["8.1.0"], ["7.5.0"]],
+    ["8.1.0", "7.5.0"],
+)
+def check_package_files(session: nox.Session, version: str):
+    pass
diff --git a/tests/test_main.py b/tests/test_main.py
index 0cf60e6..6a93bcc 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -150,6 +150,31 @@ def test_main_no_venv_error() -> None:
         nox.main()
 
 
+def test_main_param_force_python(monkeypatch: pytest.MonkeyPatch) -> None:
+    """
+    Check that Python can be forced if something is parametrized over other things.
+    """
+
+    # Check that --no-venv overrides force_venv_backend
+    monkeypatch.setattr(
+        sys,
+        "argv",
+        [
+            "nox",
+            "--noxfile",
+            os.path.join(RESOURCES, "noxfile_parametrize.py"),
+            "--sessions",
+            "check_package_files(7.5.0)",
+            "--force-python",
+            ".".join(str(v) for v in sys.version_info[:2]),
+        ],
+    )
+
+    with mock.patch("sys.exit") as sys_exit:
+        nox.main()
+        sys_exit.assert_called_once_with(0)
+
+
 def test_main_short_form_args(monkeypatch: pytest.MonkeyPatch) -> None:
     monkeypatch.setattr(
         sys,
Repository: sec-edgar/sec-edgar
Pull request #196 (2021-04-06 19:58:34)

Bypass CIK lookup calls if argument is already CIK
See #194

- [ ] closes #xxxx
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] added entry to docs/whatsnew latest version

kevinschaul: @jackmoody11 This one is ready for another look, whenever you get a change! Thanks
reteps: Looks good to me, nice work @kevinschaul .

Patch:
diff --git a/docs/source/whatsnew/v0.3.3.rst b/docs/source/whatsnew/v0.3.3.rst
new file mode 100644
index 0000000..d97e3ef
--- /dev/null
+++ b/docs/source/whatsnew/v0.3.3.rst
@@ -0,0 +1,15 @@
+v0.3.3
+------
+
+Highlights
+~~~~~~~~~~
+
+- Bypasses CIK lookup calls to SEC if the provided argument is already a CIK.
+
+
+Contributors
+~~~~~~~~~~~~
+
+- kevinschaul
+- jackmoody11
+
diff --git a/secedgar/cik_lookup.py b/secedgar/cik_lookup.py
index 16438c9..153e422 100644
--- a/secedgar/cik_lookup.py
+++ b/secedgar/cik_lookup.py
@@ -195,7 +195,9 @@ class CIKLookup:
 
         for lookup in to_lookup:
             lookup_norm = lookup.upper()
-            if lookup_norm in ticker_map:
+            if lookup_norm.isdigit():
+                ciks[lookup] = lookup
+            elif lookup_norm in ticker_map:
                 ciks[lookup] = ticker_map[lookup_norm]
             elif lookup_norm in title_map:
                 ciks[lookup] = title_map[lookup_norm]


Test patch:
diff --git a/secedgar/tests/test_cik_lookup.py b/secedgar/tests/test_cik_lookup.py
index 528e16e..46e08e6 100644
--- a/secedgar/tests/test_cik_lookup.py
+++ b/secedgar/tests/test_cik_lookup.py
@@ -2,6 +2,7 @@ import json
 
 import pytest
 import requests
+from unittest.mock import patch
 from secedgar.cik_lookup import CIKLookup, get_cik_map
 from secedgar.client import NetworkClient
 from secedgar.exceptions import CIKError, EDGARQueryError
@@ -64,6 +65,9 @@ class TestCIKLookup(object):
             (['aapl', 'msft'], {'aapl': '320193', 'msft': '789019'}),
             (['aapl', 'msft', 'Alphabet Inc.'],
              {'aapl': '320193', 'msft': '789019', 'Alphabet Inc.': '1652044'}),
+            (['320193'], {'320193': '320193'}),
+            (['320193', '1018724'], {'320193': '320193', '1018724': '1018724'}),
+            (['AAPL', '1018724'], {'AAPL': '320193', '1018724': '1018724'}),
         ]
     )
     def test_cik_lookup_returns_correct_values(self, lookup, expected, mock_get_cik_map):
@@ -84,6 +88,16 @@ class TestCIKLookup(object):
         with pytest.warns(UserWarning):
             _ = multiple_results_cik.ciks
 
+    def test_cik_lookup_cik_hits_request(self):
+        with patch.object(CIKLookup, '_get_cik_from_html') as mock:
+            CIKLookup(['Apple']).get_ciks()
+            mock.assert_called()
+
+    def test_cik_lookup_cik_bypasses_request(self):
+        with patch.object(CIKLookup, '_get_cik_from_html') as mock:
+            CIKLookup(['1018724']).get_ciks()
+            mock.assert_not_called()
+
     @pytest.mark.parametrize(
         "bad_cik",
         [