-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #912 from sirosen/fix-annotation
Fix annotation for `IdentityMap.__init__` to allow `ConfidentialAppAuthClient`
- Loading branch information
Showing
3 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Fixed | ||
~~~~~ | ||
|
||
- Fix the type annotation for ``globus_sdk.IdentityMap`` init, which | ||
incorrectly rejected ``ConfidentialAppAuthClient`` (:pr:`NUMBER`) |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# check IdentityMap usages | ||
import globus_sdk | ||
|
||
# create clients for later usage | ||
ac = globus_sdk.AuthClient() | ||
nc = globus_sdk.NativeAppAuthClient("foo_client_id") | ||
cc = globus_sdk.ConfidentialAppAuthClient("foo_client_id", "foo_client_secret") | ||
|
||
# check init allows CC, but not NC | ||
im = globus_sdk.IdentityMap(ac) | ||
im = globus_sdk.IdentityMap(cc) | ||
im = globus_sdk.IdentityMap(nc) # type: ignore[arg-type] | ||
|
||
# getitem and delitem work, but setitem and contains do not | ||
foo = im["foo"] | ||
del im["foo"] | ||
im["foo"] = "bar" # type: ignore[index] | ||
somebool = "foo" in im # type: ignore[operator] |