src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Annotations/AnnotationsChecker.py

branch
eric7
changeset 10169
0f70a4ef4592
parent 10119
64147a7e6393
child 10184
af82cb6e0298
equal deleted inserted replaced
10168:8312e0e76795 10169:0f70a4ef4592
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):

eric ide

mercurial