Merge pull request #252 from jpcaruana/develop
refactor : optimize imports + replace mutable argument (a list) in StateMachine constructor
This commit is contained in:
commit
d439c4f215
48 changed files with 112 additions and 88 deletions
|
@ -14,6 +14,5 @@ from sleekxmpp.jid import JID, InvalidJID
|
|||
from sleekxmpp.xmlstream.handler import *
|
||||
from sleekxmpp.xmlstream import XMLStream, RestartStream
|
||||
from sleekxmpp.xmlstream.matcher import *
|
||||
from sleekxmpp.xmlstream.stanzabase import StanzaBase, ET
|
||||
|
||||
from sleekxmpp.version import __version__, __version_info__
|
||||
|
|
|
@ -19,14 +19,13 @@ import logging
|
|||
import threading
|
||||
|
||||
import sleekxmpp
|
||||
from sleekxmpp import plugins, features, roster
|
||||
from sleekxmpp import plugins, roster
|
||||
from sleekxmpp.api import APIRegistry
|
||||
from sleekxmpp.exceptions import IqError, IqTimeout
|
||||
|
||||
from sleekxmpp.stanza import Message, Presence, Iq, StreamError
|
||||
from sleekxmpp.stanza.roster import Roster
|
||||
from sleekxmpp.stanza.nick import Nick
|
||||
from sleekxmpp.stanza.htmlim import HTMLIM
|
||||
|
||||
from sleekxmpp.xmlstream import XMLStream, JID
|
||||
from sleekxmpp.xmlstream import ET, register_stanza_plugin
|
||||
|
@ -34,8 +33,7 @@ from sleekxmpp.xmlstream.matcher import MatchXPath
|
|||
from sleekxmpp.xmlstream.handler import Callback
|
||||
from sleekxmpp.xmlstream.stanzabase import XML_NS
|
||||
|
||||
from sleekxmpp.features import *
|
||||
from sleekxmpp.plugins import PluginManager, register_plugin, load_plugin
|
||||
from sleekxmpp.plugins import PluginManager, load_plugin
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
|
@ -12,7 +12,7 @@ from sleekxmpp.jid import JID
|
|||
from sleekxmpp.stanza import Iq, StreamFeatures
|
||||
from sleekxmpp.features.feature_bind import stanza
|
||||
from sleekxmpp.xmlstream import register_stanza_plugin
|
||||
from sleekxmpp.plugins import BasePlugin, register_plugin
|
||||
from sleekxmpp.plugins import BasePlugin
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
See the file LICENSE for copying permission.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import ssl
|
||||
import logging
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import logging
|
||||
|
||||
from sleekxmpp.stanza import Iq, StreamFeatures
|
||||
from sleekxmpp.stanza import StreamFeatures
|
||||
from sleekxmpp.features.feature_preapproval import stanza
|
||||
from sleekxmpp.xmlstream import register_stanza_plugin
|
||||
from sleekxmpp.plugins.base import BasePlugin
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import logging
|
||||
|
||||
from sleekxmpp.stanza import Iq, StreamFeatures
|
||||
from sleekxmpp.stanza import StreamFeatures
|
||||
from sleekxmpp.features.feature_rosterver import stanza
|
||||
from sleekxmpp.xmlstream import register_stanza_plugin
|
||||
from sleekxmpp.plugins.base import BasePlugin
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
See the file LICENSE for copying permission.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import datetime as dt
|
||||
|
||||
from sleekxmpp.plugins import BasePlugin, register_plugin
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
See the file LICENSE for copying permission.
|
||||
"""
|
||||
|
||||
from sleekxmpp.xmlstream import JID
|
||||
from sleekxmpp.roster.item import RosterItem
|
||||
from sleekxmpp.roster.single import RosterNode
|
||||
from sleekxmpp.roster.multi import Roster
|
||||
|
|
|
@ -9,14 +9,12 @@
|
|||
import unittest
|
||||
from xml.parsers.expat import ExpatError
|
||||
|
||||
import sleekxmpp
|
||||
from sleekxmpp import ClientXMPP, ComponentXMPP
|
||||
from sleekxmpp.util import Queue
|
||||
from sleekxmpp.stanza import Message, Iq, Presence
|
||||
from sleekxmpp.test import TestSocket, TestLiveSocket
|
||||
from sleekxmpp.exceptions import XMPPError, IqTimeout, IqError
|
||||
from sleekxmpp.xmlstream import ET, register_stanza_plugin
|
||||
from sleekxmpp.xmlstream import ElementBase, StanzaBase
|
||||
from sleekxmpp.xmlstream import ET
|
||||
from sleekxmpp.xmlstream import ElementBase
|
||||
from sleekxmpp.xmlstream.tostring import tostring
|
||||
from sleekxmpp.xmlstream.matcher import StanzaPath, MatcherId
|
||||
from sleekxmpp.xmlstream.matcher import MatchXMLMask, MatchXPath
|
||||
|
|
4
sleekxmpp/thirdparty/socks.py
vendored
4
sleekxmpp/thirdparty/socks.py
vendored
|
@ -28,9 +28,6 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMANGE.
|
|||
This module provides a standard socket-like interface for Python
|
||||
for tunneling connections through SOCKS proxies.
|
||||
|
||||
"""
|
||||
|
||||
"""
|
||||
|
||||
Minor modifications made by Christopher Gilbert (http://motomastyle.com/)
|
||||
for use in PyLoris (http://pyloris.sourceforge.net/)
|
||||
|
@ -42,7 +39,6 @@ mainly to merge bug fixes found in Sourceforge
|
|||
|
||||
import socket
|
||||
import struct
|
||||
import sys
|
||||
|
||||
PROXY_TYPE_SOCKS4 = 1
|
||||
PROXY_TYPE_SOCKS5 = 2
|
||||
|
|
3
sleekxmpp/thirdparty/statemachine.py
vendored
3
sleekxmpp/thirdparty/statemachine.py
vendored
|
@ -15,7 +15,8 @@ log = logging.getLogger(__name__)
|
|||
|
||||
class StateMachine(object):
|
||||
|
||||
def __init__(self, states=[]):
|
||||
def __init__(self, states=None):
|
||||
if not states: states = []
|
||||
self.lock = threading.Condition()
|
||||
self.__states = []
|
||||
self.addStates(states)
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import sys
|
||||
import stringprep
|
||||
from unicodedata import ucd_3_2_0 as unicodedata
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import time
|
||||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
|
||||
|
||||
class TestEvents(SleekTest):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf8 -*-
|
||||
from __future__ import unicode_literals
|
||||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
from sleekxmpp import JID, InvalidJID
|
||||
from sleekxmpp.jid import nodeprep
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
from sleekxmpp.xmlstream.stanzabase import ET, StanzaBase
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from sleekxmpp.test import *
|
||||
from sleekxmpp.xmlstream.stanzabase import ElementBase
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
from sleekxmpp.xmlstream.stanzabase import ElementBase, register_stanza_plugin, ET
|
||||
from sleekxmpp.thirdparty import OrderedDict
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
|
||||
|
||||
class TestErrorStanzas(SleekTest):
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp import Iq
|
||||
from sleekxmpp.test import SleekTest
|
||||
import sleekxmpp.plugins.gmail_notify as gmail
|
||||
from sleekxmpp.xmlstream import register_stanza_plugin, ET
|
||||
|
||||
|
||||
class TestGmail(SleekTest):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
from sleekxmpp.xmlstream.stanzabase import ET
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
from sleekxmpp.stanza.message import Message
|
||||
from sleekxmpp.stanza.htmlim import HTMLIM
|
||||
from sleekxmpp.xmlstream import register_stanza_plugin
|
||||
|
||||
|
||||
class TestMessageStanzas(SleekTest):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sleekxmpp.test import *
|
||||
from sleekxmpp.stanza.presence import Presence
|
||||
|
||||
import unittest
|
||||
import sleekxmpp
|
||||
from sleekxmpp.test import SleekTest
|
||||
|
||||
class TestPresenceStanzas(SleekTest):
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from sleekxmpp.test import *
|
||||
from sleekxmpp.stanza.roster import Roster
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
from sleekxmpp.xmlstream import ET
|
||||
|
||||
|
||||
class TestRosterStanzas(SleekTest):
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp import Message
|
||||
from sleekxmpp.test import SleekTest
|
||||
from sleekxmpp.thirdparty import OrderedDict
|
||||
|
||||
import sleekxmpp.plugins.xep_0004 as xep_0004
|
||||
from sleekxmpp.xmlstream import register_stanza_plugin
|
||||
|
||||
|
||||
class TestDataForms(SleekTest):
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp import Iq
|
||||
from sleekxmpp.test import SleekTest
|
||||
import sleekxmpp.plugins.xep_0030 as xep_0030
|
||||
from sleekxmpp.xmlstream import register_stanza_plugin
|
||||
|
||||
|
||||
class TestDisco(SleekTest):
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp import Message
|
||||
from sleekxmpp.test import SleekTest
|
||||
import sleekxmpp.plugins.xep_0033 as xep_0033
|
||||
from sleekxmpp.xmlstream import register_stanza_plugin
|
||||
|
||||
|
||||
class TestAddresses(SleekTest):
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.exceptions import XMPPError
|
||||
from sleekxmpp import Iq
|
||||
from sleekxmpp.test import SleekTest
|
||||
from sleekxmpp.plugins.xep_0047 import Data
|
||||
from sleekxmpp.xmlstream import register_stanza_plugin, ET
|
||||
|
||||
|
||||
class TestIBB(SleekTest):
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
from sleekxmpp import Iq
|
||||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
from sleekxmpp.plugins.xep_0050 import Command
|
||||
from sleekxmpp.xmlstream import register_stanza_plugin
|
||||
|
||||
|
||||
class TestAdHocCommandStanzas(SleekTest):
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
from sleekxmpp.plugins.xep_0059 import Set
|
||||
from sleekxmpp.xmlstream import ET
|
||||
|
||||
|
||||
class TestSetStanzas(SleekTest):
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
import sleekxmpp.plugins.xep_0004 as xep_0004
|
||||
import sleekxmpp.plugins.xep_0060.stanza as pubsub
|
||||
from sleekxmpp.xmlstream.stanzabase import ET
|
||||
|
||||
|
||||
class TestPubsubStanzas(SleekTest):
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp import Message
|
||||
from sleekxmpp.test import SleekTest
|
||||
import sleekxmpp.plugins.xep_0085 as xep_0085
|
||||
from sleekxmpp.xmlstream import register_stanza_plugin
|
||||
|
||||
|
||||
class TestChatStates(SleekTest):
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp import Message
|
||||
from sleekxmpp.test import SleekTest
|
||||
import sleekxmpp.plugins.xep_0184 as xep_0184
|
||||
from sleekxmpp.xmlstream import register_stanza_plugin
|
||||
|
||||
|
||||
class TestReciept(SleekTest):
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import time
|
||||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
|
||||
|
||||
class TestStreamTester(SleekTest):
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import sys
|
||||
import sleekxmpp
|
||||
from sleekxmpp.xmlstream.matcher import MatchXPath
|
||||
from sleekxmpp.xmlstream.handler import Callback
|
||||
from sleekxmpp.exceptions import XMPPError
|
||||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
|
||||
|
||||
class TestStreamExceptions(SleekTest):
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import time
|
||||
|
||||
from sleekxmpp import Message
|
||||
from sleekxmpp.test import *
|
||||
from sleekxmpp.xmlstream.handler import *
|
||||
from sleekxmpp.xmlstream.matcher import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
|
||||
|
||||
class TestFilters(SleekTest):
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import time
|
||||
|
||||
from sleekxmpp import Message
|
||||
from sleekxmpp.test import *
|
||||
from sleekxmpp.xmlstream.handler import *
|
||||
from sleekxmpp.xmlstream.matcher import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
from sleekxmpp.exceptions import IqTimeout
|
||||
from sleekxmpp import Callback, MatchXPath
|
||||
|
||||
|
||||
class TestHandlers(SleekTest):
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import time
|
||||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
|
||||
|
||||
class TestStreamPresence(SleekTest):
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
# -*- encoding:utf-8 -*-
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.exceptions import IqTimeout
|
||||
from sleekxmpp.test import SleekTest
|
||||
import time
|
||||
import threading
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import sys
|
||||
import time
|
||||
import threading
|
||||
|
||||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
|
||||
|
||||
class TestStreamDisco(SleekTest):
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import threading
|
||||
import time
|
||||
|
||||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
|
||||
|
||||
class TestInBandByteStreams(SleekTest):
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import time
|
||||
import logging
|
||||
import threading
|
||||
|
||||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
from sleekxmpp.xmlstream import ElementBase, register_stanza_plugin
|
||||
|
||||
|
||||
class TestAdHocCommands(SleekTest):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import threading
|
||||
|
||||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
from sleekxmpp.xmlstream import register_stanza_plugin
|
||||
from sleekxmpp.plugins.xep_0030 import DiscoItems
|
||||
from sleekxmpp.plugins.xep_0059 import ResultIterator, Set
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import sys
|
||||
import time
|
||||
import threading
|
||||
|
||||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
from sleekxmpp.stanza.atom import AtomEntry
|
||||
from sleekxmpp.xmlstream import register_stanza_plugin
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import time
|
||||
import threading
|
||||
|
||||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
|
||||
|
||||
class TestOOB(SleekTest):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import threading
|
||||
import time
|
||||
|
||||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
|
||||
|
||||
class TestStreamChatStates(SleekTest):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import threading
|
||||
|
||||
from sleekxmpp.test import *
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
|
||||
|
||||
class TestStreamSet(SleekTest):
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
import sys
|
||||
import time
|
||||
import threading
|
||||
|
||||
from sleekxmpp.test import *
|
||||
from sleekxmpp.xmlstream import ElementBase
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
|
||||
|
||||
class TestStreamExtendedDisco(SleekTest):
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import sys
|
||||
import time
|
||||
import threading
|
||||
|
||||
from sleekxmpp.test import *
|
||||
from sleekxmpp.xmlstream import ElementBase
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
|
||||
|
||||
class TestStreamDirectInvite(SleekTest):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from sleekxmpp.test import *
|
||||
from sleekxmpp.stanza import Message
|
||||
from sleekxmpp.xmlstream.stanzabase import ET, ElementBase
|
||||
import unittest
|
||||
from sleekxmpp.test import SleekTest
|
||||
from sleekxmpp.xmlstream.stanzabase import ET
|
||||
from sleekxmpp.xmlstream.tostring import tostring, escape
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue