fix: handle bare dict type annotations - #3376
Conversation
|
Bump. |
jbeckwith-oai
left a comment
There was a problem hiding this comment.
tests/test_transform.py:401 causes the repository's strict Pyright check to fail with reportMissingTypeArgument (Expected type arguments for generic class "dict"). Because the bare dict annotation is intentional for this regression test, please add a narrow inline suppression for that diagnostic so the runtime coverage remains intact without breaking CI.
Validation at 5cb7ba509e79ed11de6deb28d760f9f122ae221d: 117 focused tests passed; Ruff lint and format checks passed; mypy passed; git diff --check passed; targeted Pyright failed only on the line above.
Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com>
|
Done — the bare dict now carries a narrow pyright: ignore[reportMissingTypeArgument] with a note on why it is intentional. The regression test itself still runs (2 passed locally); the other pyright noise in my sandbox is the repo's strict unknown-type surface, unrelated to this change. |
|
Thank you for the contribution. The missing type arguments for bare Closing this PR because the merged change resolves the same crash. Please use a release containing #3760 when available; the fix is not included in v3.11.0. |
Summary
get_args()when request transform sees a baredictannotationget_args()inconstruct_type(..., type_=dict)dictFixes #3338.
Fixes #3341.
Tested
PYTHONPATH=src.python -m pytest tests\test_transform.py::test_bare_dictionary_annotation tests\test_transform.py::test_dictionary_items tests\test_models.py::test_construct_bare_dict_type -qpython -m pytest tests\test_transform.py tests\test_models.py -qpython -m py_compile src\openai\_utils\_transform.py src\openai\_models.py tests\test_transform.py tests\test_models.pypython -m ruff check src\openai\_utils\_transform.py src\openai\_models.py tests\test_transform.py tests\test_models.pypython -m ruff format --check src\openai\_utils\_transform.py src\openai\_models.py tests\test_transform.py tests\test_models.pygit diff --check