Search in sources :

Example 6 with AliasedName

use of org.sonar.plugins.python.api.tree.AliasedName in project sonar-python by SonarSource.

the class PythonTreeMaker method importName.

private static ImportName importName(AstNode astNode, Separators separators) {
    Token importKeyword = toPyToken(astNode.getFirstChild(PythonKeyword.IMPORT).getToken());
    List<AliasedName> aliasedNames = astNode.getFirstChild(PythonGrammar.DOTTED_AS_NAMES).getChildren(PythonGrammar.DOTTED_AS_NAME).stream().map(PythonTreeMaker::aliasedName).collect(Collectors.toList());
    return new ImportNameImpl(importKeyword, aliasedNames, separators);
}
Also used : AliasedName(org.sonar.plugins.python.api.tree.AliasedName) Token(org.sonar.plugins.python.api.tree.Token)

Aggregations

AliasedName (org.sonar.plugins.python.api.tree.AliasedName)6 AstNode (com.sonar.sslr.api.AstNode)3 Test (org.junit.Test)3 ImportName (org.sonar.plugins.python.api.tree.ImportName)2 Name (org.sonar.plugins.python.api.tree.Name)2 Token (org.sonar.plugins.python.api.tree.Token)2 Tree (org.sonar.plugins.python.api.tree.Tree)2 RuleTest (org.sonar.python.parser.RuleTest)2 URI (java.net.URI)1 Nullable (javax.annotation.Nullable)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Mockito (org.mockito.Mockito)1 Mockito.when (org.mockito.Mockito.when)1 PythonFile (org.sonar.plugins.python.api.PythonFile)1 PythonVisitorContext (org.sonar.plugins.python.api.PythonVisitorContext)1 Symbol (org.sonar.plugins.python.api.symbols.Symbol)1 Usage (org.sonar.plugins.python.api.symbols.Usage)1 CallExpression (org.sonar.plugins.python.api.tree.CallExpression)1 ClassDef (org.sonar.plugins.python.api.tree.ClassDef)1 DottedName (org.sonar.plugins.python.api.tree.DottedName)1