diff options
author | Yury Selivanov <yury@magic.io> | 2017-12-10 18:36:12 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-10 18:36:12 -0500 |
commit | 6370f345e1d5829e1fba59cd695c8b82c5a8c620 (patch) | |
tree | ba648772068abc784cef9e7b2e0be159646d7514 /Lib/asyncio/futures.py | |
parent | c4d9df5fd719ad08e68e0950ce22a80f43e4f35d (diff) | |
download | cpython-git-6370f345e1d5829e1fba59cd695c8b82c5a8c620.tar.gz |
bpo-32262: Fix codestyle; use f-strings formatting where necessary. (#4775)
Diffstat (limited to 'Lib/asyncio/futures.py')
-rw-r--r-- | Lib/asyncio/futures.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py index 7b6204a626..b805f99896 100644 --- a/Lib/asyncio/futures.py +++ b/Lib/asyncio/futures.py @@ -1,12 +1,13 @@ """A Future class similar to the one in PEP 3148.""" -__all__ = ['CancelledError', 'TimeoutError', 'InvalidStateError', - 'Future', 'wrap_future', 'isfuture'] +__all__ = ( + 'CancelledError', 'TimeoutError', 'InvalidStateError', + 'Future', 'wrap_future', 'isfuture', +) import concurrent.futures import logging import sys -import traceback from . import base_futures from . import events @@ -82,7 +83,8 @@ class Future: _repr_info = base_futures._future_repr_info def __repr__(self): - return '<%s %s>' % (self.__class__.__name__, ' '.join(self._repr_info())) + return '<{} {}>'.format(self.__class__.__name__, + ' '.join(self._repr_info())) def __del__(self): if not self._log_traceback: @@ -91,8 +93,8 @@ class Future: return exc = self._exception context = { - 'message': ('%s exception was never retrieved' - % self.__class__.__name__), + 'message': + f'{self.__class__.__name__} exception was never retrieved', 'exception': exc, 'future': self, } @@ -237,7 +239,7 @@ class Future: assert self.done(), "yield from wasn't used with future" return self.result() # May raise too. - __await__ = __iter__ # make compatible with 'await' expression + __await__ = __iter__ # make compatible with 'await' expression # Needed for testing purposes. @@ -330,7 +332,7 @@ def wrap_future(future, *, loop=None): if isfuture(future): return future assert isinstance(future, concurrent.futures.Future), \ - 'concurrent.futures.Future is expected, got {!r}'.format(future) + f'concurrent.futures.Future is expected, got {future!r}' if loop is None: loop = events.get_event_loop() new_future = loop.create_future() |