From d0376e878dbb0ee7773840d9653d0c3d252410b4 Mon Sep 17 00:00:00 2001 From: Daniel Gatis Date: Mon, 30 Sep 2024 23:25:30 -0300 Subject: [PATCH] fix linters --- rembg/commands/p_command.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rembg/commands/p_command.py b/rembg/commands/p_command.py index e83b75e5..b9ce08e8 100644 --- a/rembg/commands/p_command.py +++ b/rembg/commands/p_command.py @@ -198,22 +198,23 @@ def process(each_input: pathlib.Path) -> None: class EventHandler(FileSystemEventHandler): def on_any_event(self, event: FileSystemEvent) -> None: + src_path = cast(str, event.src_path) if ( not ( event.is_directory or event.event_type in ["deleted", "closed"] ) - and pathlib.Path(event.src_path).exists() + and pathlib.Path(src_path).exists() ): - if event.src_path.endswith("stop.txt"): + if src_path.endswith("stop.txt"): nonlocal should_watch should_watch = False - pathlib.Path(event.src_path).unlink() + pathlib.Path(src_path).unlink() return - process(pathlib.Path(event.src_path)) + process(pathlib.Path(src_path)) event_handler = EventHandler() - observer.schedule(event_handler, input, recursive=False) + observer.schedule(event_handler, str(input), recursive=False) observer.start() try: