Fixed data annotations causing pickle or deepcopy errors

Closes #261
pull/279/head
Ashley Whetter 4 years ago
parent bf8f50dc97
commit 7541f922ae

@ -22,6 +22,8 @@ Bug Fixes
not turning off signature type hints. not turning off signature type hints.
``autodoc_typehints`` integration is consisidered experimental until ``autodoc_typehints`` integration is consisidered experimental until
the extension properly supports overload functions. the extension properly supports overload functions.
* `#261 <https://github.com/readthedocs/sphinx-autoapi/issues/261>`
Fixed data annotations causing pickle or deepcopy errors.
Trivial/Internal Changes Trivial/Internal Changes
^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^

@ -176,21 +176,13 @@ def get_assign_annotation(node):
:returns: The type annotation as a string, or None if one does not exist. :returns: The type annotation as a string, or None if one does not exist.
:rtype: str or None :rtype: str or None
""" """
annotation = None
annotation_node = None annotation_node = None
try: try:
annotation_node = node.annotation annotation_node = node.annotation
except AttributeError: except AttributeError:
annotation_node = node.type_annotation annotation_node = node.type_annotation
if annotation_node: return format_annotation(annotation_node, node)
if isinstance(annotation_node, astroid.nodes.Const):
annotation = node.value
else:
annotation = annotation_node.as_string()
return annotation
def is_decorated_with_property(node): def is_decorated_with_property(node):

Loading…
Cancel
Save