@@ -111,7 +111,7 @@ def __init__(self, max_buffer_size: int | float): # noqa: PYI041
111
111
112
112
113
113
@attrs .frozen
114
- class MemoryChannelStats :
114
+ class MemoryChannelStatistics :
115
115
current_buffer_used : int
116
116
max_buffer_size : int | float
117
117
open_send_channels : int
@@ -132,8 +132,8 @@ class MemoryChannelState(Generic[T]):
132
132
# {task: None}
133
133
receive_tasks : OrderedDict [Task , None ] = attrs .Factory (OrderedDict )
134
134
135
- def statistics (self ) -> MemoryChannelStats :
136
- return MemoryChannelStats (
135
+ def statistics (self ) -> MemoryChannelStatistics :
136
+ return MemoryChannelStatistics (
137
137
current_buffer_used = len (self .data ),
138
138
max_buffer_size = self .max_buffer_size ,
139
139
open_send_channels = self .open_send_channels ,
@@ -159,7 +159,9 @@ def __attrs_post_init__(self) -> None:
159
159
def __repr__ (self ) -> str :
160
160
return f"<send channel at { id (self ):#x} , using buffer at { id (self ._state ):#x} >"
161
161
162
- def statistics (self ) -> MemoryChannelStats :
162
+ def statistics (self ) -> MemoryChannelStatistics :
163
+ """Returns a `MemoryChannelStatistics` for the memory channel this is
164
+ associated with."""
163
165
# XX should we also report statistics specific to this object?
164
166
return self ._state .statistics ()
165
167
@@ -282,6 +284,9 @@ def close(self) -> None:
282
284
283
285
@enable_ki_protection
284
286
async def aclose (self ) -> None :
287
+ """Close this send channel object asynchronously.
288
+
289
+ See `MemorySendChannel.close`."""
285
290
self .close ()
286
291
await trio .lowlevel .checkpoint ()
287
292
@@ -296,7 +301,9 @@ class MemoryReceiveChannel(ReceiveChannel[ReceiveType], metaclass=NoPublicConstr
296
301
def __attrs_post_init__ (self ) -> None :
297
302
self ._state .open_receive_channels += 1
298
303
299
- def statistics (self ) -> MemoryChannelStats :
304
+ def statistics (self ) -> MemoryChannelStatistics :
305
+ """Returns a `MemoryChannelStatistics` for the memory channel this is
306
+ associated with."""
300
307
return self ._state .statistics ()
301
308
302
309
def __repr__ (self ) -> str :
@@ -430,5 +437,8 @@ def close(self) -> None:
430
437
431
438
@enable_ki_protection
432
439
async def aclose (self ) -> None :
440
+ """Close this receive channel object asynchronously.
441
+
442
+ See `MemoryReceiveChannel.close`."""
433
443
self .close ()
434
444
await trio .lowlevel .checkpoint ()
0 commit comments