From e9733b74a706842aabb033b0c300bbbf2c7d0556 Mon Sep 17 00:00:00 2001 From: Roman Glushko Date: Wed, 27 Dec 2023 16:50:51 +0200 Subject: [PATCH] Exposed event type & updated the notifier type (#27) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Exposed event type & updated the notifier type * 🔖 v0.0.6 --------- Co-authored-by: Roman Glushko --- Cargo.toml | 2 +- notifykit/__init__.py | 3 ++- notifykit/_notifier.py | 10 +++++----- pyproject.toml | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4a33a7f..e001b21 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notifykit_lib" -version = "0.0.5" +version = "0.0.6" edition = "2021" license = "A toolkit for building applications watching filesystem changes" homepage = "https://github.com/roma-glushko/notifykit" diff --git a/notifykit/__init__.py b/notifykit/__init__.py index edcb321..ae7132e 100644 --- a/notifykit/__init__.py +++ b/notifykit/__init__.py @@ -1,4 +1,4 @@ -from notifykit._notifier import Notifier, NotifierT +from notifykit._notifier import Notifier, NotifierT, Event from notifykit._notifykit_lib import ( __version__, ObjectType, @@ -22,6 +22,7 @@ "Notifier", "NotifierT", "VERSION", + "Event", "ObjectType", "AccessType", "AccessMode", diff --git a/notifykit/_notifier.py b/notifykit/_notifier.py index 8a410b7..c13734c 100644 --- a/notifykit/_notifier.py +++ b/notifykit/_notifier.py @@ -1,6 +1,6 @@ from os import PathLike import anyio -from typing import Sequence, Protocol, Optional, Any, List +from typing import Sequence, Protocol, Optional, List from notifykit._notifykit_lib import ( WatcherWrapper, AccessEvent, @@ -32,16 +32,16 @@ def watch( def unwatch(self, paths: Sequence[str]) -> None: ... - def __enter__(self) -> "Notifier": + def __aiter__(self) -> "Notifier": ... - def __exit__(self, *args: Any, **kwargs: Any) -> None: + def __iter__(self) -> "Notifier": ... - def __aiter__(self) -> "Notifier": + def __next__(self) -> List[Event]: ... - def __iter__(self) -> "Notifier": + async def __anext__(self) -> List[Event]: ... diff --git a/pyproject.toml b/pyproject.toml index faa3816..5023988 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "notifykit" -version = "0.0.5" +version = "0.0.6" description = "A modern efficient Python toolkit for building applications that need to watch filesystem changes" authors = [ {name = "Roman Glushko", email = "roman.glushko.m@gmail.com"},