[Qna] fix pylint/pyright for next version#44887
Merged
amber-Chen-86 merged 11 commits intoAzure:mainfrom Feb 3, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses pylint and pyright static analysis warnings in the azure-ai-language-questionanswering SDK. The changes focus on improving type safety and code quality without introducing functional changes.
Changes:
- Replaced unsafe
eval()usage in serialization with explicit type conversion - Fixed type safety issues with type comparisons and casting
- Removed unused test fixture parameters
- Added pylint disable comments for intentional violations
- Implemented array encoding/decoding functionality and deserialization caching for mutable types
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/testcase.py | Added pylint disable comment for constant test warning |
| tests/test_query_text.py | Moved imports to top, removed unused recorded_test fixture, added pylint disable comments |
| tests/test_query_knowledgebase_async.py | Moved imports to top, removed unused recorded_test fixture, simplified list comprehensions |
| tests/test_query_knowledgebase.py | Moved imports to top, removed unused recorded_test fixture, added pylint disable comments |
| azure/ai/language/questionanswering/_utils/serialization.py | Replaced eval() with explicit conditionals, added cast() for type safety, improved error messages |
| azure/ai/language/questionanswering/_utils/model_base.py | Added array encoding support, deserialization caching for mutable types, type annotation improvements, changed type(None) comparisons to use constant |
Comments suppressed due to low confidence (1)
sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_utils/model_base.py:410
- The
__delitem__method should clear any cached deserialized value when deleting a key, similar to how__setitem__does. Without this, a stale cache attribute could remain on the object after deletion, potentially causing issues if the key is re-added later.
def __delitem__(self, key: str) -> None:
self._data.__delitem__(key)
sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase.py
Show resolved
Hide resolved
sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase.py
Show resolved
Hide resolved
...azure-ai-language-questionanswering/azure/ai/language/questionanswering/_utils/model_base.py
Show resolved
Hide resolved
...azure-ai-language-questionanswering/azure/ai/language/questionanswering/_utils/model_base.py
Show resolved
Hide resolved
sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase.py
Show resolved
Hide resolved
...ognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase_async.py
Outdated
Show resolved
Hide resolved
...azure-ai-language-questionanswering/azure/ai/language/questionanswering/_utils/model_base.py
Show resolved
Hide resolved
sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text.py
Outdated
Show resolved
Hide resolved
Member
|
/azp run python - cognitivelanguage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
sarkar-rajarshi
approved these changes
Jan 29, 2026
Member
Author
|
/check-enforcer override |
Member
Author
|
The pipeline Pyright failures are unrelated to this PR. |
scbedd
approved these changes
Feb 2, 2026
Member
|
/check-enforcer override Clean pr run. The failing cognitive language was manually queued, and is failing from a different package. |
This was referenced Feb 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Please add an informative description that covers that changes made by the pull request and link all relevant issues.
If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines