Skip to content

FileService

🛈 DocStrings

Service handling file operations with type-safe events.

Source code in src/anyenv/signals/examples.py
class FileService:
    """Service handling file operations with type-safe events."""

    file_created = AppSignal[FileEvent]()

    async def create_file(self, path: Path, content: str) -> None:
        """Create file and emit creation event."""
        event = FileEvent(path=path, operation="create", size=len(content))
        await self.file_created.emit(event)

create_file async

create_file(path: Path, content: str) -> None

Create file and emit creation event.

Source code in src/anyenv/signals/examples.py
async def create_file(self, path: Path, content: str) -> None:
    """Create file and emit creation event."""
    event = FileEvent(path=path, operation="create", size=len(content))
    await self.file_created.emit(event)

:fa-brands-github: Show source on GitHub