MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / __init__

Method __init__

uncommon_route/spend_control.py:128–139  ·  view source on GitHub ↗
(
        self,
        storage: SpendControlStorage | None = None,
        now_fn: Any = None,
    )

Source from the content-addressed store, hash-verified

126 """Time-windowed spending limiter with persistent storage."""
127
128 def __init__(
129 self,
130 storage: SpendControlStorage | None = None,
131 now_fn: Any = None,
132 ) -> None:
133 self._storage = storage or FileSpendControlStorage()
134 self._now = now_fn or time.time
135 self._limits = SpendLimits()
136 self._history: list[SpendRecord] = []
137 self._session_spent: float = 0.0
138 self._session_calls: int = 0
139 self._load()
140
141 def set_limit(self, window: SpendWindow, amount: float) -> None:
142 if amount <= 0 or not isinstance(amount, (int, float)):

Callers

nothing calls this directly

Calls 3

_loadMethod · 0.95
SpendLimitsClass · 0.85

Tested by

no test coverage detected