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

Class CountingProvider

tests/lib/test_credentials.py:1463–1470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1461
1462
1463class CountingProvider:
1464 def __init__(self, tokens: List[AccessToken]) -> None:
1465 self.tokens = tokens
1466 self.calls = 0
1467
1468 def __call__(self, *, force_refresh: bool = False) -> AccessToken: # noqa: ARG002
1469 self.calls += 1
1470 return self.tokens[min(self.calls - 1, len(self.tokens) - 1)]
1471
1472
1473class TestTokenCache:

Calls

no outgoing calls