Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MyPy 1.8.0 don't recognize tenacity.Retrying() as a callable #428

Open
hussein-awala opened this issue Jan 9, 2024 · 2 comments
Open

MyPy 1.8.0 don't recognize tenacity.Retrying() as a callable #428

hussein-awala opened this issue Jan 9, 2024 · 2 comments

Comments

@hussein-awala
Copy link

I'm trying to update MyPy version in Airflow to 1.8.0, but I'm getting a strange error when I run it on this code:

def run_with_advanced_retry(self, _retry_args: dict[Any, Any], *args: Any, **kwargs: Any) -> Any:
    self._retry_obj = tenacity.Retrying(**_retry_args)
    return self._retry_obj(self.run, *args, **kwargs)

The error is the following:

airflow/providers/http/hooks/http.py:247: error: Never not callable  [misc]
            return self._retry_obj(self.run, *args, **kwargs)
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in 1 file (checked 1838 source files)
Error 1 returned
@hussein-awala hussein-awala changed the title MyPy 1.8.0 don't recongnize tenacity.Retrying() as a callable MyPy 1.8.0 don't recognize tenacity.Retrying() as a callable Jan 9, 2024
@rudolfbyker
Copy link

Shouldn't this

def run_with_advanced_retry(self, _retry_args: dict[Any, Any], *args: Any, **kwargs: Any) -> Any:
    self._retry_obj = tenacity.Retrying(**_retry_args)
    return self._retry_obj(self.run, *args, **kwargs)

rather be this

def run_with_advanced_retry(self, _retry_args: dict[Any, Any], *args: Any, **kwargs: Any) -> Any:
    self._retry_obj = tenacity.Retrying(**_retry_args)
    return self._retry_obj(self.run)(*args, **kwargs)

? :)

@hussein-awala
Copy link
Author

@rudolfbyker I tested it and still have the same issue:

airflow/providers/http/hooks/http.py:261: error: Never not callable  [misc]
            return self._retry_obj(self.run)(*args, **kwargs)
                   ^~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in 1 file (checked 1 source file)
Error 1 returned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants