-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pavel Kirilin <[email protected]>
- Loading branch information
Showing
5 changed files
with
173 additions
and
11 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[tool.poetry] | ||
name = "taskiq" | ||
version = "0.0.3" | ||
description = "Asynchronous task queue with async support" | ||
version = "0.0.4" | ||
description = "Distributed task queue with full async support" | ||
authors = ["Pavel Kirilin <[email protected]>"] | ||
maintainers = ["Pavel Kirilin <[email protected]>"] | ||
readme = "README.md" | ||
|
@@ -16,9 +16,10 @@ classifiers = [ | |
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Topic :: Utilities", | ||
"Topic :: System :: Networking", | ||
"Operating System :: OS Independent", | ||
"Intended Audience :: Developers", | ||
"Topic :: System :: Networking", | ||
"Development Status :: 3 - Alpha", | ||
] | ||
homepage = "https://github.com/taskiq-python/taskiq" | ||
keywords = ["taskiq", "tasks", "distributed", "async"] | ||
|
@@ -29,6 +30,8 @@ typing-extensions = ">=3.10.0.0" | |
pydantic = "^1.6.2" | ||
pyzmq = { version = "^23.2.0", optional = true } | ||
uvloop = { version = "^0.16.0", optional = true } | ||
watchdog = "^2.1.9" | ||
gitignore-parser = "^0.0.8" | ||
|
||
[tool.poetry.dev-dependencies] | ||
pytest = "^7.1.2" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from pathlib import Path | ||
from typing import Callable | ||
|
||
from gitignore_parser import parse_gitignore | ||
from watchdog.events import FileSystemEvent | ||
|
||
|
||
class FileWatcher: | ||
"""Filewatcher that watchs for filesystem changes.""" | ||
|
||
def __init__( | ||
self, | ||
callback: Callable[[], None], | ||
use_gitignore: bool = True, | ||
) -> None: | ||
self.callback = callback | ||
self.gitignore = None | ||
gpath = Path("./.gitignore") | ||
if use_gitignore and gpath.exists(): | ||
self.gitignore = parse_gitignore(gpath) | ||
|
||
def dispatch(self, event: FileSystemEvent) -> None: | ||
""" | ||
React to event. | ||
This function checks wether we need to | ||
react to event and calls callback if we do. | ||
:param event: incoming fs event. | ||
""" | ||
if event.is_directory: | ||
return | ||
if event.event_type == "closed": | ||
return | ||
if ".pytest_cache" in event.src_path: | ||
return | ||
if "__pycache__" in event.src_path: | ||
return | ||
if self.gitignore and self.gitignore(event.src_path): | ||
return | ||
self.callback() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters