-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
fix(mypy): Fix type errors across multiple files #21180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -106,6 +106,7 @@ def validate_endpoint_configuration(self) -> "ZscalerAIGuardConfigModel": | |||||||
| ) | ||||||||
|
|
||||||||
| # Check for configuration issues | ||||||||
| assert api_base is not None # always set via env default above | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Using
Suggested change
|
||||||||
| is_resolve_policy = api_base.endswith("/resolve-and-execute-policy") | ||||||||
| is_execute_policy = api_base.endswith("/execute-policy") and not is_resolve_policy | ||||||||
|
|
||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyannotation erases type safetyget_proxy_hook()returnsOptional[CustomLogger]— a well-typed return value. Annotating the result asAnysilences mypy but removes all type checking for subsequent usage ofmanaged_vector_stores(e.g., theacreate_vector_storecall on line 247 won't be checked). Consider usingcast()or a protocol/interface that describes the expected methods instead:If the issue is that
CustomLoggerdoesn't declareacreate_vector_store, the proper fix is to add that method to theCustomLoggerbase class or create aProtocolthat describes the expected interface, then usecast()to narrow the type.