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

Class CountingProvider

tests/lib/test_credentials.py:1448–1455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1446
1447
1448class CountingProvider:
1449 def __init__(self, tokens: List[AccessToken]) -> None:
1450 self.tokens = tokens
1451 self.calls = 0
1452
1453 def __call__(self, *, force_refresh: bool = False) -> AccessToken: # noqa: ARG002
1454 self.calls += 1
1455 return self.tokens[min(self.calls - 1, len(self.tokens) - 1)]
1456
1457
1458class TestTokenCache:

Calls

no outgoing calls