mirror of
https://git.mirrors.martin98.com/https://github.com/danielgatis/rembg
synced 2025-08-15 15:35:57 +08:00
fix linters
This commit is contained in:
parent
48262fe17d
commit
d0376e878d
@ -198,22 +198,23 @@ def p_command(
|
|||||||
|
|
||||||
class EventHandler(FileSystemEventHandler):
|
class EventHandler(FileSystemEventHandler):
|
||||||
def on_any_event(self, event: FileSystemEvent) -> None:
|
def on_any_event(self, event: FileSystemEvent) -> None:
|
||||||
|
src_path = cast(str, event.src_path)
|
||||||
if (
|
if (
|
||||||
not (
|
not (
|
||||||
event.is_directory or event.event_type in ["deleted", "closed"]
|
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
|
nonlocal should_watch
|
||||||
should_watch = False
|
should_watch = False
|
||||||
pathlib.Path(event.src_path).unlink()
|
pathlib.Path(src_path).unlink()
|
||||||
return
|
return
|
||||||
|
|
||||||
process(pathlib.Path(event.src_path))
|
process(pathlib.Path(src_path))
|
||||||
|
|
||||||
event_handler = EventHandler()
|
event_handler = EventHandler()
|
||||||
observer.schedule(event_handler, input, recursive=False)
|
observer.schedule(event_handler, str(input), recursive=False)
|
||||||
observer.start()
|
observer.start()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user