Repository navigation
Add optional keyring_type parameter to get_keyring() and type SecretService.get_preferred_collection - #779
Open
faresrafat3 wants to merge 1 commit into
Open
Add optional keyring_type parameter to get_keyring() and type SecretService.get_preferred_collection#779faresrafat3 wants to merge 1 commit into
faresrafat3 wants to merge 1 commit into
Conversation
faresrafat3
force-pushed
the
fix-645-get-keyring-typing
branch
from
October 24, 2026 07:55
dc5157b to
c2db8f5
Compare
The method returns a secretstorage.collection.Collection but was untyped, so callers in typed contexts got, as reported in jaraco#645: Call to untyped function "get_preferred_collection" in typed context [no-untyped-call] This module has no ``from __future__ import annotations``, so the annotation is quoted and the import is guarded by ``TYPE_CHECKING``. This addresses only the ``no-untyped-call`` half of jaraco#645. The other error reported there, ``Incompatible types in assignment`` when assigning ``get_keyring()``'s result to a concrete backend variable, is a question about ``get_keyring()``'s return type that needs its own issue and maintainer agreement on the API, and is deliberately out of scope here. Ref jaraco#645. Co-Authored-By: Claude <noreply@anthropic.com>
faresrafat3
force-pushed
the
fix-645-get-keyring-typing
branch
from
October 24, 2026 08:36
c2db8f5 to
84268c5
Compare
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.
Annotate
SecretService.Keyring.get_preferred_collection(): it returns asecretstorage.collection.Collection, but was untyped, so callers in typed contexts sawCall to untyped function "get_preferred_collection" in typed context [no-untyped-call]. One annotation, oneTYPE_CHECKING-guarded import; no runtime behaviour changes and no public API is added.This addresses the
[no-untyped-call]half of #645. The other error reported there —Incompatible types in assignment (expression has type "KeyringBackend", variable has type "Keyring")whenget_keyring()'s result is assigned to a concrete backend — is a return-narrowing question that would require changingget_keyring()'s signature, and that is deliberately out of scope here: it needs its own issue and maintainer agreement on the API before anyone sends the diff. SoRefs #645and not a full fix.The module has no
from __future__ import annotations, so the annotation is quoted and the import sits underif typing.TYPE_CHECKING:;secretstorageis listed inmypy.ini'signore_missing_importsstanza, so the type resolves for checkers without being a runtime dependency. No newsfragment: typing-only changes in this repo have merged without one (#691, #666), and there is no user-facing behaviour change to announce.Written with AI assistance; the change was reviewed and verified before submission.