diff --git a/WolframAlpha/.travis.yml b/WolframAlpha/.travis.yml new file mode 100644 index 0000000..d5cb448 --- /dev/null +++ b/WolframAlpha/.travis.yml @@ -0,0 +1,18 @@ +language: python +python: + - "2.7" + - "3.4" + - "pypy" +# command to install dependencies, +install: + - pip install -vr requirements.txt||true +# command to run tests, e.g. python setup.py test +script: + - echo $TRAVIS_PYTHON_VERSION + - cd .. && supybot-test WolframAlpha +notifications: + email: false + irc: "irc.efnet.net#supybot" + webhooks: http://n.tkte.ch/h/3527/rm2ycnsYzBtH8Qqg2AAmqjTM +matrix: + fast_finish: true diff --git a/LICENSE.txt b/WolframAlpha/LICENSE.txt similarity index 100% rename from LICENSE.txt rename to WolframAlpha/LICENSE.txt diff --git a/README.md b/WolframAlpha/README.md similarity index 100% rename from README.md rename to WolframAlpha/README.md diff --git a/__init__.py b/WolframAlpha/__init__.py similarity index 94% rename from __init__.py rename to WolframAlpha/__init__.py index 4506304..744bb44 100644 --- a/__init__.py +++ b/WolframAlpha/__init__.py @@ -12,6 +12,7 @@ here. This should describe *what* the plugin does. import supybot import supybot.world as world +import importlib # Use this for the version of this plugin. You may wish to put a CVS keyword # in here if you're keeping the plugin in CVS or some similar system. @@ -32,8 +33,8 @@ from . import plugin from imp import reload # In case we're being reloaded. -reload(config) -reload(plugin) +importlib.reload(config) +importlib.reload(plugin) # 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! diff --git a/config.py b/WolframAlpha/config.py similarity index 100% rename from config.py rename to WolframAlpha/config.py diff --git a/plugin.py b/WolframAlpha/plugin.py similarity index 93% rename from plugin.py rename to WolframAlpha/plugin.py index dcf9995..f764ceb 100644 --- a/plugin.py +++ b/WolframAlpha/plugin.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ### # Copyright (c) 2012-2014, spline # All rights reserved. @@ -110,8 +109,8 @@ class WolframAlpha(callbacks.Plugin): if document.attrib['success'] == 'false' and document.attrib['error'] == 'true': errormsgs = [] for error in document.findall('.//error'): - errorcode = error.find('code').text.encode('utf-8') - errormsg = error.find('msg').text.encode('utf-8') + errorcode = error.find('code').text + errormsg = error.find('msg').text errormsgs.append("{0} - {1}".format(errorcode, errormsg)) # log and report to irc if we have these. self.log.debug("ERROR processing request for: {0} message: {1}".format(optinput, errormsgs)) @@ -121,13 +120,13 @@ class WolframAlpha(callbacks.Plugin): elif document.attrib['success'] == 'false' and document.attrib['error'] == 'false': errormsgs = [] # list to contain whatever is there. for error in document.findall('.//futuretopic'): - errormsg = error.attrib['msg'].encode('utf-8') + errormsg = error.attrib['msg'] errormsgs.append("FUTURE TOPIC: {0}".format(errormsg)) for error in document.findall('.//didyoumeans'): - errormsg = error.find('didyoumean').text.encode('utf-8') + errormsg = error.find('didyoumean').text errormsgs.append("Did you mean? {0}".format(errormsg)) for error in document.findall('.//tips'): - errormsg = error.find('tip').attrib['text'].text.encode('utf-8') + errormsg = error.find('tip').attrib['text'].text errormsgs.append("TIPS: {0}".format(errormsg)) # now output the messages to irc and log. self.log.debug("ERROR with input: {0} API returned: {1}".format(optinput, errormsgs)) @@ -140,7 +139,7 @@ class WolframAlpha(callbacks.Plugin): outputlist = {} # each answer has a different amount of pods. for pod in document.findall('.//pod'): - title = pod.attrib['title'].encode('utf-8') # title of it. + title = pod.attrib['title'] # title of it. position = int(pod.attrib['position']) # store pods int when we sort. outputlist[position] = title # pu for plaintext in pod.findall('.//plaintext'): @@ -221,20 +220,16 @@ class WolframAlpha(callbacks.Plugin): # each answer has a different amount of pods. for pod in document.findall('.//pod'): - title = pod.attrib['title'].encode('utf-8') # title of it. + title = pod.attrib['title'] # title of it. if title == "Result": for plaintext in pod.findall('.//plaintext'): - print(plaintext.text) + print((plaintext.text)) if 'not compatible' in plaintext.text: irc.reply('Conversion from btc to %s not available' % currency) else: converted_amount = plaintext.text.split('(')[0].strip() - if '\:' in converted_amount: - converted_amount = converted_amount.replace('\:','\\u').decode("unicode_escape") - irc.reply('%s%d = %s' % ('\\u0e3f'.decode("unicode_escape"),amount, converted_amount)) - - + irc.reply('%s%d = %s' % ('\u0e3f', amount, converted_amount)) btc = wrap(btc,['float', 'text']) diff --git a/requirements.txt b/WolframAlpha/requirements.txt similarity index 100% rename from requirements.txt rename to WolframAlpha/requirements.txt diff --git a/test.py b/WolframAlpha/test.py similarity index 100% rename from test.py rename to WolframAlpha/test.py