filelock: fix type annotation
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
379a26600c
commit
7394a22c2d
|
@ -13,7 +13,7 @@ import pathlib
|
||||||
import contextlib
|
import contextlib
|
||||||
import asyncio
|
import asyncio
|
||||||
from . import ServerError
|
from . import ServerError
|
||||||
from typing import Optional, Type
|
from typing import Optional, Type, Union
|
||||||
from types import TracebackType
|
from types import TracebackType
|
||||||
|
|
||||||
class LockTimeout(ServerError):
|
class LockTimeout(ServerError):
|
||||||
|
@ -21,7 +21,7 @@ class LockTimeout(ServerError):
|
||||||
|
|
||||||
class AsyncExclusiveFileLock(contextlib.AbstractAsyncContextManager):
|
class AsyncExclusiveFileLock(contextlib.AbstractAsyncContextManager):
|
||||||
def __init__(
|
def __init__(
|
||||||
self, file_path: pathlib.Path, timeout: int = 0
|
self, file_path: pathlib.Path, timeout: Union[int, float] = 0
|
||||||
) -> None:
|
) -> None:
|
||||||
self.lock_path = file_path.parent.joinpath(f".{file_path.name}.lock")
|
self.lock_path = file_path.parent.joinpath(f".{file_path.name}.lock")
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
|
|
Loading…
Reference in New Issue