459 complexity for |
461 complexity for |
460 @type ast.AST |
462 @type ast.AST |
461 @return annotation complexity |
463 @return annotation complexity |
462 @rtype = int |
464 @rtype = int |
463 """ |
465 """ |
464 if isinstance(annotationNode, ast.Str): |
466 if AstUtilities.isString(annotationNode): |
465 annotationNode = ast.parse(annotationNode.s).body[0].value |
467 annotationNode = ast.parse(annotationNode.s).body[0].value |
466 if isinstance(annotationNode, ast.Subscript): |
468 if isinstance(annotationNode, ast.Subscript): |
467 return 1 + getAnnotationComplexity(annotationNode.slice.value) |
469 return 1 + getAnnotationComplexity(annotationNode.slice.value) |
468 if isinstance(annotationNode, ast.Tuple): |
470 if isinstance(annotationNode, ast.Tuple): |
469 return max(getAnnotationComplexity(n) for n in annotationNode.elts) |
471 return max(getAnnotationComplexity(n) for n in annotationNode.elts) |