mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-15 07:04:53 +01:00
Factoids & Karma & MessageParser & MoobotFactoids & QuoteGrabs: Fix Pypy3 support (without breaking Python 2 support).
This commit is contained in:
parent
907ede8035
commit
35bfd76852
@ -29,6 +29,7 @@
|
||||
###
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import string
|
||||
import urllib
|
||||
@ -217,10 +218,12 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
def makeDb(self, filename):
|
||||
if os.path.exists(filename):
|
||||
db = sqlite3.connect(filename)
|
||||
db.text_factory = str
|
||||
if sys.version_info[0] < 3:
|
||||
db.text_factory = str
|
||||
return db
|
||||
db = sqlite3.connect(filename)
|
||||
db.text_factory = str
|
||||
if sys.version_info[0] < 3:
|
||||
db.text_factory = str
|
||||
cursor = db.cursor()
|
||||
cursor.execute("""CREATE TABLE keys (
|
||||
id INTEGER PRIMARY KEY,
|
||||
|
@ -29,6 +29,7 @@
|
||||
###
|
||||
|
||||
import os
|
||||
import sys
|
||||
import csv
|
||||
|
||||
import supybot.conf as conf
|
||||
@ -58,10 +59,13 @@ class SqliteKarmaDB(object):
|
||||
return self.dbs[filename]
|
||||
if os.path.exists(filename):
|
||||
db = sqlite3.connect(filename, check_same_thread=False)
|
||||
db.text_factory = str
|
||||
if sys.version_info[0] < 3:
|
||||
db.text_factory = str
|
||||
self.dbs[filename] = db
|
||||
return db
|
||||
db = sqlite3.connect(filename, check_same_thread=False)
|
||||
if sys.version_info[0] < 3:
|
||||
db.text_factory = str
|
||||
self.dbs[filename] = db
|
||||
cursor = db.cursor()
|
||||
cursor.execute("""CREATE TABLE karma (
|
||||
|
@ -39,6 +39,7 @@ import supybot.ircdb as ircdb
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
try:
|
||||
@ -80,10 +81,12 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
"""Create the database and connect to it."""
|
||||
if os.path.exists(filename):
|
||||
db = sqlite3.connect(filename)
|
||||
db.text_factory = str
|
||||
if sys.version_info[0] < 3:
|
||||
db.text_factory = str
|
||||
return db
|
||||
db = sqlite3.connect(filename)
|
||||
db.text_factory = str
|
||||
if sys.version_info[0] < 3:
|
||||
db.text_factory = str
|
||||
cursor = db.cursor()
|
||||
cursor.execute("""CREATE TABLE triggers (
|
||||
id INTEGER PRIMARY KEY,
|
||||
|
@ -28,6 +28,7 @@
|
||||
###
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import string
|
||||
|
||||
@ -106,11 +107,13 @@ class SqliteMoobotDB(object):
|
||||
|
||||
if os.path.exists(filename):
|
||||
db = sqlite3.connect(filename, check_same_thread=False)
|
||||
db.text_factory = str
|
||||
if sys.version_info[0] < 3:
|
||||
db.text_factory = str
|
||||
self.dbs[channel] = db
|
||||
return db
|
||||
db = sqlite3.connect(filename, check_same_thread=False)
|
||||
db.text_factory = str
|
||||
if sys.version_info[0] < 3:
|
||||
db.text_factory = str
|
||||
self.dbs[channel] = db
|
||||
cursor = db.cursor()
|
||||
cursor.execute("""CREATE TABLE factoids (
|
||||
|
@ -82,12 +82,14 @@ class SqliteQuoteGrabsDB(object):
|
||||
return self.dbs[filename]
|
||||
if os.path.exists(filename):
|
||||
db = sqlite3.connect(filename)
|
||||
db.text_factory = str
|
||||
if sys.version_info[0] < 3:
|
||||
db.text_factory = str
|
||||
db.create_function('nickeq', 2, p)
|
||||
self.dbs[filename] = db
|
||||
return db
|
||||
db = sqlite3.connect(filename)
|
||||
db.text_factory = str
|
||||
if sys.version_info[0] < 3:
|
||||
db.text_factory = str
|
||||
db.create_function('nickeq', 2, p)
|
||||
self.dbs[filename] = db
|
||||
cursor = db.cursor()
|
||||
|
Loading…
Reference in New Issue
Block a user