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
get AttributeError when getting property params #1139
Comments
This is intentional. The API documentation even mentions this. I would use this pattern for now:
Would you propose a different solution to this? IMO just returning None is bad as well, returning an empty list does not let you differentiate between objects with parameters and objects without (so some information would get lost)... If you have a better idea, please share it with me. I'm open for suggestions. |
The definition type of property is also >>> completion.type
'function' I make a workaround to support if definition.type in ('function', 'method'):
def_code = definition.get_line_code(1)
if '@property' in def_code and '@property.setter' not in def_code:
params = ''
else:
params = definition.params() |
I stumbled unto this while using
Seems to work well, but not sure if worth for a long term solution. |
I mean if you just want to catch the AttributeError I would do it like this:
This would be the correct workaround IMO. |
params will be deprecated and |
The text was updated successfully, but these errors were encountered: