mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-19 08:59:27 +01:00
Remove Python2.4-specific code.
This commit is contained in:
parent
9bfec720f5
commit
38bab185a9
@ -46,19 +46,6 @@ except:
|
|||||||
_ = lambda x:x
|
_ = lambda x:x
|
||||||
internationalizeDocstring = 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):
|
class Conditional(callbacks.Plugin):
|
||||||
"""Add the help for "@plugin help Conditional" here
|
"""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.
|
Returns true if all conditions supplied evaluate to true.
|
||||||
"""
|
"""
|
||||||
if _all(conds):
|
if __builtins__.all(conds):
|
||||||
irc.reply("true")
|
irc.reply("true")
|
||||||
else:
|
else:
|
||||||
irc.reply("false")
|
irc.reply("false")
|
||||||
@ -110,7 +97,7 @@ class Conditional(callbacks.Plugin):
|
|||||||
|
|
||||||
Returns true if any one of conditions supplied evaluates to true.
|
Returns true if any one of conditions supplied evaluates to true.
|
||||||
"""
|
"""
|
||||||
if _any(conds):
|
if __builtins__.any(conds):
|
||||||
irc.reply("true")
|
irc.reply("true")
|
||||||
else:
|
else:
|
||||||
irc.reply("false")
|
irc.reply("false")
|
||||||
|
@ -44,10 +44,7 @@ import supybot.httpserver as httpserver
|
|||||||
from supybot.i18n import PluginInternationalization, internationalizeDocstring
|
from supybot.i18n import PluginInternationalization, internationalizeDocstring
|
||||||
_ = PluginInternationalization('Factoids')
|
_ = PluginInternationalization('Factoids')
|
||||||
|
|
||||||
try:
|
import sqlite3
|
||||||
import sqlite3
|
|
||||||
except ImportError:
|
|
||||||
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from supybot.utils.seq import dameraulevenshtein
|
from supybot.utils.seq import dameraulevenshtein
|
||||||
|
@ -31,10 +31,7 @@
|
|||||||
from supybot.test import *
|
from supybot.test import *
|
||||||
import supybot.conf as conf
|
import supybot.conf as conf
|
||||||
|
|
||||||
try:
|
import sqlite3
|
||||||
import sqlite3
|
|
||||||
except ImportError:
|
|
||||||
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
|
|
||||||
|
|
||||||
class FactoidsTestCase(ChannelPluginTestCase):
|
class FactoidsTestCase(ChannelPluginTestCase):
|
||||||
plugins = ('Factoids',)
|
plugins = ('Factoids',)
|
||||||
|
@ -41,10 +41,7 @@ import supybot.callbacks as callbacks
|
|||||||
from supybot.i18n import PluginInternationalization, internationalizeDocstring
|
from supybot.i18n import PluginInternationalization, internationalizeDocstring
|
||||||
_ = PluginInternationalization('Karma')
|
_ = PluginInternationalization('Karma')
|
||||||
|
|
||||||
try:
|
import sqlite3
|
||||||
import sqlite3
|
|
||||||
except ImportError:
|
|
||||||
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
|
|
||||||
|
|
||||||
class SqliteKarmaDB(object):
|
class SqliteKarmaDB(object):
|
||||||
def __init__(self, filename):
|
def __init__(self, filename):
|
||||||
|
@ -29,10 +29,7 @@
|
|||||||
|
|
||||||
from supybot.test import *
|
from supybot.test import *
|
||||||
|
|
||||||
try:
|
import sqlite3
|
||||||
import sqlite3
|
|
||||||
except ImportError:
|
|
||||||
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
|
|
||||||
|
|
||||||
class KarmaTestCase(ChannelPluginTestCase):
|
class KarmaTestCase(ChannelPluginTestCase):
|
||||||
plugins = ('Karma',)
|
plugins = ('Karma',)
|
||||||
|
@ -58,10 +58,7 @@ except:
|
|||||||
#'plugin. Download it at ' \
|
#'plugin. Download it at ' \
|
||||||
#'<http://code.google.com/p/pysqlite/>'
|
#'<http://code.google.com/p/pysqlite/>'
|
||||||
|
|
||||||
try:
|
import sqlite3
|
||||||
import sqlite3
|
|
||||||
except ImportError:
|
|
||||||
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
|
|
||||||
|
|
||||||
# these are needed cuz we are overriding getdb
|
# these are needed cuz we are overriding getdb
|
||||||
import threading
|
import threading
|
||||||
|
@ -30,10 +30,7 @@
|
|||||||
|
|
||||||
from supybot.test import *
|
from supybot.test import *
|
||||||
|
|
||||||
try:
|
import sqlite3
|
||||||
import sqlite3
|
|
||||||
except ImportError:
|
|
||||||
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
|
|
||||||
|
|
||||||
|
|
||||||
class MessageParserTestCase(ChannelPluginTestCase):
|
class MessageParserTestCase(ChannelPluginTestCase):
|
||||||
|
@ -98,10 +98,7 @@ class SqliteMoobotDB(object):
|
|||||||
self.dbs.clear()
|
self.dbs.clear()
|
||||||
|
|
||||||
def _getDb(self, channel):
|
def _getDb(self, channel):
|
||||||
try:
|
import sqlite3
|
||||||
import sqlite3
|
|
||||||
except ImportError:
|
|
||||||
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
|
|
||||||
|
|
||||||
if channel in self.dbs:
|
if channel in self.dbs:
|
||||||
return self.dbs[channel]
|
return self.dbs[channel]
|
||||||
|
@ -43,10 +43,7 @@ import supybot.callbacks as callbacks
|
|||||||
from supybot.i18n import PluginInternationalization, internationalizeDocstring
|
from supybot.i18n import PluginInternationalization, internationalizeDocstring
|
||||||
_ = PluginInternationalization('QuoteGrabs')
|
_ = PluginInternationalization('QuoteGrabs')
|
||||||
|
|
||||||
try:
|
import sqlite3
|
||||||
import sqlite3
|
|
||||||
except ImportError:
|
|
||||||
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
|
|
||||||
|
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
@ -843,8 +843,6 @@ class Databases(registry.SpaceSeparatedListOfStrings):
|
|||||||
v.insert(0, 'sqlite')
|
v.insert(0, 'sqlite')
|
||||||
if 'sqlite3' in sys.modules:
|
if 'sqlite3' in sys.modules:
|
||||||
v.insert(0, 'sqlite3')
|
v.insert(0, 'sqlite3')
|
||||||
if 'pysqlite2' in sys.modules: # for python 2.4
|
|
||||||
v.insert(0, 'sqlite3')
|
|
||||||
return v
|
return v
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user