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

branch
eric7
changeset 10050
3750abc45d5e
parent 10046
35b27af462ef
child 10058
5d965939ab85
equal deleted inserted replaced
10049:61a1757626ac 10050:3750abc45d5e
579 @rtype = int 579 @rtype = int
580 """ 580 """
581 if AstUtilities.isString(annotationNode): 581 if AstUtilities.isString(annotationNode):
582 try: 582 try:
583 annotationNode = ast.parse(annotationNode.s).body[0].value 583 annotationNode = ast.parse(annotationNode.s).body[0].value
584 except (SyntaxError, IndexError): 584 except (IndexError, SyntaxError):
585 return defaultComplexity 585 return defaultComplexity
586 586
587 complexity = defaultComplexity 587 complexity = defaultComplexity
588 if isinstance(annotationNode, ast.Subscript): 588 if isinstance(annotationNode, ast.Subscript):
589 if sys.version_info >= (3, 9): 589 if sys.version_info >= (3, 9):
615 """ 615 """
616 annotationLength = 0 616 annotationLength = 0
617 if AstUtilities.isString(annotationNode): 617 if AstUtilities.isString(annotationNode):
618 try: 618 try:
619 annotationNode = ast.parse(annotationNode.s).body[0].value 619 annotationNode = ast.parse(annotationNode.s).body[0].value
620 except (SyntaxError, IndexError): 620 except (IndexError, SyntaxError):
621 return annotationLength 621 return annotationLength
622 622
623 if isinstance(annotationNode, ast.Subscript): 623 if isinstance(annotationNode, ast.Subscript):
624 with contextlib.suppress(AttributeError): 624 with contextlib.suppress(AttributeError):
625 annotationLength = ( 625 annotationLength = (

eric ide

mercurial