Skip to content

Commit c27b77a

Browse files
committed
Uniformly use """...""" instead of '''...''' for comments.
1 parent b7d10bc commit c27b77a

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

roundup/backends/back_sqlite.py

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
# $Id: back_sqlite.py,v 1.51 2007-06-21 07:35:50 schlatterbeck Exp $
2-
'''Implements a backend for SQLite.
1+
"""Implements a backend for SQLite.
32
43
See https://pysqlite.sourceforge.net/ for pysqlite info
54
65
76
NOTE: we use the rdbms_common table creation methods which define datatypes
87
for the columns, but sqlite IGNORES these specifications.
9-
'''
8+
"""
109
__docformat__ = 'restructuredtext'
1110

1211
import os, base64, marshal, shutil, time, logging
@@ -90,10 +89,10 @@ def sqlite_busy_handler(self, data, table, count):
9089
return 1
9190

9291
def sql_open_connection(self):
93-
'''Open a standard, non-autocommitting connection.
92+
"""Open a standard, non-autocommitting connection.
9493
9594
pysqlite will automatically BEGIN TRANSACTION for us.
96-
'''
95+
"""
9796
# make sure the database directory exists
9897
# database itself will be created by sqlite if needed
9998
if not os.path.isdir(self.config.DATABASE):
@@ -165,14 +164,14 @@ def fix_version_3_tables(self):
165164
pass
166165

167166
def update_class(self, spec, old_spec, force=0, adding_v2=0):
168-
''' Determine the differences between the current spec and the
167+
""" Determine the differences between the current spec and the
169168
database version of the spec, and update where necessary.
170169
171170
If 'force' is true, update the database anyway.
172171
173172
SQLite doesn't have ALTER TABLE, so we have to copy and
174173
regenerate the tables with the new schema.
175-
'''
174+
"""
176175
new_has = spec.properties.has_key
177176
new_spec = spec.schema()
178177
new_spec[1].sort()
@@ -222,8 +221,8 @@ def update_class(self, spec, old_spec, force=0, adding_v2=0):
222221

223222
# re-create and populate the new table
224223
self.create_multilink_table(spec, propname)
225-
sql = '''insert into %s (linkid, nodeid) values
226-
(%s, %s)'''%(tn, self.arg, self.arg)
224+
sql = """insert into %s (linkid, nodeid) values
225+
(%s, %s)"""%(tn, self.arg, self.arg)
227226
for linkid, nodeid in rows:
228227
self.sql(sql, (int(linkid), int(nodeid)))
229228
elif old_has(propname):
@@ -296,19 +295,19 @@ def update_class(self, spec, old_spec, force=0, adding_v2=0):
296295
return 1
297296

298297
def sql_close(self):
299-
''' Squash any error caused by us already having closed the
298+
""" Squash any error caused by us already having closed the
300299
connection.
301-
'''
300+
"""
302301
try:
303302
self.conn.close()
304303
except sqlite.ProgrammingError, value:
305304
if str(value) != 'close failed - Connection is closed.':
306305
raise
307306

308307
def sql_rollback(self):
309-
''' Squash any error caused by us having closed the connection (and
308+
""" Squash any error caused by us having closed the connection (and
310309
therefore not having anything to roll back)
311-
'''
310+
"""
312311
try:
313312
self.conn.rollback()
314313
except sqlite.ProgrammingError, value:
@@ -319,10 +318,10 @@ def __repr__(self):
319318
return '<roundlite 0x%x>'%id(self)
320319

321320
def sql_commit(self, fail_ok=False):
322-
''' Actually commit to the database.
321+
""" Actually commit to the database.
323322
324323
Ignore errors if there's nothing to commit.
325-
'''
324+
"""
326325
try:
327326
self.conn.commit()
328327
except sqlite.DatabaseError, error:
@@ -340,8 +339,8 @@ def sql_index_exists(self, table_name, index_name):
340339

341340
# old-skool id generation
342341
def newid(self, classname):
343-
''' Generate a new id for the given class
344-
'''
342+
""" Generate a new id for the given class
343+
"""
345344
# get the next ID
346345
sql = 'select num from ids where name=%s'%self.arg
347346
self.sql(sql, (classname, ))
@@ -356,10 +355,10 @@ def newid(self, classname):
356355
return str(newid)
357356

358357
def setid(self, classname, setid):
359-
''' Set the id counter: used during import of database
358+
""" Set the id counter: used during import of database
360359
361360
We add one to make it behave like the sequences in postgres.
362-
'''
361+
"""
363362
sql = 'update ids set num=%s where name=%s'%(self.arg, self.arg)
364363
vals = (int(setid)+1, classname)
365364
self.sql(sql, vals)
@@ -378,8 +377,8 @@ def create_class(self, spec):
378377

379378
if sqlite_version in (2,3):
380379
def load_journal(self, classname, cols, nodeid):
381-
'''We need to turn the sqlite3.Row into a tuple so it can be
382-
unpacked'''
380+
"""We need to turn the sqlite3.Row into a tuple so it can be
381+
unpacked"""
383382
l = rdbms_common.Database.load_journal(self,
384383
classname, cols, nodeid)
385384
cols = range(5)
@@ -388,9 +387,9 @@ def load_journal(self, classname, cols, nodeid):
388387
class sqliteClass:
389388
def filter(self, search_matches, filterspec, sort=(None,None),
390389
group=(None,None)):
391-
''' If there's NO matches to a fetch, sqlite returns NULL
390+
""" If there's NO matches to a fetch, sqlite returns NULL
392391
instead of nothing
393-
'''
392+
"""
394393
return filter(None, rdbms_common.Class.filter(self, search_matches,
395394
filterspec, sort=sort, group=group))
396395

0 commit comments

Comments
 (0)