From 1a4405fbbc6cf9d313d2aa0c448a23f87dc3cbff Mon Sep 17 00:00:00 2001 From: KKlochko Date: Sun, 15 Jan 2023 12:30:33 +0200 Subject: [PATCH] (Refactor) remove fucntion for creating DB file. --- CHANGELOG.org | 2 ++ src/db.py | 14 -------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.org b/CHANGELOG.org index ca2b1e1..fd7f396 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -29,3 +29,5 @@ Added TOML configuration file. Updated paths of files and folders. Updated my name to my fullname and release years. +** 1.0.2 <2023-01-15> + Refactor the database class and remove function for the creating file. diff --git a/src/db.py b/src/db.py index 21b2a44..cead782 100644 --- a/src/db.py +++ b/src/db.py @@ -29,22 +29,8 @@ class DataBase: def __init__(self, PATH: str = "user.db", TABLE: str = "animes"): """Initialising the connection information.""" self.PATH, self.TABLE = PATH, TABLE - self.database_is_exists() self.create_table(self.TABLE) - def database_is_exists(self): - """Creates DB file if not exists.""" - try: - f = open(self.PATH, 'r') - f.close() - except FileNotFoundError: - f = open(self.PATH, 'w') - f.close() - except Exception as e: - print(f"{e=}") - finally: - pass - def create_table(self, table): """Create a table in the DB.""" connect = sqlite3.connect(self.PATH)