From 61f89eef2eac74821fae12e0389e58dc1a05a075 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 21 Sep 2014 19:28:13 +0200 Subject: [PATCH] Remove the now useless Queue wrapper in slixmpp.util. --- slixmpp/plugins/xep_0047/stream.py | 2 +- slixmpp/test/livesocket.py | 3 +-- slixmpp/test/mocksocket.py | 3 +-- slixmpp/test/slixtest.py | 2 +- slixmpp/util/__init__.py | 12 ------------ slixmpp/xmlstream/handler/collector.py | 4 ++-- slixmpp/xmlstream/handler/waiter.py | 4 ++-- 7 files changed, 8 insertions(+), 22 deletions(-) diff --git a/slixmpp/plugins/xep_0047/stream.py b/slixmpp/plugins/xep_0047/stream.py index d3235972..a8e7ff2a 100644 --- a/slixmpp/plugins/xep_0047/stream.py +++ b/slixmpp/plugins/xep_0047/stream.py @@ -1,9 +1,9 @@ import socket import threading import logging +from queue import Queue from slixmpp.stanza import Iq -from slixmpp.util import Queue from slixmpp.exceptions import XMPPError diff --git a/slixmpp/test/livesocket.py b/slixmpp/test/livesocket.py index 0d189571..e7deb617 100644 --- a/slixmpp/test/livesocket.py +++ b/slixmpp/test/livesocket.py @@ -8,8 +8,7 @@ import socket import threading - -from slixmpp.util import Queue +from queue import Queue class TestLiveSocket(object): diff --git a/slixmpp/test/mocksocket.py b/slixmpp/test/mocksocket.py index 409b377e..79961279 100644 --- a/slixmpp/test/mocksocket.py +++ b/slixmpp/test/mocksocket.py @@ -7,8 +7,7 @@ """ import socket - -from slixmpp.util import Queue +from queue import Queue class TestSocket(object): diff --git a/slixmpp/test/slixtest.py b/slixmpp/test/slixtest.py index 5b00a2b1..4f14d721 100644 --- a/slixmpp/test/slixtest.py +++ b/slixmpp/test/slixtest.py @@ -7,10 +7,10 @@ """ import unittest +from queue import Queue from xml.parsers.expat import ExpatError from slixmpp import ClientXMPP, ComponentXMPP -from slixmpp.util import Queue from slixmpp.stanza import Message, Iq, Presence from slixmpp.test import TestSocket, TestLiveSocket from slixmpp.xmlstream import ET diff --git a/slixmpp/util/__init__.py b/slixmpp/util/__init__.py index df09f771..8f70b2bb 100644 --- a/slixmpp/util/__init__.py +++ b/slixmpp/util/__init__.py @@ -13,15 +13,3 @@ from slixmpp.util.misc_ops import bytes, unicode, hashes, hash, \ num_to_bytes, bytes_to_num, quote, \ XOR - - -# ===================================================================== -# Standardize import of Queue class: - -try: - import queue -except ImportError: - import Queue as queue -Queue = queue.Queue - -QueueEmpty = queue.Empty diff --git a/slixmpp/xmlstream/handler/collector.py b/slixmpp/xmlstream/handler/collector.py index 03868187..d9e20279 100644 --- a/slixmpp/xmlstream/handler/collector.py +++ b/slixmpp/xmlstream/handler/collector.py @@ -10,8 +10,8 @@ """ import logging +from queue import Queue, Empty -from slixmpp.util import Queue, QueueEmpty from slixmpp.xmlstream.handler.base import BaseHandler @@ -59,7 +59,7 @@ class Collector(BaseHandler): try: while True: results.append(self._payload.get(False)) - except QueueEmpty: + except Empty: pass self.stream().remove_handler(self.name) diff --git a/slixmpp/xmlstream/handler/waiter.py b/slixmpp/xmlstream/handler/waiter.py index c8bc2e55..c25063db 100644 --- a/slixmpp/xmlstream/handler/waiter.py +++ b/slixmpp/xmlstream/handler/waiter.py @@ -10,8 +10,8 @@ """ import logging +from queue import Queue, Empty -from slixmpp.util import Queue, QueueEmpty from slixmpp.xmlstream.handler.base import BaseHandler @@ -71,7 +71,7 @@ class Waiter(BaseHandler): try: stanza = self._payload.get(True, 1) break - except QueueEmpty: + except Empty: elapsed_time += 1 if elapsed_time >= timeout: log.warning("Timed out waiting for %s", self.name)