diff options
author | Dulmandakh <dulmandakh@gmail.com> | 2021-03-19 01:54:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-18 12:54:08 -0500 |
commit | 27bba599d2082a27e9d1a9bef16c5d958a3539ec (patch) | |
tree | cce268c371bbcc40901c470c7e0a8fedd1a50317 | |
parent | ae02471b5d29d07b24abee957244d1db0f5e56fc (diff) | |
download | urllib3-27bba599d2082a27e9d1a9bef16c5d958a3539ec.tar.gz |
Use queue.LifoQueue instead of our own implementation
Co-authored-by: Seth Michael Larson <sethmichaellarson@gmail.com>
-rw-r--r-- | src/urllib3/connectionpool.py | 3 | ||||
-rw-r--r-- | src/urllib3/util/queue.py | 16 |
2 files changed, 1 insertions, 18 deletions
diff --git a/src/urllib3/connectionpool.py b/src/urllib3/connectionpool.py index 10392992..0fd18383 100644 --- a/src/urllib3/connectionpool.py +++ b/src/urllib3/connectionpool.py @@ -37,7 +37,6 @@ from .request import RequestMethods from .response import BaseHTTPResponse, HTTPResponse from .util.connection import is_connection_dropped from .util.proxy import connection_requires_http_tunnel -from .util.queue import LifoQueue from .util.request import set_file_position from .util.response import assert_header_parsing from .util.retry import Retry @@ -65,7 +64,7 @@ class ConnectionPool: """ scheme = None - QueueCls = LifoQueue + QueueCls = queue.LifoQueue def __init__(self, host, port=None): if not host: diff --git a/src/urllib3/util/queue.py b/src/urllib3/util/queue.py deleted file mode 100644 index 9dd04e17..00000000 --- a/src/urllib3/util/queue.py +++ /dev/null @@ -1,16 +0,0 @@ -import collections -import queue - - -class LifoQueue(queue.Queue): - def _init(self, _): - self.queue = collections.deque() - - def _qsize(self, len=len): - return len(self.queue) - - def _put(self, item): - self.queue.append(item) - - def _get(self): - return self.queue.pop() |