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

Class CountingProvider

tests/lib/test_credentials.py:1589–1596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1587
1588
1589class CountingProvider:
1590 def __init__(self, tokens: List[AccessToken]) -> None:
1591 self.tokens = tokens
1592 self.calls = 0
1593
1594 def __call__(self, *, force_refresh: bool = False) -> AccessToken: # noqa: ARG002
1595 self.calls += 1
1596 return self.tokens[min(self.calls - 1, len(self.tokens) - 1)]
1597
1598
1599class TestTokenCache:

Calls

no outgoing calls