From 96d0621a4b4dca9bb5ffaf0e06f50f5692c93f8d Mon Sep 17 00:00:00 2001 From: Rick van Hattem Date: Sat, 11 May 2024 11:52:46 +0200 Subject: [PATCH] fixed pyright errors --- portalocker/redis.py | 2 +- portalocker/utils.py | 9 +++++---- ruff.toml | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/portalocker/redis.py b/portalocker/redis.py index 59ee5ff..2a84807 100644 --- a/portalocker/redis.py +++ b/portalocker/redis.py @@ -131,7 +131,7 @@ def acquire( timeout: typing.Optional[float] = None, check_interval: typing.Optional[float] = None, fail_when_locked: typing.Optional[bool] = None, - ): + ) -> 'RedisLock': timeout = utils.coalesce(timeout, self.timeout, 0.0) check_interval = utils.coalesce( check_interval, diff --git a/portalocker/utils.py b/portalocker/utils.py index 3b5682e..701d113 100644 --- a/portalocker/utils.py +++ b/portalocker/utils.py @@ -132,8 +132,8 @@ def acquire( timeout: typing.Optional[float] = None, check_interval: typing.Optional[float] = None, fail_when_locked: typing.Optional[bool] = None, - ): - return NotImplemented + ) -> typing.Union['LockBase', typing.IO[typing.AnyStr]]: + ... def _timeout_generator( self, @@ -157,7 +157,8 @@ def _timeout_generator( @abc.abstractmethod def release(self): - return NotImplemented + ... + def __enter__(self): return self.acquire() @@ -470,7 +471,7 @@ def get_filename(self, number) -> pathlib.Path: number=number, ) - def acquire( + def acquire( # type: ignore[reportGeneralTypeIssues] self, timeout: typing.Optional[float] = None, check_interval: typing.Optional[float] = None, diff --git a/ruff.toml b/ruff.toml index e484f82..886defd 100644 --- a/ruff.toml +++ b/ruff.toml @@ -6,7 +6,6 @@ target-version = 'py38' src = ['portalocker'] exclude = ['docs'] -format = 'grouped' ignore = [ 'A001', # Variable {name} is shadowing a Python builtin 'A002', # Argument {name} is shadowing a Python builtin