Change variable name for clarity, strip out comment lines.

master
voussoir 2022-03-28 14:18:43 -07:00
parent e487188617
commit 306ddf489c
No known key found for this signature in database
GPG Key ID: 5F7554F8C26DACCB
1 changed files with 6 additions and 5 deletions

View File

@ -151,12 +151,13 @@ def executescript(conn, script):
The problem with Python's default executescript is that it executes a The problem with Python's default executescript is that it executes a
commit before running your script. If I wanted a commit I'd write one! commit before running your script. If I wanted a commit I'd write one!
''' '''
lines = re.split(r';(:?\n|$)', script) script = _remove_script_comments(script)
lines = (line.strip() for line in lines) statements = re.split(r';(:?\n|$)', script)
lines = (line for line in lines if line) statements = (statement.strip() for statement in statements)
statements = (statement for statement in statements if statement)
cur = conn.cursor() cur = conn.cursor()
for line in lines: for statement in statements:
cur.execute(line) cur.execute(statement)
def hex_byte(byte): def hex_byte(byte):
''' '''