Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored and jordanrfrazier committed Dec 16, 2024
1 parent 86c41fb commit 8a2cf7e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/backend/base/langflow/services/database/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import re
import sqlite3
import time
import aiofiles
from contextlib import asynccontextmanager, contextmanager
from datetime import datetime, timezone
from pathlib import Path
from typing import TYPE_CHECKING
from aiofiles import os as aio_os

import aiofiles
import sqlalchemy as sa
from aiofiles import os as aio_os
from alembic import command, util
from alembic.config import Config
from loguru import logger
Expand All @@ -31,7 +31,6 @@
from langflow.services.deps import get_settings_service
from langflow.services.utils import teardown_superuser


if TYPE_CHECKING:
from langflow.services.settings.service import SettingsService

Expand All @@ -58,20 +57,20 @@ def __init__(self, settings_service: SettingsService):
event.listen(Engine, "connect", self.on_connection)
self.engine = self._create_engine()
self.async_engine = self._create_async_engine()

alembic_log_file = self.settings_service.settings.alembic_log_file
# Check if the provided path is absolute, cross-platform.
if Path(alembic_log_file).is_absolute():
self.alembic_log_path = Path(alembic_log_file)
else:
self.alembic_log_path = Path(langflow_dir) / alembic_log_file

self._logged_pragma = False

async def initialize_log_file(self):
# Ensure the directory and file for the alembic log file exists
await aio_os.makedirs(self.alembic_log_path.parent, exist_ok=True)
async with aiofiles.open(self.alembic_log_path, 'a'):
async with aiofiles.open(self.alembic_log_path, "a"):
pass # Equivalent to touch

def reload_engine(self) -> None:
Expand Down

0 comments on commit 8a2cf7e

Please sign in to comment.