diff --git a/plugins/Google/plugin.py b/plugins/Google/plugin.py index f8764877b..0d87ab8a3 100644 --- a/plugins/Google/plugin.py +++ b/plugins/Google/plugin.py @@ -242,54 +242,6 @@ class Google(callbacks.PluginRegexp): irc.reply(url.encode('utf-8'), prefixNick=False) googleSnarfer = urlSnarfer(googleSnarfer) - def _googleUrl(self, s): - s = s.replace('+', '%2B') - s = s.replace(' ', '+') - url = r'http://google.com/search?q=' + s - return url - - _calcRe = re.compile(r'(.*?)', re.I) - _calcSupRe = re.compile(r'(.*?)', re.I) - _calcFontRe = re.compile(r'(.*?)') - _calcTimesRe = re.compile(r'&(?:times|#215);') - def calc(self, irc, msg, args, expr): - """ - - Uses Google's calculator to calculate the value of . - """ - url = self._googleUrl(expr) - html = utils.web.getUrl(url) - match = self._calcRe.search(html) - if match is not None: - s = match.group(1) - s = self._calcSupRe.sub(r'^(\1)', s) - s = self._calcFontRe.sub(r',', s) - s = self._calcTimesRe.sub(r'*', s) - irc.reply(s) - else: - irc.reply('Google\'s calculator didn\'t come up with anything.') - calc = wrap(calc, ['text']) - - _phoneRe = re.compile(r'Phonebook.*?(.*?) - - Looks up on Google. - """ - url = self._googleUrl(phonenumber) - html = utils.web.getUrl(url) - m = self._phoneRe.search(html) - if m is not None: - s = m.group(1) - s = s.replace('', '') - s = s.replace('', '') - s = utils.web.htmlToText(s) - irc.reply(s) - else: - irc.reply('Google\'s phonebook didn\'t come up with anything.') - phonebook = wrap(phonebook, ['text']) - - Class = Google diff --git a/plugins/Google/test.py b/plugins/Google/test.py index 6f005a91c..4b96da719 100644 --- a/plugins/Google/test.py +++ b/plugins/Google/test.py @@ -33,21 +33,6 @@ from supybot.test import * class GoogleTestCase(ChannelPluginTestCase): plugins = ('Google',) if network: - def testCalcHandlesMultiplicationSymbol(self): - self.assertNotRegexp('google calc seconds in a century', r'215') - - def testCalc(self): - self.assertNotRegexp('google calc e^(i*pi)+1', r'didn\'t') - self.assertNotRegexp('google calc 1 usd in gbp', r'didn\'t') - - def testHtmlHandled(self): - self.assertNotRegexp('google calc ' - 'the speed of light ' - 'in microns / fortnight', '') - self.assertNotRegexp('google calc ' - 'the speed of light ' - 'in microns / fortnight', '×') - def testSearch(self): self.assertNotError('google foo') self.assertRegexp('google dupa', r'dupa') @@ -58,7 +43,4 @@ class GoogleTestCase(ChannelPluginTestCase): self.assertRegexp('fight supybot moobot', r'.*supybot.*: \d+') self.assertNotError('fight ... !') - def testCalcDoesNotHaveExtraSpaces(self): - self.assertNotRegexp('google calc 1000^2', r'\s+,\s+') - # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: