From 4cdda19636df6c93447e217b90d543306cab7f99 Mon Sep 17 00:00:00 2001 From: mutantmonkey Date: Mon, 2 Jun 2014 11:12:15 -0700 Subject: [PATCH] remove broken modules These can be added back if they begin working reliably again. --- modules/catfacts.py | 26 -------------------------- modules/short.py | 29 ----------------------------- modules/test/test_catfacts.py | 22 ---------------------- modules/test/test_short.py | 24 ------------------------ 4 files changed, 101 deletions(-) delete mode 100644 modules/catfacts.py delete mode 100644 modules/short.py delete mode 100644 modules/test/test_catfacts.py delete mode 100644 modules/test/test_short.py diff --git a/modules/catfacts.py b/modules/catfacts.py deleted file mode 100644 index 71bc695..0000000 --- a/modules/catfacts.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python - -import web - -def catfacts_ajax(): - uri = 'http://facts.cat/getfact' - bytes = web.get(uri) - return web.json(bytes) - -def catfacts_get(): - fact = catfacts_ajax() - try: - return "{0} (#{1:d})".format(fact['factoid'], fact['id']) - except IndexError: - return None - except TypeError: - print(fact) - return False - -def catfacts(phenny, input): - """.catfact - Receive a cat fact.""" - - fact = catfacts_get() - if fact: - phenny.reply(fact) -catfacts.commands = ['catfact', 'catfacts'] diff --git a/modules/short.py b/modules/short.py deleted file mode 100644 index 8736ed2..0000000 --- a/modules/short.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/python3 -""" -short.py - vtluug url shortner -author: andreim -""" - -from tools import GrumbleError -import web -import json - - -def short(phenny, input): - """.short - Shorten a URL.""" - - url = input.group(2) - if not url: - phenny.reply("No URL provided. CAN I HAS?") - return - - try: - r = web.post("http://vtlu.ug/vtluug", {'lurl': url}) - except: - raise GrumbleError("THE INTERNET IS FUCKING BROKEN. Please try again later.") - - phenny.reply(r) -short.rule = (['short'], r'(.*)') - -if __name__ == '__main__': - print(__doc__.strip()) diff --git a/modules/test/test_catfacts.py b/modules/test/test_catfacts.py deleted file mode 100644 index 508fddf..0000000 --- a/modules/test/test_catfacts.py +++ /dev/null @@ -1,22 +0,0 @@ -""" -test_catfacts.py - tests for the cat facts module -author: mutantmonkey -""" - -import re -import unittest -from mock import MagicMock -from modules.catfacts import catfacts - - -class TestCatfacts(unittest.TestCase): - def setUp(self): - self.phenny = MagicMock() - - def test_catfacts(self): - catfacts(self.phenny, None) - - out = self.phenny.reply.call_args[0][0] - m = re.match('^.* \(#[0-9]+\)$', out, - flags=re.UNICODE) - self.assertTrue(m) diff --git a/modules/test/test_short.py b/modules/test/test_short.py deleted file mode 100644 index 9e5e324..0000000 --- a/modules/test/test_short.py +++ /dev/null @@ -1,24 +0,0 @@ -""" -test_short.py - tests for the vtluug url shortener module -author: mutantmonkey -""" - -import unittest -from mock import MagicMock, Mock -from modules.short import short - - -class TestShort(unittest.TestCase): - def setUp(self): - self.phenny = MagicMock() - - def test_short(self): - input = Mock(group=lambda x: 'http://vtluug.org/') - short(self.phenny, input) - self.phenny.reply.assert_called_once_with('http://vtlu.ug/bLQYAy') - - def test_short_none(self): - input = Mock(group=lambda x: None) - short(self.phenny, input) - self.phenny.reply.assert_called_once_with( - "No URL provided. CAN I HAS?")