pylint complains that alive_bar contextmanager is not callable
manvithn opened this issue · 2 comments
manvithn commented
This might be a pylint issue, but on any code like this
with alive_bar() as progress:
for ... in ...:
progress()
pylint-2.17.4 will give the message that progress is not callable: E1102:not-callable. I did see pylint-dev/pylint#1746 which was closed a while ago, or it might be that we need some type hint in alive_bar.
rsalmei commented
Yeah, I can confirm it does.
But I recommend ruff, which doesn't.
If you do want pylint however, I'm not sure how to fix it yet.
This is the entrypoint for alive-progress' alive_bar:
def alive_bar(total: Optional[int] = None, *, calibrate: Optional[int] = None, **options: Any):
return __alive_bar(config, total, calibrate=calibrate)
@contextmanager
def __alive_bar(config, total=None, *, calibrate=None,
_cond=threading.Condition, _sampling=False, _testing=None):
Note it returns a @contextmanager
, no mention of Callable indeed.
But even if I do change them to:
def alive_bar(total: Optional[int] = None, *, calibrate: Optional[int] = None, **options: Any) -> Callable:
return __alive_bar(config, total, calibrate=calibrate)
@contextmanager
def __alive_bar(config, total=None, *, calibrate=None,
_cond=threading.Condition, _sampling=False, _testing=None) -> Callable:
It still doesn't work on pylint (2.17.6).
Any suggestions?
rsalmei commented
Closing this one, but feel free to reply if there's any news.