568 @return annotation complexity |
568 @return annotation complexity |
569 @rtype = int |
569 @rtype = int |
570 """ |
570 """ |
571 if AstUtilities.isString(annotationNode): |
571 if AstUtilities.isString(annotationNode): |
572 try: |
572 try: |
573 annotationNode = ast.parse(annotationNode.s).body[0].value |
573 annotationNode = ast.parse(annotationNode.value).body[0].value |
574 except (IndexError, SyntaxError): |
574 except (IndexError, SyntaxError): |
575 return defaultComplexity |
575 return defaultComplexity |
576 |
576 |
577 complexity = defaultComplexity |
577 complexity = defaultComplexity |
578 if isinstance(annotationNode, ast.Subscript): |
578 if isinstance(annotationNode, ast.Subscript): |
604 @rtype = int |
604 @rtype = int |
605 """ |
605 """ |
606 annotationLength = 0 |
606 annotationLength = 0 |
607 if AstUtilities.isString(annotationNode): |
607 if AstUtilities.isString(annotationNode): |
608 try: |
608 try: |
609 annotationNode = ast.parse(annotationNode.s).body[0].value |
609 annotationNode = ast.parse(annotationNode.value).body[0].value |
610 except (IndexError, SyntaxError): |
610 except (IndexError, SyntaxError): |
611 return annotationLength |
611 return annotationLength |
612 |
612 |
613 if isinstance(annotationNode, ast.Subscript): |
613 if isinstance(annotationNode, ast.Subscript): |
614 with contextlib.suppress(AttributeError): |
614 with contextlib.suppress(AttributeError): |