@@ -111,7 +111,7 @@ def __init__(self, max_buffer_size: int | float): # noqa: PYI041
111111
112112
113113@attrs .frozen
114- class MemoryChannelStats :
114+ class MemoryChannelStatistics :
115115 current_buffer_used : int
116116 max_buffer_size : int | float
117117 open_send_channels : int
@@ -132,8 +132,8 @@ class MemoryChannelState(Generic[T]):
132132 # {task: None}
133133 receive_tasks : OrderedDict [Task , None ] = attrs .Factory (OrderedDict )
134134
135- def statistics (self ) -> MemoryChannelStats :
136- return MemoryChannelStats (
135+ def statistics (self ) -> MemoryChannelStatistics :
136+ return MemoryChannelStatistics (
137137 current_buffer_used = len (self .data ),
138138 max_buffer_size = self .max_buffer_size ,
139139 open_send_channels = self .open_send_channels ,
@@ -159,7 +159,9 @@ def __attrs_post_init__(self) -> None:
159159 def __repr__ (self ) -> str :
160160 return f"<send channel at { id (self ):#x} , using buffer at { id (self ._state ):#x} >"
161161
162- def statistics (self ) -> MemoryChannelStats :
162+ def statistics (self ) -> MemoryChannelStatistics :
163+ """Returns a `MemoryChannelStatistics` for the memory channel this is
164+ associated with."""
163165 # XX should we also report statistics specific to this object?
164166 return self ._state .statistics ()
165167
@@ -282,6 +284,9 @@ def close(self) -> None:
282284
283285 @enable_ki_protection
284286 async def aclose (self ) -> None :
287+ """Close this send channel object asynchronously.
288+
289+ See `MemorySendChannel.close`."""
285290 self .close ()
286291 await trio .lowlevel .checkpoint ()
287292
@@ -296,7 +301,9 @@ class MemoryReceiveChannel(ReceiveChannel[ReceiveType], metaclass=NoPublicConstr
296301 def __attrs_post_init__ (self ) -> None :
297302 self ._state .open_receive_channels += 1
298303
299- def statistics (self ) -> MemoryChannelStats :
304+ def statistics (self ) -> MemoryChannelStatistics :
305+ """Returns a `MemoryChannelStatistics` for the memory channel this is
306+ associated with."""
300307 return self ._state .statistics ()
301308
302309 def __repr__ (self ) -> str :
@@ -430,5 +437,8 @@ def close(self) -> None:
430437
431438 @enable_ki_protection
432439 async def aclose (self ) -> None :
440+ """Close this receive channel object asynchronously.
441+
442+ See `MemoryReceiveChannel.close`."""
433443 self .close ()
434444 await trio .lowlevel .checkpoint ()
0 commit comments