diff --git a/AttackProtector/__init__.py b/AttackProtector/__init__.py
index 376fa18..a557ca5 100644
--- a/AttackProtector/__init__.py
+++ b/AttackProtector/__init__.py
@@ -55,14 +55,15 @@ __contributors__ = {}
__url__ = 'http://supybot.fr.cr/AttackProtector'
# 'http://supybot.com/Members/yourname/AttackProtector/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/AttackProtector/plugin.py b/AttackProtector/plugin.py
index dc1550a..b4b9b4b 100644
--- a/AttackProtector/plugin.py
+++ b/AttackProtector/plugin.py
@@ -71,7 +71,7 @@ class AttackProtectorDatabase:
self._collections = {}
def add(self, item):
- if not self._collections.has_key(item.kind):
+ if item.kind not in self._collections:
self._collections.update({item.kind: []})
self._collections[item.kind].append(item)
self.refresh()
@@ -122,7 +122,7 @@ class AttackProtector(callbacks.Plugin):
elif kind in ['nick']:
newNick = msg.args[0]
channels = []
- for (channel, c) in irc.state.channels.iteritems():
+ for (channel, c) in irc.state.channels.items():
if newNick in c.users:
channels.append(channel)
prefix = '*!' + msg.prefix.split('!')[1]
diff --git a/Biography/__init__.py b/Biography/__init__.py
index 9f411da..4e6c4ae 100644
--- a/Biography/__init__.py
+++ b/Biography/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Biography/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Brainfuck/__init__.py b/Brainfuck/__init__.py
index ecfe3c0..e551d88 100644
--- a/Brainfuck/__init__.py
+++ b/Brainfuck/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Brainfuck/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Coffee/__init__.py b/Coffee/__init__.py
index 15f952c..4cee876 100644
--- a/Coffee/__init__.py
+++ b/Coffee/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Coffee/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Darkfallonline/__init__.py b/Darkfallonline/__init__.py
index 010f69a..c0312c8 100644
--- a/Darkfallonline/__init__.py
+++ b/Darkfallonline/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Darkfallonline/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Debian/__init__.py b/Debian/__init__.py
index ecdcb09..3add144 100644
--- a/Debian/__init__.py
+++ b/Debian/__init__.py
@@ -54,14 +54,15 @@ __contributors__ = {supybot.authors.progval: ['fix issues with new version of '
__url__ = ""
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Debian/plugin.py b/Debian/plugin.py
index d7298af..447922f 100644
--- a/Debian/plugin.py
+++ b/Debian/plugin.py
@@ -76,7 +76,7 @@ class Debian(callbacks.Plugin):
responses = []
if '*' in filename:
irc.error('Wildcard characters can not be specified.', Raise=True)
- args['keywords'] = urllib.quote(filename, '')
+ args['keywords'] = utils.web.urlquote(filename, '')
url %= args
try:
html = utils.web.getUrl(url).decode()
@@ -365,7 +365,7 @@ class Debian(callbacks.Plugin):
if "There is no record of Bug" in text:
irc.error('I could not find a bug report matching that number.',
Raise=True)
- searches = map(lambda p: p.search(text), self._searches)
+ searches = list(map(lambda p: p.search(text), self._searches))
sev = self._severity.search(text)
tags = self._tags.search(text)
# This section should be cleaned up to ease future modifications
diff --git a/ERepublik/__init__.py b/ERepublik/__init__.py
index 2266212..be2c5c8 100644
--- a/ERepublik/__init__.py
+++ b/ERepublik/__init__.py
@@ -53,14 +53,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = 'http://supybot.fr.cr/ERepublik'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Eureka/__init__.py b/Eureka/__init__.py
index aa1b594..d9d5124 100644
--- a/Eureka/__init__.py
+++ b/Eureka/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Eureka/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Eureka/plugin.py b/Eureka/plugin.py
index f614ccb..cb6e77b 100644
--- a/Eureka/plugin.py
+++ b/Eureka/plugin.py
@@ -233,7 +233,7 @@ class Eureka(callbacks.Plugin):
if channel not in self.states:
irc.error(_('Eureka is not enabled on this channel'))
return
- scores = self.states[channel].scores.items()
+ scores = list(self.states[channel].scores.items())
if scores == []:
irc.reply(_('Noone played yet.'))
else:
diff --git a/Eureka/test.py b/Eureka/test.py
index f89c21e..3a0baed 100644
--- a/Eureka/test.py
+++ b/Eureka/test.py
@@ -56,7 +56,7 @@ class EurekaTestCase(ChannelPluginTestCase):
# Avoid conflicts between tests.
# We use .keys() in order to prevent this error:
# RuntimeError: dictionary changed size during iteration
- for name in schedule.schedule.events.keys():
+ for name in list(schedule.schedule.events.keys()):
schedule.removeEvent(name)
self.prefix1 = 'test!user@host.domain.tld'
self.prefix2 = 'foo!bar@baz'
diff --git a/GUI/__init__.py b/GUI/__init__.py
index 17b4535..f9e3098 100644
--- a/GUI/__init__.py
+++ b/GUI/__init__.py
@@ -53,14 +53,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/GUI/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/GeekQuote/__init__.py b/GeekQuote/__init__.py
index 42d7ec1..0deddcf 100644
--- a/GeekQuote/__init__.py
+++ b/GeekQuote/__init__.py
@@ -47,14 +47,15 @@ __contributors__ = {
supybot.authors.skorobeus: ['geekquote snarfer', 'qdb'],
}
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/GeekQuote/plugin.py b/GeekQuote/plugin.py
index 2b64d3e..c745187 100644
--- a/GeekQuote/plugin.py
+++ b/GeekQuote/plugin.py
@@ -62,7 +62,7 @@ class GeekQuote(callbacks.PluginRegexp):
def callCommand(self, method, irc, msg, *L, **kwargs):
try:
self.__parent.callCommand(method, irc, msg, *L, **kwargs)
- except utils.web.Error, e:
+ except utils.web.Error as e:
irc.error(str(e))
_joiner = ' // '
@@ -120,7 +120,7 @@ class GeekQuote(callbacks.PluginRegexp):
url = 'http://%s/' % site
try:
html = utils.web.getUrl(url)
- except utils.web.Error, e:
+ except utils.web.Error as e:
self.log.info('%u server returned the error: %s',
site, utils.web.strError(e))
last = re.search(r'
', html)
@@ -133,7 +133,7 @@ class GeekQuote(callbacks.PluginRegexp):
html = ''
try:
html = utils.web.getUrl(url)
- except utils.web.Error, e:
+ except utils.web.Error as e:
self.log.info('%u server returned the error: %s',
site, utils.web.strError(e))
s = None
diff --git a/GitHub/__init__.py b/GitHub/__init__.py
index d1eca06..04a7167 100644
--- a/GitHub/__init__.py
+++ b/GitHub/__init__.py
@@ -53,14 +53,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/GitHub/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/GitHub/plugin.py b/GitHub/plugin.py
index 56548de..ab2c464 100644
--- a/GitHub/plugin.py
+++ b/GitHub/plugin.py
@@ -28,23 +28,27 @@
###
+import sys
import json
import time
-import ur1ca
import urllib
import socket
import threading
-import SocketServer
import supybot.log as log
import supybot.utils as utils
import supybot.world as world
-from cStringIO import StringIO
from supybot.commands import *
import supybot.plugins as plugins
import supybot.ircmsgs as ircmsgs
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
import supybot.httpserver as httpserver
+
+from . import ur1ca
+if sys.version_info[0] < 3:
+ from cStringIO import StringIO
+else:
+ from io import StringIO
try:
from supybot.i18n import PluginInternationalization
from supybot.i18n import internationalizeDocstring
diff --git a/GitHub/ur1ca.py b/GitHub/ur1ca.py
index 015dfe0..79fc580 100644
--- a/GitHub/ur1ca.py
+++ b/GitHub/ur1ca.py
@@ -25,9 +25,12 @@ RETURN STATUS:
import sys
import urllib
-import urlparse
import re
+if sys.version_info[0] < 3:
+ import urlparse
+else:
+ import urllib.parse as urlparse
UR1CA = "http://ur1.ca/"
ESUCCESS = 0
@@ -136,10 +139,10 @@ def __do_main():
status, msg = scrape(doc)
if status:
- print msg
+ print(msg)
sys.exit(ESUCCESS)
else:
- print >> sys.stderr, msg
+ sys.stderr.write(msg + '\n')
sys.exit(EFAIL)
diff --git a/Glob2Chan/__init__.py b/Glob2Chan/__init__.py
index f204eb1..33dca03 100644
--- a/Glob2Chan/__init__.py
+++ b/Glob2Chan/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Glob2Chan/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/GoodFrench/__init__.py b/GoodFrench/__init__.py
index 5497e0e..0043f38 100644
--- a/GoodFrench/__init__.py
+++ b/GoodFrench/__init__.py
@@ -53,14 +53,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/GoodFrench/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/I18nPlaceholder/__init__.py b/I18nPlaceholder/__init__.py
index 2054bef..754aa38 100644
--- a/I18nPlaceholder/__init__.py
+++ b/I18nPlaceholder/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/I18nPlaceholder/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/I18nPlaceholder/config.py b/I18nPlaceholder/config.py
index 5aa78cd..f00a468 100644
--- a/I18nPlaceholder/config.py
+++ b/I18nPlaceholder/config.py
@@ -33,7 +33,7 @@ import sys
import supybot.conf as conf
import supybot.registry as registry
-from plugin import Placeholder
+from .plugin import Placeholder as Placeholder
if 'supybot.i18n' not in sys.modules:
sys.modules['supybot.i18n'] = Placeholder()
diff --git a/Iwant/__init__.py b/Iwant/__init__.py
index 7a1e842..a55160a 100644
--- a/Iwant/__init__.py
+++ b/Iwant/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Iwant/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Iwant/plugin.py b/Iwant/plugin.py
index d6dfbee..a284c54 100644
--- a/Iwant/plugin.py
+++ b/Iwant/plugin.py
@@ -112,7 +112,7 @@ class Iwant(callbacks.Plugin):
irc.error(_('No wish for the moment.'))
return
indexes = range(1, len(wishlist) + 1)
- wishlist_with_index = zip(indexes, wishlist)
+ wishlist_with_index = list(zip(indexes, wishlist))
wish = random.sample(wishlist_with_index, 1)[0]
irc.reply(_('Wish #%i is %s.') % wish)
random = wrap(random, ['channel'])
diff --git a/Kickme/__init__.py b/Kickme/__init__.py
index b6f055e..96b1552 100644
--- a/Kickme/__init__.py
+++ b/Kickme/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Kickme/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/LimnoriaChan/__init__.py b/LimnoriaChan/__init__.py
index b207c97..e9fed02 100644
--- a/LimnoriaChan/__init__.py
+++ b/LimnoriaChan/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/LimnoriaChan/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/LinkRelay/__init__.py b/LinkRelay/__init__.py
index 8280747..fb95032 100644
--- a/LinkRelay/__init__.py
+++ b/LinkRelay/__init__.py
@@ -53,14 +53,15 @@ __contributors__ = {supybot.authors.progval: ['enhance configurability',
__url__ = ""
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/ListEmpty/__init__.py b/ListEmpty/__init__.py
index 38b77a4..b97cc01 100644
--- a/ListEmpty/__init__.py
+++ b/ListEmpty/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/ListEmpty/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Listener/__init__.py b/Listener/__init__.py
index 649529b..0915c96 100644
--- a/Listener/__init__.py
+++ b/Listener/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Listener/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/MeditationExcuses/__init__.py b/MeditationExcuses/__init__.py
index d720573..7f4fa8a 100644
--- a/MeditationExcuses/__init__.py
+++ b/MeditationExcuses/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/MeditationExcuses/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/MegaHAL/__init__.py b/MegaHAL/__init__.py
index 6802d6d..f5445f6 100644
--- a/MegaHAL/__init__.py
+++ b/MegaHAL/__init__.py
@@ -51,14 +51,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/MegaHAL/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/MegaHAL/plugin.py b/MegaHAL/plugin.py
index 1889947..cac206b 100644
--- a/MegaHAL/plugin.py
+++ b/MegaHAL/plugin.py
@@ -34,19 +34,23 @@ import sys
import random
import supybot.conf as conf
import supybot.utils as utils
-from cStringIO import StringIO
from supybot.commands import *
import supybot.plugins as plugins
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
+if sys.version_info[0] < 3:
+ from cStringIO import StringIO
+else:
+ from io import StringIO
+
try:
import mh_python as megahal
except ImportError:
- raise callbacks.Error, 'You need to have MegaHAL installed to use this ' \
- 'plugin. Download it at ' \
- '' \
- 'or with '
+ raise callbacks.Error('You need to have MegaHAL installed to use this '
+ 'plugin. Download it at '
+ ''
+ 'or with ')
try:
from supybot.i18n import PluginInternationalization
@@ -133,7 +137,6 @@ class MegaHAL(callbacks.Plugin):
message = parsed.group('message')
usedToStartWithNick = True
if self.registryValue('answer.commands') or usedToStartWithNick:
- print msg.args[0]
self._response(message,
self.registryValue('answer.probabilityWhenAddressed',
msg.args[0]),
diff --git a/MilleBornes/__init__.py b/MilleBornes/__init__.py
index 3e1f012..d4adb7d 100644
--- a/MilleBornes/__init__.py
+++ b/MilleBornes/__init__.py
@@ -53,14 +53,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/MilleBornes/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/NoLatin1/__init__.py b/NoLatin1/__init__.py
index cdc0684..8d9aa9f 100644
--- a/NoLatin1/__init__.py
+++ b/NoLatin1/__init__.py
@@ -53,14 +53,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/NoLatin1/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Pinglist/__init__.py b/Pinglist/__init__.py
index ee87b11..66d37cc 100644
--- a/Pinglist/__init__.py
+++ b/Pinglist/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Pinglist/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Redmine/__init__.py b/Redmine/__init__.py
index 45ae872..c98e56a 100644
--- a/Redmine/__init__.py
+++ b/Redmine/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Redmine/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Redmine/plugin.py b/Redmine/plugin.py
index c9357f4..3c727f0 100644
--- a/Redmine/plugin.py
+++ b/Redmine/plugin.py
@@ -55,9 +55,12 @@ class AccessDenied(Exception):
def fetch(site, uri, **kwargs):
url = site['url'] + uri + '.json'
if kwargs:
- url += '?' + utils.web.urlencode(kwargs)
+ url += '?' + utils.web.urlencode(kwargs).decode()
try:
- return json.load(utils.web.getUrlFd(url))
+ data = utils.web.getUrl(url)
+ if sys.version_info[0] >= 3:
+ data = data.decode('utf8')
+ return json.loads(data)
except utils.web.Error:
raise ResourceNotFound()
@@ -76,10 +79,11 @@ def flatten_subdicts(dicts):
def get_project(site, project):
projects = []
for variable in ('id', 'identifier', 'name'):
- projects = filter(lambda x:x[variable] == project,
- fetch(site, 'projects')['projects'])
+ projects = list(filter(lambda x:x[variable] == project,
+ fetch(site, 'projects')['projects']))
if projects:
break
+ projects = list(projects)
if not projects:
raise ResourceNotFound()
elif len(projects) > 1:
@@ -206,11 +210,16 @@ class Redmine(callbacks.Plugin):
irc.error(_('Invalid site name.'), Raise=True)
if name in self.conf.sites():
irc.error(_('This site name is already registered.'), Raise=True)
- try:
- data = json.load(utils.web.getUrlFd(url + 'projects.json'))
- assert 'total_count' in data
- except:
- irc.error(_('This is not a valid Redmine site.'), Raise=True)
+ data = utils.web.getUrl(url + 'projects.json')
+ if sys.version_info[0] >= 3:
+ data = data.decode('utf8')
+ data = json.loads(data)
+ assert 'total_count' in data
+ #try:
+ # data = json.load(utils.web.getUrlFd(url + 'projects.json'))
+ # assert 'total_count' in data
+ #except:
+ # irc.error(_('This is not a valid Redmine site.'), Raise=True)
with self.conf.sites.editable() as sites:
sites[name] = {'url': url}
irc.replySuccess()
@@ -235,7 +244,7 @@ class Redmine(callbacks.Plugin):
Return the list of known redmine sites."""
sites = self.conf.sites().keys()
if sites:
- irc.reply(format('%L', sites))
+ irc.reply(format('%L', list(sites)))
else:
irc.reply(_('No registered Redmine site.'))
list = wrap(list, [])
diff --git a/Scheme/__init__.py b/Scheme/__init__.py
index 2918bc8..6416d11 100644
--- a/Scheme/__init__.py
+++ b/Scheme/__init__.py
@@ -52,14 +52,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Scheme/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Scheme/plugin.py b/Scheme/plugin.py
index e103e4d..c66e6d2 100644
--- a/Scheme/plugin.py
+++ b/Scheme/plugin.py
@@ -152,11 +152,11 @@ DEFAULT_ENV = [
('set!', scm_set),
]
# Add some math operators
-DEFAULT_ENV += map(lambda (x,y):(x, schemify_math(y)), (
+DEFAULT_ENV += map(lambda x:(x[0], schemify_math(x[1])), (
('+', operator.add),
('-', operator.sub),
('*', operator.mul),
- ('/', operator.div),
+ ('/', operator.truediv),
))
DEFAULT_ENV = dict(DEFAULT_ENV)
@@ -216,7 +216,7 @@ def eval_scheme(tree, env=DEFAULT_ENV):
if tree in env:
return env[tree]
else:
- print repr(env)
+ print(repr(env))
raise SchemeException(_('Undefined keyword %s.') % tree)
first = eval_scheme(tree[0])
if callable(first):
diff --git a/Seeks/__init__.py b/Seeks/__init__.py
index 791458e..4526472 100644
--- a/Seeks/__init__.py
+++ b/Seeks/__init__.py
@@ -55,14 +55,15 @@ __contributors__ = {supybot.authors.progval: ['code enhancements',
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Seeks/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Sudo/__init__.py b/Sudo/__init__.py
index 048788a..efe8cac 100644
--- a/Sudo/__init__.py
+++ b/Sudo/__init__.py
@@ -53,14 +53,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Sudo/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/SupyML/__init__.py b/SupyML/__init__.py
index c085adc..c7c5f85 100644
--- a/SupyML/__init__.py
+++ b/SupyML/__init__.py
@@ -54,14 +54,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/SupyML/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/SupyML/plugin.py b/SupyML/plugin.py
index b941f72..53da81f 100644
--- a/SupyML/plugin.py
+++ b/SupyML/plugin.py
@@ -29,9 +29,9 @@
###
import re
+import sys
import copy
import time
-import Queue
import supybot.conf as conf
from xml.dom import minidom
import supybot.world as world
diff --git a/SupySandbox/__init__.py b/SupySandbox/__init__.py
index c62cb78..3068839 100644
--- a/SupySandbox/__init__.py
+++ b/SupySandbox/__init__.py
@@ -54,14 +54,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = 'http://supybot.fr.cr/SupySandbox'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/SupySandbox/plugin.py b/SupySandbox/plugin.py
index 19ca38c..e593824 100644
--- a/SupySandbox/plugin.py
+++ b/SupySandbox/plugin.py
@@ -41,8 +41,8 @@ EVAL_MAXMEMORYBYTES = 75 * 1024 * 1024 # 10 MiB
try:
import sandbox as S
except ImportError:
- print 'You need pysandbox in order to run SupySandbox plugin ' + \
- '[http://github.com/haypo/pysandbox].'
+ print('You need pysandbox in order to run SupySandbox plugin '
+ '[http://github.com/haypo/pysandbox].')
raise
import re
import os
@@ -106,10 +106,10 @@ def evalPython(line, locals=None):
sandbox.execute(
evalPythonInSandbox,
locals={'namespace': locals, 'line': line})
- except BaseException, e:
- print 'Error: [%s] %s' % (e.__class__.__name__, str(e))
+ except BaseException as e:
+ print('Error: [%s] %s' % (e.__class__.__name__, str(e)))
except:
- print 'Error: '
+ print('Error: ')
sys.stdout.flush()
@contextlib.contextmanager
@@ -162,7 +162,7 @@ class SupySandbox(callbacks.Plugin):
Runs Python code safely thanks to pysandbox"""
try:
irc.reply(handle_line(code.replace(' $$ ', '\n')))
- except SandboxError, e:
+ except SandboxError as e:
irc.error('; '.join(e.args))
sandbox = wrap(sandbox, ['text'])
diff --git a/TWSS/__init__.py b/TWSS/__init__.py
index 4d44427..31a7b60 100644
--- a/TWSS/__init__.py
+++ b/TWSS/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/TWSS/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Trigger/__init__.py b/Trigger/__init__.py
index 46a099b..186c496 100644
--- a/Trigger/__init__.py
+++ b/Trigger/__init__.py
@@ -53,14 +53,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = 'http://supybot.fr.cr/Trigger'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Trigger/plugin.py b/Trigger/plugin.py
index 4c837a1..f0f1fc5 100644
--- a/Trigger/plugin.py
+++ b/Trigger/plugin.py
@@ -73,7 +73,7 @@ class Trigger(callbacks.Plugin):
try:
msg.args = (channel,) + msg.args[1:]
self.Proxy(irc.irc, msg, tokens)
- except Exception, e:
+ except Exception as e:
self.log.exception('Error occured while running triggered command:')
def doJoin(self, irc, msg):
self._run(irc, msg, 'join')
diff --git a/Trivia/__init__.py b/Trivia/__init__.py
index 98afc8d..c04fde2 100644
--- a/Trivia/__init__.py
+++ b/Trivia/__init__.py
@@ -54,14 +54,15 @@ if not hasattr(supybot.authors, 'progval'):
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Trivia/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Twitter/__init__.py b/Twitter/__init__.py
index 009dca7..d62c5f4 100644
--- a/Twitter/__init__.py
+++ b/Twitter/__init__.py
@@ -53,14 +53,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Twitter/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Twitter/plugin.py b/Twitter/plugin.py
index ba83372..7df9ff6 100644
--- a/Twitter/plugin.py
+++ b/Twitter/plugin.py
@@ -30,15 +30,12 @@
from __future__ import division
-import config
-import htmlentitydefs
-reload(config)
import re
import sys
import time
+import json
import threading
-import simplejson
import supybot.log as log
import supybot.conf as conf
import supybot.utils as utils
@@ -49,6 +46,11 @@ import supybot.plugins as plugins
import supybot.ircutils as ircutils
import supybot.registry as registry
import supybot.callbacks as callbacks
+if sys.version_info[0] < 3:
+ import htmlentitydefs
+else:
+ import html.entities as htmlentitydefs
+ from imp import reload
try:
from supybot.i18n import PluginInternationalization
from supybot.i18n import internationalizeDocstring
@@ -62,9 +64,10 @@ except:
try:
import twitter
except ImportError:
- raise callbacks.Error, 'You need the python-twitter library.'
+ raise callbacks.Error('You need the python-twitter library.')
reload(twitter)
-if twitter.__version__.split('.') < ['0', '8', '0']:
+if not hasattr(twitter, '__version__') or \
+ twitter.__version__.split('.') < ['0', '8', '0']:
raise ImportError('You current version of python-twitter is to old, '
'you need at least version 0.8.0, because older '
'versions do not support OAuth authentication.')
@@ -93,11 +96,11 @@ class ExtendedApi(twitter.Api):
raise TwitterError("'id' must be an integer")
url = 'http://api.twitter.com/1/statuses/retweet/%s.json' % id
json = self._FetchUrl(url, post_data={'dummy': None})
- data = simplejson.loads(json)
+ data = json.loads(json)
self._CheckForTwitterError(data)
return twitter.Status.NewFromJsonDict(data)
-_tco_link_re = re.compile(u'http://t.co/[a-zA-Z0-9]+')
+_tco_link_re = re.compile('http://t.co/[a-zA-Z0-9]+')
def expandLinks(tweet):
if 'Untiny.plugin' in sys.modules:
def repl(link):
diff --git a/Twitter/test.py b/Twitter/test.py
index c8c55b9..84c1182 100644
--- a/Twitter/test.py
+++ b/Twitter/test.py
@@ -30,7 +30,7 @@
from supybot.test import *
-import plugin
+from . import plugin
class TwitterTestCase(ChannelPluginTestCase):
plugins = ('Twitter', 'Untiny')
diff --git a/TwitterStream/__init__.py b/TwitterStream/__init__.py
index 58a5b57..6c45215 100644
--- a/TwitterStream/__init__.py
+++ b/TwitterStream/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/TwitterStream/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Untiny/__init__.py b/Untiny/__init__.py
index 662160f..4f3f0e9 100644
--- a/Untiny/__init__.py
+++ b/Untiny/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Untiny/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Variables/__init__.py b/Variables/__init__.py
index 3a17806..70c20e1 100644
--- a/Variables/__init__.py
+++ b/Variables/__init__.py
@@ -53,14 +53,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Variables/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/WebLogs/__init__.py b/WebLogs/__init__.py
index a5c9c57..097bb65 100644
--- a/WebLogs/__init__.py
+++ b/WebLogs/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/WebLogs/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/WebLogs/plugin.py b/WebLogs/plugin.py
index 4f29425..67c6b7c 100644
--- a/WebLogs/plugin.py
+++ b/WebLogs/plugin.py
@@ -224,7 +224,7 @@ class WebLogsServerCallback(httpserver.SupyHTTPServerCallback):
page_body = """Here is a list of available logs:"""
for channel in WebLogsMiddleware.get_channel_list():
page_body += '- %s
' % (
- urllib.quote(channel), channel)
+ utils.web.urlquote(channel), channel)
page_body += '
'
self.wfile.write(page_template %
{'title': 'Index', 'body': page_body})
@@ -238,7 +238,7 @@ class WebLogsServerCallback(httpserver.SupyHTTPServerCallback):
self.wfile.write('Bad URL.')
return
assert mode in ('html', 'json')
- channel = urllib.unquote(channel)
+ channel = utils.web.urlunquote(channel)
if channel not in WebLogsMiddleware.get_channel_list():
self.send_response(404)
self.send_header('Content-type', 'text/plain')
diff --git a/WebStats/__init__.py b/WebStats/__init__.py
index 7121d4a..4026c4f 100644
--- a/WebStats/__init__.py
+++ b/WebStats/__init__.py
@@ -53,14 +53,15 @@ __contributors__ = {}
__url__ = 'http://supybot.fr.cr/WebStats'
# 'http://supybot.com/Members/yourname/WebStats/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/WebStats/plugin.py b/WebStats/plugin.py
index 03d975f..6891dbc 100644
--- a/WebStats/plugin.py
+++ b/WebStats/plugin.py
@@ -74,9 +74,9 @@ world.webStatsCacheLinks = {}
testing = world.testing
def getTemplate(name):
- if sys.modules.has_key('WebStats.templates.skeleton'):
+ if 'WebStats.templates.skeleton' in sys.modules:
reload(sys.modules['WebStats.templates.skeleton'])
- if sys.modules.has_key('WebStats.templates.%s' % name):
+ if 'WebStats.templates.%s' % name in sys.modules:
reload(sys.modules['WebStats.templates.%s' % name])
module = __import__('WebStats.templates.%s' % name)
return getattr(getattr(module, 'templates'), name)
@@ -155,7 +155,7 @@ class WebStatsServerCallback(httpserver.SupyHTTPServerCallback):
response = 404
content_type = 'text/html'
output = getTemplate('error404').get(not testing)
- except FooException, e:
+ except FooException as e:
response = 500
content_type = 'text/html'
if output == '':
@@ -167,7 +167,7 @@ class WebStatsServerCallback(httpserver.SupyHTTPServerCallback):
self.send_response(response)
self.send_header('Content-type', content_type)
self.end_headers()
- self.wfile.write(output)
+ self.wfile.write(output.encode())
class WebStatsDB:
def __init__(self):
diff --git a/WebStats/templates/index.py b/WebStats/templates/index.py
index 6650804..1e02f9f 100644
--- a/WebStats/templates/index.py
+++ b/WebStats/templates/index.py
@@ -1,4 +1,4 @@
-import skeleton
+from . import skeleton
from WebStats.plugin import _
content = """
diff --git a/Website/__init__.py b/Website/__init__.py
index d4f1369..58e45f1 100644
--- a/Website/__init__.py
+++ b/Website/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Website/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Website/plugin.py b/Website/plugin.py
index 5d051b3..83f815d 100644
--- a/Website/plugin.py
+++ b/Website/plugin.py
@@ -29,8 +29,8 @@
###
import re
+import sys
import json
-import urllib
import supybot.world as world
import supybot.utils as utils
from supybot import httpserver
@@ -41,6 +41,11 @@ import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
+if sys.version_info[0] < 3:
+ from urllib import urlencode
+else:
+ from urllib.parse import urlencode
+
_ = PluginInternationalization('Website')
class WebsiteCallback(httpserver.SupyHTTPServerCallback):
@@ -59,8 +64,11 @@ class WebsiteCallback(httpserver.SupyHTTPServerCallback):
def query(path, args={}):
args = dict([(x,y) for x,y in args.items() if y is not None])
- url = 'http://supybot.fr.cr/api%s?%s' % (path, urllib.urlencode(args))
- return json.load(utils.web.getUrlFd(url))
+ url = 'http://supybot.fr.cr/api%s?%s' % (path, urlencode(args))
+ data = utils.web.getUrl(url)
+ if sys.version_info[0] >= 3:
+ data = data.decode()
+ return json.loads(data)
instance = None
diff --git a/WikiTrans/__init__.py b/WikiTrans/__init__.py
index e25e7a1..a29c340 100644
--- a/WikiTrans/__init__.py
+++ b/WikiTrans/__init__.py
@@ -50,14 +50,15 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/WikiTrans/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/WikiTrans/test.py b/WikiTrans/test.py
index c835d2c..f132216 100644
--- a/WikiTrans/test.py
+++ b/WikiTrans/test.py
@@ -29,6 +29,8 @@
###
+from __future__ import unicode_literals
+
from supybot.test import *
class WikiTransTestCase(PluginTestCase):
@@ -41,7 +43,7 @@ class WikiTransTestCase(PluginTestCase):
self.assertResponse('translate en fr IRC bot', 'Robot IRC')
self.assertResponse('translate fr en robot IRC', 'Internet Relay Chat bot')
- self.assertResponse(u'translate fr en Chef-d\'œuvre', 'Masterpiece')
+ self.assertResponse('translate fr en Chef-d\'œuvre', 'Masterpiece')
self.assertResponse('translate en fr Masterpiece', 'Chef-d\'œuvre')
self.assertResponse('translate en fr Master (Doctor Who)',
diff --git a/Wikipedia/__init__.py b/Wikipedia/__init__.py
index ffdfcd0..c9e41d1 100644
--- a/Wikipedia/__init__.py
+++ b/Wikipedia/__init__.py
@@ -55,14 +55,15 @@ __contributors__ = {supybot.authors.progval: ['enhance configurability',
# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Wikipedia/download'
-import config
-import plugin
+from . import config
+from . import plugin
+from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
- import test
+ from . import test
Class = plugin.Class
configure = config.configure
diff --git a/Wikipedia/plugin.py b/Wikipedia/plugin.py
index e8e4bdd..b200163 100644
--- a/Wikipedia/plugin.py
+++ b/Wikipedia/plugin.py
@@ -31,9 +31,9 @@
import re
+import sys
import string
import urllib
-import StringIO
import lxml.html
from lxml import etree
import supybot.utils as utils
@@ -41,6 +41,10 @@ from supybot.commands import *
import supybot.plugins as plugins
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
+if sys.version_info[0] < 3:
+ import StringIO
+else:
+ from io import StringIO
try:
from supybot.i18n import PluginInternationalization
from supybot.i18n import internationalizeDocstring