3434 'WHERE chain = ?' ),
3535 'draw_count' : ('SELECT COUNT(*) FROM [{table}] '
3636 'WHERE chain = ?' ),
37- ## Named placeholders are used in the selection templates because
38- ## some values occur more than once in the same template.
37+ # Named placeholders are used in the selection templates because
38+ # some values occur more than once in the same template.
3939 'select' : ('SELECT * FROM [{table}] '
4040 'WHERE (chain = :chain)' ),
4141 'select_burn' : ('SELECT * FROM [{table}] '
@@ -71,6 +71,7 @@ class SQLite(base.BaseTrace):
7171 Sampling values will be stored for these variables. If None,
7272 `model.unobserved_RVs` is used.
7373 """
74+
7475 def __init__ (self , name , model = None , vars = None ):
7576 super (SQLite , self ).__init__ (name , model , vars )
7677 self ._var_cols = {}
@@ -80,13 +81,13 @@ def __init__(self, name, model=None, vars=None):
8081 self ._len = None
8182
8283 self .db = _SQLiteDB (name )
83- ## Inserting sampling information is queued to avoid locks
84- ## caused by hitting the database with transactions each
85- ## iteration.
84+ # Inserting sampling information is queued to avoid locks
85+ # caused by hitting the database with transactions each
86+ # iteration.
8687 self ._queue = {varname : [] for varname in self .varnames }
8788 self ._queue_limit = 5000
8889
89- ## Sampling methods
90+ # Sampling methods
9091
9192 def setup (self , draws , chain ):
9293 """Perform chain-specific setup.
@@ -127,7 +128,7 @@ def _create_table(self):
127128 def _create_insert_queries (self , chain ):
128129 template = TEMPLATES ['insert' ]
129130 for varname , var_cols in self ._var_cols .items ():
130- ## Create insert statement for each variable.
131+ # Create insert statement for each variable.
131132 var_str = ', ' .join (var_cols )
132133 placeholders = ', ' .join (['?' ] * len (var_cols ))
133134 statement = template .format (table = varname ,
@@ -164,7 +165,7 @@ def close(self):
164165 self ._execute_queue ()
165166 self .db .close ()
166167
167- ## Selection methods
168+ # Selection methods
168169
169170 def __len__ (self ):
170171 if not self ._is_setup :
@@ -252,6 +253,7 @@ def point(self, idx):
252253
253254
254255class _SQLiteDB (object ):
256+
255257 def __init__ (self , name ):
256258 self .name = name
257259 self .con = None
@@ -306,8 +308,8 @@ def load(name, model=None):
306308
307309def _get_table_list (cursor ):
308310 """Return a list of table names in the current database."""
309- ## Modified from Django. Skips the sqlite_sequence system table used
310- ## for autoincrement key generation.
311+ # Modified from Django. Skips the sqlite_sequence system table used
312+ # for autoincrement key generation.
311313 cursor .execute ("SELECT name FROM sqlite_master "
312314 "WHERE type='table' AND NOT name='sqlite_sequence' "
313315 "ORDER BY name" )
0 commit comments