Fix database_setup and main lint smells.

This commit is contained in:
2024-05-22 16:33:09 -04:00
parent 1fd1be5576
commit e485c119f6
4 changed files with 26 additions and 18 deletions
+4 -6
View File
@@ -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()
+7
View File
@@ -0,0 +1,7 @@
[tool.ruff]
# Extend the `pyproject.toml` file in the parent directory...
extend = "../pyproject.toml"
[tool.ruff.lint]
# ignore implicit-namespace-package in this directory.
ignore = ["INP001"]
+1 -3
View File
@@ -1,6 +1,4 @@
"""
Simple file to set up the sqlalchemy connection to database.
"""
"""Simple file to set up the sqlalchemy connection to database."""
from sqlalchemy import create_engine
from sqlalchemy.ext.automap import automap_base