1 """Local storage for the Local Calendar integration."""
4 from pathlib
import Path
8 STORAGE_PATH =
".storage/{key}.ics"
12 """Local calendar storage."""
14 def __init__(self, hass: HomeAssistant, path: Path) ->
None:
15 """Initialize LocalCalendarStore."""
18 self.
_lock_lock = asyncio.Lock()
21 """Load the calendar from disk."""
22 async
with self.
_lock_lock:
23 return await self.
_hass_hass.async_add_executor_job(self.
_load_load)
26 """Load the calendar from disk."""
27 if not self.
_path_path.exists():
29 return self.
_path_path.read_text()
32 """Persist the calendar to storage."""
33 async
with self.
_lock_lock:
34 await self.
_hass_hass.async_add_executor_job(self.
_store_store, ics_content)
36 def _store(self, ics_content: str) ->
None:
37 """Persist the calendar to storage."""
38 self.
_path_path.write_text(ics_content)
None _store(self, str ics_content)
None __init__(self, HomeAssistant hass, Path path)
None async_store(self, str ics_content)