ldap3: add types for Connection.unbind - #16243
Open
MaicoTimmerman wants to merge 1 commit into
Open
Conversation
Co-Authored-By: Factory Droid (Opus 5)
Contributor
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
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.
This PR adds types for
Connection.unbind'scontrolsargument, and propagates the types that become known from there toprotocol.convert.build_controls_listand theBaseStrategy.sendset of subclasses thatunbindfeeds itscontrolsinto.Rationale for the types:
controlsis a_ControlSequence | None.build_controls_listrejects anything that is not inSEQUENCE_TYPES(set,list,tuple, generator,dict_keys), so the alias enumerates those rather than usingIterable, mirroring the existing_ServerSequencealias. Items are aControlobject or a(controlType, criticality, controlValue)triple, the two formsbuild_controls_listaccepts.protocol.convertnext tobuild_controls_list, the function that defines the contract, and is imported bycore.connectionand the strategies.build_controls_listreturnsControls | None; it returnsNonefor bothNoneand an empty sequence.unbindreturnsLiteral[True] | tuple[...]: it hands a hardcodedTrueto_prepare_return_value, which returns that status directly, except on the thread-safe strategies (SAFE_SYNC,SAFE_RESTARTABLE), where it returns a(status, result, response, request)tuple.result,responseandrequestmembers of that tuple use new_Result,_Responseand_Requestplaceholder aliases, also used for the matchingConnectionattributes. Their real types are per-operation dicts, which is left for a follow-up.Written with the help of Factory Droid (Opus 5), humanly curated.