diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2014-08-16 22:37:25 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-09-01 02:42:45 +0200 |
commit | 0e950154103ba9385b13f76548befa87509995f3 (patch) | |
tree | 14f38018f0ca25deed5729c7f4c9fd84779e5655 /slixmpp/xmlstream | |
parent | b92dac72f3bb601837dde507597d47715c5ad1aa (diff) | |
download | slixmpp-0e950154103ba9385b13f76548befa87509995f3.tar.gz slixmpp-0e950154103ba9385b13f76548befa87509995f3.tar.bz2 slixmpp-0e950154103ba9385b13f76548befa87509995f3.tar.xz slixmpp-0e950154103ba9385b13f76548befa87509995f3.zip |
Remove sys.version_info checks for python2 and clean some imports.
Diffstat (limited to 'slixmpp/xmlstream')
-rw-r--r-- | slixmpp/xmlstream/tostring.py | 12 | ||||
-rw-r--r-- | slixmpp/xmlstream/xmlstream.py | 22 |
2 files changed, 3 insertions, 31 deletions
diff --git a/slixmpp/xmlstream/tostring.py b/slixmpp/xmlstream/tostring.py index c1e4911a..2d99e323 100644 --- a/slixmpp/xmlstream/tostring.py +++ b/slixmpp/xmlstream/tostring.py @@ -13,14 +13,6 @@ :license: MIT, see LICENSE for more details """ -from __future__ import unicode_literals - -import sys - -if sys.version_info < (3, 0): - import types - - XML_NS = 'http://www.w3.org/XML/1998/namespace' @@ -145,10 +137,6 @@ def escape(text, use_cdata=False): :param string text: The XML text to convert. :rtype: Unicode string """ - if sys.version_info < (3, 0): - if type(text) != types.UnicodeType: - text = unicode(text, 'utf-8', 'ignore') - escapes = {'&': '&', '<': '<', '>': '>', diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py index 13e88428..92f5c6d3 100644 --- a/slixmpp/xmlstream/xmlstream.py +++ b/slixmpp/xmlstream/xmlstream.py @@ -12,32 +12,19 @@ :license: MIT, see LICENSE for more details """ -from __future__ import with_statement, unicode_literals - import asyncio import functools -import base64 import copy import logging -import signal import socket as Socket import ssl -import sys -import time -import random import weakref import uuid -import errno -from xml.parsers.expat import ExpatError import xml.etree.ElementTree -import slixmpp -from slixmpp.util import Queue, QueueEmpty, safedict -from slixmpp.xmlstream import tostring, cert -from slixmpp.xmlstream.stanzabase import StanzaBase, ET, ElementBase -from slixmpp.xmlstream.handler import Waiter, XMLCallback -from slixmpp.xmlstream.matcher import MatchXMLMask +from slixmpp.xmlstream import tostring +from slixmpp.xmlstream.stanzabase import StanzaBase, ElementBase from slixmpp.xmlstream.resolver import resolve, default_resolver #: The time in seconds to wait before timing out waiting for response stanzas. @@ -584,10 +571,7 @@ class XMLStream(object): if not self.dns_answers: self.dns_answers = self.get_dns_records(domain, port) - if sys.version_info < (3, 0): - return self.dns_answers.next() - else: - return next(self.dns_answers) + return next(self.dns_answers) def add_event_handler(self, name, pointer, disposable=False): """Add a custom event handler that will be executed whenever |