MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / CountingProvider

Class CountingProvider

tests/lib/test_credentials.py:1354–1361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1352
1353
1354class CountingProvider:
1355 def __init__(self, tokens: List[AccessToken]) -> None:
1356 self.tokens = tokens
1357 self.calls = 0
1358
1359 def __call__(self, *, force_refresh: bool = False) -> AccessToken: # noqa: ARG002
1360 self.calls += 1
1361 return self.tokens[min(self.calls - 1, len(self.tokens) - 1)]
1362
1363
1364class TestTokenCache:

Calls

no outgoing calls