Remove Python2.4-specific code.

This commit is contained in:
Valentin Lorentz 2013-07-13 17:28:21 +02:00
parent 9bfec720f5
commit 38bab185a9
10 changed files with 10 additions and 49 deletions

View File

@ -46,19 +46,6 @@ except:
_ = lambda x:x
internationalizeDocstring = lambda x:x
# builtin any is overwritten by callbacks... and python2.4 doesn't have it
def _any(iterable):
for element in iterable:
if element:
return True
return False
# for consistency with above, and for python2.4
def _all(iterable):
for element in iterable:
if not element:
return False
return True
class Conditional(callbacks.Plugin):
"""Add the help for "@plugin help Conditional" here
@ -98,7 +85,7 @@ class Conditional(callbacks.Plugin):
Returns true if all conditions supplied evaluate to true.
"""
if _all(conds):
if __builtins__.all(conds):
irc.reply("true")
else:
irc.reply("false")
@ -110,7 +97,7 @@ class Conditional(callbacks.Plugin):
Returns true if any one of conditions supplied evaluates to true.
"""
if _any(conds):
if __builtins__.any(conds):
irc.reply("true")
else:
irc.reply("false")

View File

@ -44,10 +44,7 @@ import supybot.httpserver as httpserver
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Factoids')
try:
import sqlite3
except ImportError:
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
import sqlite3
import re
from supybot.utils.seq import dameraulevenshtein

View File

@ -31,10 +31,7 @@
from supybot.test import *
import supybot.conf as conf
try:
import sqlite3
except ImportError:
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
import sqlite3
class FactoidsTestCase(ChannelPluginTestCase):
plugins = ('Factoids',)

View File

@ -41,10 +41,7 @@ import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Karma')
try:
import sqlite3
except ImportError:
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
import sqlite3
class SqliteKarmaDB(object):
def __init__(self, filename):

View File

@ -29,10 +29,7 @@
from supybot.test import *
try:
import sqlite3
except ImportError:
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
import sqlite3
class KarmaTestCase(ChannelPluginTestCase):
plugins = ('Karma',)

View File

@ -58,10 +58,7 @@ except:
#'plugin. Download it at ' \
#'<http://code.google.com/p/pysqlite/>'
try:
import sqlite3
except ImportError:
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
import sqlite3
# these are needed cuz we are overriding getdb
import threading

View File

@ -30,10 +30,7 @@
from supybot.test import *
try:
import sqlite3
except ImportError:
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
import sqlite3
class MessageParserTestCase(ChannelPluginTestCase):

View File

@ -98,10 +98,7 @@ class SqliteMoobotDB(object):
self.dbs.clear()
def _getDb(self, channel):
try:
import sqlite3
except ImportError:
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
import sqlite3
if channel in self.dbs:
return self.dbs[channel]

View File

@ -43,10 +43,7 @@ import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('QuoteGrabs')
try:
import sqlite3
except ImportError:
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
import sqlite3
import traceback

View File

@ -843,8 +843,6 @@ class Databases(registry.SpaceSeparatedListOfStrings):
v.insert(0, 'sqlite')
if 'sqlite3' in sys.modules:
v.insert(0, 'sqlite3')
if 'pysqlite2' in sys.modules: # for python 2.4
v.insert(0, 'sqlite3')
return v
def serialize(self):