mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-02 13:14:29 -04:00
Fix coding style
This commit is contained in:
parent
9c6055a52e
commit
8cf105a550
@ -8,6 +8,7 @@ def format_date(date: date | int | None) -> str | None:
|
|||||||
return f"{date}-01-01"
|
return f"{date}-01-01"
|
||||||
return date.isoformat()
|
return date.isoformat()
|
||||||
|
|
||||||
|
|
||||||
class ProviderError(RuntimeError):
|
class ProviderError(RuntimeError):
|
||||||
def __init__(self, *args: object) -> None:
|
def __init__(self, *args: object) -> None:
|
||||||
super().__init__(*args)
|
super().__init__(*args)
|
||||||
|
@ -1,7 +1,15 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from watchdog.observers import Observer
|
from watchdog.observers import Observer
|
||||||
from watchdog.events import FileSystemEventHandler, DirCreatedEvent, FileCreatedEvent, DirMovedEvent, FileMovedEvent, DirDeletedEvent, FileDeletedEvent
|
from watchdog.events import (
|
||||||
|
FileSystemEventHandler,
|
||||||
|
DirCreatedEvent,
|
||||||
|
FileCreatedEvent,
|
||||||
|
DirMovedEvent,
|
||||||
|
FileMovedEvent,
|
||||||
|
DirDeletedEvent,
|
||||||
|
FileDeletedEvent,
|
||||||
|
)
|
||||||
|
|
||||||
from scanner.utils import log_errors
|
from scanner.utils import log_errors
|
||||||
|
|
||||||
@ -10,6 +18,7 @@ from .scanner import Scanner
|
|||||||
task_list = []
|
task_list = []
|
||||||
event = asyncio.Event()
|
event = asyncio.Event()
|
||||||
|
|
||||||
|
|
||||||
async def monitor(path: str, scanner: Scanner):
|
async def monitor(path: str, scanner: Scanner):
|
||||||
global task_list
|
global task_list
|
||||||
|
|
||||||
@ -28,6 +37,7 @@ async def monitor(path: str, scanner: Scanner):
|
|||||||
# Should call .join() if the while stops one day.
|
# Should call .join() if the while stops one day.
|
||||||
# observer.join()
|
# observer.join()
|
||||||
|
|
||||||
|
|
||||||
def async_event(f):
|
def async_event(f):
|
||||||
# Log errors of f and catch them to prevent the gather to throw.
|
# Log errors of f and catch them to prevent the gather to throw.
|
||||||
f = log_errors(f)
|
f = log_errors(f)
|
||||||
@ -39,6 +49,7 @@ def async_event(f):
|
|||||||
|
|
||||||
return internal
|
return internal
|
||||||
|
|
||||||
|
|
||||||
class EventHandler(FileSystemEventHandler):
|
class EventHandler(FileSystemEventHandler):
|
||||||
def __init__(self, scanner: Scanner):
|
def __init__(self, scanner: Scanner):
|
||||||
self._scanner = scanner
|
self._scanner = scanner
|
||||||
|
Loading…
x
Reference in New Issue
Block a user