summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/queues.py
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2017-12-10 23:36:12 (GMT)
committerGitHub <noreply@github.com>2017-12-10 23:36:12 (GMT)
commit6370f345e1d5829e1fba59cd695c8b82c5a8c620 (patch)
treeba648772068abc784cef9e7b2e0be159646d7514 /Lib/asyncio/queues.py
parentc4d9df5fd719ad08e68e0950ce22a80f43e4f35d (diff)
downloadcpython-6370f345e1d5829e1fba59cd695c8b82c5a8c620.zip
cpython-6370f345e1d5829e1fba59cd695c8b82c5a8c620.tar.gz
cpython-6370f345e1d5829e1fba59cd695c8b82c5a8c620.tar.bz2
bpo-32262: Fix codestyle; use f-strings formatting where necessary. (#4775)
Diffstat (limited to 'Lib/asyncio/queues.py')
-rw-r--r--Lib/asyncio/queues.py27
1 files changed, 10 insertions, 17 deletions
diff --git a/Lib/asyncio/queues.py b/Lib/asyncio/queues.py
index 10e694f..512ea60 100644
--- a/Lib/asyncio/queues.py
+++ b/Lib/asyncio/queues.py
@@ -1,6 +1,4 @@
-"""Queues"""
-
-__all__ = ['Queue', 'PriorityQueue', 'LifoQueue', 'QueueFull', 'QueueEmpty']
+__all__ = ('Queue', 'PriorityQueue', 'LifoQueue', 'QueueFull', 'QueueEmpty')
import collections
import heapq
@@ -10,16 +8,12 @@ from . import locks
class QueueEmpty(Exception):
- """Exception raised when Queue.get_nowait() is called on a Queue object
- which is empty.
- """
+ """Raised when Queue.get_nowait() is called on an empty Queue."""
pass
class QueueFull(Exception):
- """Exception raised when the Queue.put_nowait() method is called on a Queue
- object which is full.
- """
+ """Raised when the Queue.put_nowait() method is called on a full Queue."""
pass
@@ -73,22 +67,21 @@ class Queue:
break
def __repr__(self):
- return '<{} at {:#x} {}>'.format(
- type(self).__name__, id(self), self._format())
+ return f'<{type(self).__name__} at {id(self):#x} {self._format()}>'
def __str__(self):
- return '<{} {}>'.format(type(self).__name__, self._format())
+ return f'<{type(self).__name__} {self._format()}>'
def _format(self):
- result = 'maxsize={!r}'.format(self._maxsize)
+ result = f'maxsize={self._maxsize!r}'
if getattr(self, '_queue', None):
- result += ' _queue={!r}'.format(list(self._queue))
+ result += f' _queue={list(self._queue)!r}'
if self._getters:
- result += ' _getters[{}]'.format(len(self._getters))
+ result += f' _getters[{len(self._getters)}]'
if self._putters:
- result += ' _putters[{}]'.format(len(self._putters))
+ result += f' _putters[{len(self._putters)}]'
if self._unfinished_tasks:
- result += ' tasks={}'.format(self._unfinished_tasks)
+ result += f' tasks={self._unfinished_tasks}'
return result
def qsize(self):