diff --git a/netspresso/netspresso.py b/netspresso/netspresso.py index a3d99308..81ce149e 100644 --- a/netspresso/netspresso.py +++ b/netspresso/netspresso.py @@ -81,8 +81,7 @@ def create_project(self, project_name: str, project_path: str = "./projects") -> logger.error(f"Failed to save project '{project_name}' to the database: {e}") raise finally: - if db: - db.close() + db and db.close() def get_projects(self) -> List[Project]: db = None @@ -96,8 +95,7 @@ def get_projects(self) -> List[Project]: logger.error(f"Failed to get project list from the database: {e}") raise finally: - if db: - db.close() + db and db.close() def trainer( self, task: Optional[Union[str, Task]] = None, yaml_path: Optional[str] = None