MCPcopy
hub / github.com/python-trio/trio / total_tokens

Method total_tokens

src/trio/_sync.py:268–280  ·  view source on GitHub ↗

The total capacity available. You can change :attr:`total_tokens` by assigning to this attribute. If you make it larger, then the appropriate number of waiting tasks will be woken immediately to take the new tokens. If you decrease total_tokens below the number of ta

(self)

Source from the content-addressed store, hash-verified

266
267 @property
268 def total_tokens(self) -> int | float:
269 """The total capacity available.
270
271 You can change :attr:`total_tokens` by assigning to this attribute. If
272 you make it larger, then the appropriate number of waiting tasks will
273 be woken immediately to take the new tokens. If you decrease
274 total_tokens below the number of tasks that are currently using the
275 resource, then all current tasks will be allowed to finish as normal,
276 but no new tasks will be allowed in until the total number of tasks
277 drops below the new total_tokens.
278
279 """
280 return self._total_tokens
281
282 @total_tokens.setter
283 def total_tokens(self, new_total_tokens: int | float) -> None: # noqa: PYI041

Callers

nothing calls this directly

Calls 1

_wake_waitersMethod · 0.95

Tested by

no test coverage detected