Per #25144, opened by @soer7022. As shown in the screenshot below, PyCharm sometimes raises a flag for incorrect typing when creating a Key Vault SecretClient with a DefaultAzureCredential.

DefaultAzureCredential is an implementation of the TokenCredential protocol, so the typing is correct (and the type hint on the KV client should be kept as-is for generality). However, we should find a way to indicate this protocol implementation in a way that prevents false flags like this.
Running isinstance(DefaultAzureCredential, TokenCredential) currently raises an error because TokenCredential isn't decorated with @runtime_checkable, but adding this decorator and running the statement returns True (mypy doesn't raise an error with or without the decorator). This may be the fix we need, but there may be more to do here -- refer to PEP 544 for more information.
Per #25144, opened by @soer7022. As shown in the screenshot below, PyCharm sometimes raises a flag for incorrect typing when creating a Key Vault
SecretClientwith aDefaultAzureCredential.DefaultAzureCredentialis an implementation of theTokenCredentialprotocol, so the typing is correct (and the type hint on the KV client should be kept as-is for generality). However, we should find a way to indicate this protocol implementation in a way that prevents false flags like this.Running
isinstance(DefaultAzureCredential, TokenCredential)currently raises an error becauseTokenCredentialisn't decorated with@runtime_checkable, but adding this decorator and running the statement returnsTrue(mypydoesn't raise an error with or without the decorator). This may be the fix we need, but there may be more to do here -- refer to PEP 544 for more information.