@@ -218,7 +218,8 @@ class Usage:
218218 The character, document and team_document properties provide details about
219219 each corresponding usage type. These properties allow each usage type to be
220220 checked individually.
221- The any_limit_exceeded property checks if any usage type is exceeded.
221+ The any_limit_reached property checks if for any usage type the amount used
222+ has reached the allowed amount.
222223 """
223224
224225 class Detail :
@@ -243,10 +244,21 @@ def valid(self) -> bool:
243244 return self ._count is not None and self ._limit is not None
244245
245246 @property
246- def limit_exceeded (self ) -> bool :
247- """True iff this limit is valid and exceeded."""
247+ def limit_reached (self ) -> bool :
248+ """True if this limit is valid and the amount used is greater than
249+ or equal to the amount allowed, otherwise False."""
248250 return self .valid and self .count >= self .limit
249251
252+ @property
253+ def limit_exceeded (self ) -> bool :
254+ """Deprecated, use limit_reached instead."""
255+ import warnings
256+
257+ warnings .warn (
258+ "limit_reached is deprecated" , DeprecationWarning , stacklevel = 2
259+ )
260+ return self .limit_reached
261+
250262 def __str__ (self ) -> str :
251263 return f"{ self .count } of { self .limit } " if self .valid else "Unknown"
252264
@@ -256,13 +268,24 @@ def __init__(self, json: dict):
256268 self ._team_document = self .Detail (json , "team_document" )
257269
258270 @property
259- def any_limit_exceeded (self ) -> bool :
260- """True if any API function limit is exceeded."""
271+ def any_limit_reached (self ) -> bool :
272+ """True if for any API usage type, the amount used is greater than or
273+ equal to the amount allowed, otherwise False."""
261274 return (
262- self .character .limit_exceeded
263- or self .document .limit_exceeded
264- or self .team_document .limit_exceeded
275+ self .character .limit_reached
276+ or self .document .limit_reached
277+ or self .team_document .limit_reached
278+ )
279+
280+ @property
281+ def any_limit_exceeded (self ) -> bool :
282+ """Deprecated, use any_limit_reached instead."""
283+ import warnings
284+
285+ warnings .warn (
286+ "any_limit_reached is deprecated" , DeprecationWarning , stacklevel = 2
265287 )
288+ return self .any_limit_reached
266289
267290 @property
268291 def character (self ) -> Detail :
0 commit comments