Fix pyright and pylint errors in evaluator upload operations#45867
Merged
dargilco merged 3 commits intoAzure:feature/azure-ai-projects/2.0.2from Mar 24, 2026
Merged
Conversation
- Replace hasattr(e, 'error_code') with getattr(e, 'error_code', None) to fix pyright reportAttributeAccessIssue on HttpResponseError - Narrow union types with isinstance checks for EvaluatorVersion and CodeBasedEvaluatorDefinition to fix pyright type errors on definition/blob_uri - Extract _upload_folder_to_blob() and _set_blob_uri() helpers to fix pylint R0914 (too many local variables) in upload() - Update tests to use MagicMock(spec=CodeBasedEvaluatorDefinition) for definition mocks Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dargilco
approved these changes
Mar 24, 2026
Fix C4739/C4741/C4742 violations from azure-pylint-guidelines-checker: - _set_blob_uri: add :param and :type for evaluator_version, blob_uri - _start_pending_upload_and_get_container_client: add :param/:type/:return/:rtype - _get_next_version: add :param/:type/:return/:rtype Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dargilco
approved these changes
Mar 24, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dargilco
approved these changes
Mar 24, 2026
b035800
into
Azure:feature/azure-ai-projects/2.0.2
20 checks passed
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.
Summary
Fixes pyright and pylint errors in the evaluator upload code added in PR #45678.
Changes
hasattr(e, 'error_code')withgetattr(e, 'error_code', None)to fix pyrightreportAttributeAccessIssueonHttpResponseError(attribute is dynamically set by azure-storage-blob)isinstancechecks forEvaluatorVersionandCodeBasedEvaluatorDefinitionto fix pyright type errors ondefinition/blob_uriaccess_upload_folder_to_blob()and_set_blob_uri()helper methods to fix pylint R0914MagicMock(spec=CodeBasedEvaluatorDefinition)Verification