99class BaseTransport :
1010 """Base class for transports."""
1111
12+ __slots__ = ('_extra' ,)
13+
1214 def __init__ (self , extra = None ):
1315 if extra is None :
1416 extra = {}
@@ -44,6 +46,8 @@ def get_protocol(self):
4446class ReadTransport (BaseTransport ):
4547 """Interface for read-only transports."""
4648
49+ __slots__ = ()
50+
4751 def is_reading (self ):
4852 """Return True if the transport is receiving."""
4953 raise NotImplementedError
@@ -68,6 +72,8 @@ def resume_reading(self):
6872class WriteTransport (BaseTransport ):
6973 """Interface for write-only transports."""
7074
75+ __slots__ = ()
76+
7177 def set_write_buffer_limits (self , high = None , low = None ):
7278 """Set the high- and low-water limits for write flow control.
7379
@@ -154,10 +160,14 @@ class Transport(ReadTransport, WriteTransport):
154160 except writelines(), which calls write() in a loop.
155161 """
156162
163+ __slots__ = ()
164+
157165
158166class DatagramTransport (BaseTransport ):
159167 """Interface for datagram (UDP) transports."""
160168
169+ __slots__ = ()
170+
161171 def sendto (self , data , addr = None ):
162172 """Send data to the transport.
163173
@@ -180,6 +190,8 @@ def abort(self):
180190
181191class SubprocessTransport (BaseTransport ):
182192
193+ __slots__ = ()
194+
183195 def get_pid (self ):
184196 """Get subprocess id."""
185197 raise NotImplementedError
@@ -247,6 +259,8 @@ class _FlowControlMixin(Transport):
247259 resume_writing() may be called.
248260 """
249261
262+ __slots__ = ('_loop' , '_protocol_paused' , '_high_water' , '_low_water' )
263+
250264 def __init__ (self , extra = None , loop = None ):
251265 super ().__init__ (extra )
252266 assert loop is not None
0 commit comments