You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hasattr doesn't inform the correct type. If you want to use static typechecking look at isinstance
if (isinstance(node, ast.FunctionDef) or isinstance(node, ast.AsyncFunctionDef) or isinstance(node, ast.ClassDef)) and sys.version_info.major >= 3:
line_end -= len(node.decorator_list)
isinstance works, thanks! Sadly it can get a bit lengthy. If that's the only option available and having support for hasattr is not possible, feel free to close the issue.
Environment data
Expected behaviour
When using
if hasattr
to check if an attribute is present, I shouldn't get a "Cannot access member" error for code inside that condition.Actual behaviour
I get the following error:
Logs
Copy-pasting the logs froze the window, so I am not going to include them. Let me know if you want them and I'll send them your way 🙂
Code Snippet / Additional information
The text was updated successfully, but these errors were encountered: