Fix database_setup and main lint smells.
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
"""
|
||||
Small script to create the database if it doesn't already exist.
|
||||
"""
|
||||
"""Small script to create the database if it doesn't already exist."""
|
||||
|
||||
import sqlite3
|
||||
from os.path import exists
|
||||
from pathlib import Path
|
||||
|
||||
if not exists("database/dakiny.db"):
|
||||
if not Path("database/dakiny.db").exists():
|
||||
with sqlite3.connect("database/dakiny.db") as con:
|
||||
cur = con.cursor()
|
||||
|
||||
with open("database_setup/database.sql", encoding="utf-8") as file:
|
||||
with Path("database_setup/database.sql", encoding="utf-8").open() as file:
|
||||
database_script = file.read()
|
||||
cur.executescript(database_script)
|
||||
con.commit()
|
||||
|
||||
Reference in New Issue
Block a user