diff --git a/src/django_watchfiles/__init__.py b/src/django_watchfiles/__init__.py index f33ce54..9fe92d0 100644 --- a/src/django_watchfiles/__init__.py +++ b/src/django_watchfiles/__init__.py @@ -31,7 +31,7 @@ def watch_safely(f: Callable[[], Iterable[T]], default: T) -> Iterable[T]: Yield from `f()`, but when it fails, yield `default` once, log the exception and retry, unless there are 2 exceptions within 1 second, in which case the exception is raised. """ - ts: Optional[float] = None + ts: float | None = None while True: try: yield from f() @@ -68,8 +68,8 @@ def set_roots(self, roots: set[Path]) -> None: def stop(self) -> None: self.stop_event.set() - def __iter__(self) -> Generator[Set[FileChange], None, None]: - no_changes: Set[FileChange] = set() + def __iter__(self) -> Generator[set[FileChange], None, None]: + no_changes: set[FileChange] = set() while True: self.change_event.clear() for changes in watch_safely(