INNER CODE UNIT · Python

async_remove_entry

dummylabs/thewatchman · custom_components/watchman/__init__.py:349

async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
    """Handle removal of an entry."""
    from .const import DB_FILENAME, LEGACY_DB_FILENAME, LOCK_FILENAME, STORAGE_KEY

    db_path = hass.config.path(".storage", DB_FILENAME)
    journal_path = f"{db_path}-journal"
    lock_path = hass.config.path(".storage", LOCK_FILENAME)
    stats_path = hass.config.path(".storage", STORAGE_KEY)

    # Legacy files
    legacy_db_path = hass.config.path(".storage", LEGACY_DB_FILENAME)
    legacy_wal_path = f"{legacy_db_path}-wal"
    legacy_shm_path = f"{legacy_db_path}-shm"

    def remove_files() -> None:
        Path(db_path).unlink(missing_ok=True)
        Path(journal_path).unlink(missing_ok=True)
        Path(lock_path).unlink(missing_ok=True)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…