diff options
Diffstat (limited to 'Lib/asyncio/transports.py')
-rw-r--r-- | Lib/asyncio/transports.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/Lib/asyncio/transports.py b/Lib/asyncio/transports.py index a94079f..51f5673 100644 --- a/Lib/asyncio/transports.py +++ b/Lib/asyncio/transports.py @@ -1,8 +1,9 @@ """Abstract Transport class.""" -__all__ = ['BaseTransport', 'ReadTransport', 'WriteTransport', - 'Transport', 'DatagramTransport', 'SubprocessTransport', - ] +__all__ = ( + 'BaseTransport', 'ReadTransport', 'WriteTransport', + 'Transport', 'DatagramTransport', 'SubprocessTransport', +) class BaseTransport: @@ -267,7 +268,7 @@ class _FlowControlMixin(Transport): def _maybe_resume_protocol(self): if (self._protocol_paused and - self.get_write_buffer_size() <= self._low_water): + self.get_write_buffer_size() <= self._low_water): self._protocol_paused = False try: self._protocol.resume_writing() @@ -285,14 +286,16 @@ class _FlowControlMixin(Transport): def _set_write_buffer_limits(self, high=None, low=None): if high is None: if low is None: - high = 64*1024 + high = 64 * 1024 else: - high = 4*low + high = 4 * low if low is None: low = high // 4 + if not high >= low >= 0: - raise ValueError('high (%r) must be >= low (%r) must be >= 0' % - (high, low)) + raise ValueError( + f'high ({high!r}) must be >= low ({low!r}) must be >= 0') + self._high_water = high self._low_water = low |