id stringlengths 7 14 | test_class dict | test_case dict | focal_class dict | focal_method dict | repository dict |
|---|---|---|---|---|---|
4810329_103 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/semantic/ProjectLevelSymbolTableTest.java",
"identifier": "ProjectLevelSymbolTableTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void import_already_existing_symbol() {\n FunctionDef functionDef = (FunctionDef) parse(\"def fn(p1, p2): pass\").statements().statements().get(0);\n FunctionSymbolImpl fnSymbol = new FunctionSymbolImpl(functionDef, \"mod.fn\", pythonFile(\"mod.py\"));\n List<Symbol> modSymbols = C... | {
"fields": [
{
"declarator": "globalSymbolsByModuleName",
"modifier": "private final",
"original_string": "private final Map<String, Set<Symbol>> globalSymbolsByModuleName;",
"type": "Map<String, Set<Symbol>>",
"var_name": "globalSymbolsByModuleName"
},
{
"declarator":... | {
"body": "public static ProjectLevelSymbolTable from(Map<String, Set<Symbol>> globalSymbolsByModuleName) {\n return new ProjectLevelSymbolTable(globalSymbolsByModuleName);\n }",
"class_method_signature": "ProjectLevelSymbolTable.from(Map<String, Set<Symbol>> globalSymbolsByModuleName)",
"constructor": false,... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_23 | {
"fields": [],
"file": "python-checks/src/test/java/org/sonar/python/checks/ParsingErrorCheckTest.java",
"identifier": "ParsingErrorCheckTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void test() throws Exception {\n File file = new File(\"src/test/resources/checks/parsingError.py\");\n\n PythonParser parser = PythonParser.create();\n PythonVisitorContext context;\n try {\n String fileContent = new String(Files.readAllBytes(file.toPath()), StandardCharse... | {
"fields": [],
"file": "python-checks/src/main/java/org/sonar/python/checks/ParsingErrorCheck.java",
"identifier": "ParsingErrorCheck",
"interfaces": "implements PythonCheck",
"methods": [
{
"class_method_signature": "ParsingErrorCheck.scanFile(PythonVisitorContext context)",
"constructor": f... | {
"body": "@Override\n public void scanFile(PythonVisitorContext context) {\n RecognitionException parsingException = context.parsingException();\n if (parsingException != null) {\n context.addIssue(new PreciseIssue(this, IssueLocation.atLineLevel(parsingException.getMessage(), parsingException.getLine())... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_154 | {
"fields": [
{
"declarator": "treeMaker = new PythonTreeMaker()",
"modifier": "private final",
"original_string": "private final PythonTreeMaker treeMaker = new PythonTreeMaker();",
"type": "PythonTreeMaker",
"var_name": "treeMaker"
}
],
"file": "python-frontend/src/test/jav... | {
"body": "@Test\n public void printStatement() {\n setRootRule(PythonGrammar.PRINT_STMT);\n AstNode astNode = p.parse(\"print 'foo'\");\n StatementWithSeparator statementWithSeparator = new StatementWithSeparator(astNode, null);\n PrintStatement printStmt = treeMaker.printStatement(statementWithSeparato... | {
"fields": [
{
"declarator": "F_STRING_PARSER = new FStringParser()",
"modifier": "private static final",
"original_string": "private static final FStringParser F_STRING_PARSER = new FStringParser();",
"type": "FStringParser",
"var_name": "F_STRING_PARSER"
}
],
"file": "pyth... | {
"body": "public PrintStatement printStatement(StatementWithSeparator statementWithSeparator) {\n AstNode astNode = statementWithSeparator.statement();\n List<Expression> expressions = expressionsFromTest(astNode);\n Separators separators = statementWithSeparator.separator();\n return new PrintStatementI... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_35 | {
"fields": [
{
"declarator": "ABSOLUTE_PATH_PLACEHOLDER = \"{ABSOLUTE_PATH_PLACEHOLDER}\"",
"modifier": "private static final",
"original_string": "private static final String ABSOLUTE_PATH_PLACEHOLDER = \"{ABSOLUTE_PATH_PLACEHOLDER}\";",
"type": "String",
"var_name": "ABSOLUTE_PATH... | {
"body": "@Test\n public void test_unresolved_path() {\n logTester.clear();\n settings.setProperty(PythonCoverageSensor.REPORT_PATH_KEY, \"coverage_with_unresolved_path.xml\");\n settings.setProperty(PythonCoverageSensor.REPORT_PATHS_KEY, \"\");\n coverageSensor.execute(context);\n\n String currentFi... | {
"fields": [
{
"declarator": "LOG = Loggers.get(PythonCoverageSensor.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = Loggers.get(PythonCoverageSensor.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "RE... | {
"body": "@Override\n public void execute(SensorContext context) {\n String baseDir = context.fileSystem().baseDir().getPath();\n Configuration config = context.config();\n\n warnDeprecatedPropertyUsage(config);\n\n HashSet<InputFile> filesCovered = new HashSet<>();\n List<File> reports = getCoverage... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_142 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/tree/NameImplTest.java",
"identifier": "NameImplTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void type_of_boolean() {\n assertThat(PythonTestUtils.lastExpressionInFunction(\"True\").type()).isEqualTo(InferredTypes.BOOL);\n assertThat(PythonTestUtils.lastExpressionInFunction(\"False\").type()).isEqualTo(InferredTypes.BOOL);\n\n assertThat(PythonTestUtils.lastExpressionInFun... | {
"fields": [
{
"declarator": "token",
"modifier": "private final",
"original_string": "private final Token token;",
"type": "Token",
"var_name": "token"
},
{
"declarator": "name",
"modifier": "private final",
"original_string": "private final String name;",... | {
"body": "@Override\n public InferredType type() {\n if (symbol != null && isBooleanBuiltinSymbol()) {\n return InferredTypes.BOOL;\n }\n return inferredType;\n }",
"class_method_signature": "NameImpl.type()",
"constructor": false,
"full_signature": "@Override public InferredType type()",
"id... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_62 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/metrics/FileMetricsTest.java",
"identifier": "FileMetricsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void statements() {\n assertThat(metrics(\"statements.py\").numberOfStatements()).isEqualTo(1);\n }",
"class_method_signature": "FileMetricsTest.statements()",
"constructor": false,
"full_signature": "@Test public void statements()",
"identifier": "statements",
"invocations": ... | {
"fields": [
{
"declarator": "numberOfStatements",
"modifier": "private",
"original_string": "private int numberOfStatements;",
"type": "int",
"var_name": "numberOfStatements"
},
{
"declarator": "numberOfClasses",
"modifier": "private",
"original_string": "... | {
"body": "public int numberOfStatements() {\n return numberOfStatements;\n }",
"class_method_signature": "FileMetrics.numberOfStatements()",
"constructor": false,
"full_signature": "public int numberOfStatements()",
"identifier": "numberOfStatements",
"invocations": [],
"modifiers": "public",
"para... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_115 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/semantic/SymbolImplTest.java",
"identifier": "SymbolImplTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void removeUsages() {\n Symbol x = symbols(\"x = 42\").get(\"x\");\n assertThat(x.usages()).isNotEmpty();\n ((SymbolImpl) x).removeUsages();\n assertThat(x.usages()).isEmpty();\n\n FileInput fileInput = parse(\n \"obj = {}\",\n \"obj.foo\");\n QualifiedExpression... | {
"fields": [
{
"declarator": "name",
"modifier": "private final",
"original_string": "private final String name;",
"type": "String",
"var_name": "name"
},
{
"declarator": "fullyQualifiedName",
"modifier": "@Nullable",
"original_string": "@Nullable\n String... | {
"body": "public void removeUsages() {\n usages.clear();\n childrenSymbolByName.values().forEach(symbol -> ((SymbolImpl) symbol).removeUsages());\n }",
"class_method_signature": "SymbolImpl.removeUsages()",
"constructor": false,
"full_signature": "public void removeUsages()",
"identifier": "removeUsag... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_19 | {
"fields": [
{
"declarator": "parser = PythonParser.create()",
"modifier": "private",
"original_string": "private PythonParser parser = PythonParser.create();",
"type": "PythonParser",
"var_name": "parser"
}
],
"file": "python-checks/src/test/java/org/sonar/python/checks/Exp... | {
"body": "@Test\n public void unescape_string_element_python_bytes_with_x_u_U_escape_sequences() {\n assertThat(unescape(stringElement(\"b'\\\\x48\\\\u0065\\\\U0000006c\\\\x6c'\"))).isEqualTo(\"H\\\\u0065\\\\U0000006cl\");\n }",
"class_method_signature": "ExpressionsTest.unescape_string_element_python_bytes_w... | {
"fields": [
{
"declarator": "ZERO_VALUES = new HashSet<>(Arrays.asList(\"0\", \"0.0\", \"0j\"))",
"modifier": "private static final",
"original_string": "private static final Set<String> ZERO_VALUES = new HashSet<>(Arrays.asList(\"0\", \"0.0\", \"0j\"));",
"type": "Set<String>",
"v... | {
"body": "public static String unescape(StringLiteral stringLiteral) {\n List<StringElement> elements = stringLiteral.stringElements();\n if (elements.size() == 1) {\n return unescape(elements.get(0));\n }\n return elements.stream()\n .map(Expressions::unescape)\n .collect(Collectors.joini... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_247 | {
"fields": [
{
"declarator": "treeMaker = new PythonTreeMaker()",
"modifier": "private final",
"original_string": "private final PythonTreeMaker treeMaker = new PythonTreeMaker();",
"type": "PythonTreeMaker",
"var_name": "treeMaker"
}
],
"file": "python-frontend/src/test/jav... | {
"body": "@Test\n public void assignment_expr() {\n setRootRule(PythonGrammar.NAMED_EXPR_TEST);\n AstNode astNode = p.parse(\"b := 42\");\n AssignmentExpression assignmentExpression = (AssignmentExpression) treeMaker.expression(astNode);\n FirstLastTokenVerifierVisitor visitor = spy(FirstLastTokenVerifi... | {
"fields": [],
"file": "python-frontend/src/main/java/org/sonar/plugins/python/api/tree/BaseTreeVisitor.java",
"identifier": "BaseTreeVisitor",
"interfaces": "implements TreeVisitor",
"methods": [
{
"class_method_signature": "BaseTreeVisitor.scan(@Nullable Tree tree)",
"constructor": false,
... | {
"body": "@Override\n public void visitNumericLiteral(NumericLiteral pyNumericLiteralTree) {\n // noop\n }",
"class_method_signature": "BaseTreeVisitor.visitNumericLiteral(NumericLiteral pyNumericLiteralTree)",
"constructor": false,
"full_signature": "@Override public void visitNumericLiteral(NumericLiter... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_181 | {
"fields": [
{
"declarator": "treeMaker = new PythonTreeMaker()",
"modifier": "private final",
"original_string": "private final PythonTreeMaker treeMaker = new PythonTreeMaker();",
"type": "PythonTreeMaker",
"var_name": "treeMaker"
}
],
"file": "python-frontend/src/test/jav... | {
"body": "@Test\n public void generator_expression() {\n setRootRule(PythonGrammar.TEST);\n ComprehensionExpression generator = (ComprehensionExpression) parse(\"(x*x for x in range(10))\", treeMaker::expression);\n assertThat(generator.getKind()).isEqualTo(Tree.Kind.GENERATOR_EXPR);\n assertThat(genera... | {
"fields": [
{
"declarator": "F_STRING_PARSER = new FStringParser()",
"modifier": "private static final",
"original_string": "private static final FStringParser F_STRING_PARSER = new FStringParser();",
"type": "FStringParser",
"var_name": "F_STRING_PARSER"
}
],
"file": "pyth... | {
"body": "public Expression expression(AstNode astNode) {\n if (astNode.is(PythonGrammar.ATOM) && astNode.getFirstChild().is(PythonPunctuator.LBRACKET)) {\n return listLiteral(astNode);\n }\n if (astNode.is(PythonGrammar.ATOM) && astNode.getFirstChild().is(PythonPunctuator.LPARENTHESIS)) {\n retur... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_210 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/types/TypeShedTest.java",
"identifier": "TypeShedTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void should_resolve_packages() {\n assertThat(TypeShed.symbolsForModule(\"urllib\")).isNotEmpty();\n assertThat(TypeShed.symbolsForModule(\"ctypes\")).isNotEmpty();\n assertThat(TypeShed.symbolsForModule(\"email\")).isNotEmpty();\n assertThat(TypeShed.symbolsForModule(\"json\"))... | {
"fields": [
{
"declarator": "TYPING = \"typing\"",
"modifier": "private static final",
"original_string": "private static final String TYPING = \"typing\";",
"type": "String",
"var_name": "TYPING"
},
{
"declarator": "TYPING_EXTENSIONS = \"typing_extensions\"",
"... | {
"body": "public static Set<Symbol> symbolsForModule(String moduleName) {\n if (!TypeShed.typeShedSymbols.containsKey(moduleName)) {\n Set<Symbol> symbols = searchTypeShedForModule(moduleName);\n typeShedSymbols.put(moduleName, symbols);\n return symbols;\n }\n return TypeShed.typeShedSymbols... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_139 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/tree/TreeUtilsTest.java",
"identifier": "TreeUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void test_isBooleanLiteral() {\n assertThat(TreeUtils.isBooleanLiteral(lastExpression(\"True\"))).isTrue();\n assertThat(TreeUtils.isBooleanLiteral(lastExpression(\"False\"))).isTrue();\n assertThat(TreeUtils.isBooleanLiteral(lastExpression(\"x\"))).isFalse();\n assertThat(TreeU... | {
"fields": [
{
"declarator": "WHITESPACE_TOKEN_TYPES = EnumSet.of(\n PythonTokenType.NEWLINE,\n PythonTokenType.INDENT,\n PythonTokenType.DEDENT)",
"modifier": "private static final",
"original_string": "private static final Set<PythonTokenType> WHITESPACE_TOKEN_TYPES = EnumSet.of(\n ... | {
"body": "public static boolean isBooleanLiteral(Tree tree) {\n if (tree.is(Kind.NAME)) {\n String name = ((Name) tree).name();\n return name.equals(\"True\") || name.equals(\"False\");\n }\n return false;\n }",
"class_method_signature": "TreeUtils.isBooleanLiteral(Tree tree)",
"constructor":... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_58 | {
"fields": [],
"file": "sonar-python-plugin/src/test/java/org/sonar/plugins/python/parser/StaxParserTest.java",
"identifier": "StaxParserTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void test_XML_with_DTD() throws XMLStreamException {\n StaxParser parser = new StaxParser(getTestHandler());\n parser.parse(getClass().getClassLoader().getResourceAsStream(\"org/sonar/plugins/python/parser/dtd-test.xml\"));\n }",
"class_method_signature": "StaxParserTest.test_XML_w... | {
"fields": [
{
"declarator": "inf",
"modifier": "private",
"original_string": "private SMInputFactory inf;",
"type": "SMInputFactory",
"var_name": "inf"
},
{
"declarator": "streamHandler",
"modifier": "private",
"original_string": "private XmlStreamHandler ... | {
"body": "public void parse(File xmlFile) throws XMLStreamException {\n try (FileInputStream input = new FileInputStream(xmlFile)) {\n parse(input);\n } catch (IOException e) {\n throw new XMLStreamException(e);\n }\n }",
"class_method_signature": "StaxParser.parse(File xmlFile)",
"constructo... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_206 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/types/TypeShedTest.java",
"identifier": "TypeShedTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void not_a_class() {\n TypeShed.typeShedClass(\"repr\");\n }",
"class_method_signature": "TypeShedTest.not_a_class()",
"constructor": false,
"full_signature": "@Test(expected = IllegalArgumentException.class) public void not_a_class()",
... | {
"fields": [
{
"declarator": "TYPING = \"typing\"",
"modifier": "private static final",
"original_string": "private static final String TYPING = \"typing\";",
"type": "String",
"var_name": "TYPING"
},
{
"declarator": "TYPING_EXTENSIONS = \"typing_extensions\"",
"... | {
"body": "public static ClassSymbol typeShedClass(String fullyQualifiedName) {\n Symbol symbol = builtinSymbols().get(fullyQualifiedName);\n if (symbol == null) {\n throw new IllegalArgumentException(\"No TypeShed symbol found for name: \" + fullyQualifiedName);\n }\n if (symbol.kind() != Symbol.Kin... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_251 | {
"fields": [
{
"declarator": "treeMaker = new PythonTreeMaker()",
"modifier": "private final",
"original_string": "private final PythonTreeMaker treeMaker = new PythonTreeMaker();",
"type": "PythonTreeMaker",
"var_name": "treeMaker"
}
],
"file": "python-frontend/src/test/jav... | {
"body": "@Test\n public void parenthesized_expr() {\n setRootRule(PythonGrammar.EXPR);\n ParenthesizedExpression expr = (ParenthesizedExpression) parse(\"(a)\", treeMaker::expression);\n FirstLastTokenVerifierVisitor visitor = spy(FirstLastTokenVerifierVisitor.class);\n expr.accept(visitor);\n verif... | {
"fields": [],
"file": "python-frontend/src/main/java/org/sonar/plugins/python/api/tree/BaseTreeVisitor.java",
"identifier": "BaseTreeVisitor",
"interfaces": "implements TreeVisitor",
"methods": [
{
"class_method_signature": "BaseTreeVisitor.scan(@Nullable Tree tree)",
"constructor": false,
... | {
"body": "@Override\n public void visitName(Name pyNameTree) {\n // nothing to scan on a name\n }",
"class_method_signature": "BaseTreeVisitor.visitName(Name pyNameTree)",
"constructor": false,
"full_signature": "@Override public void visitName(Name pyNameTree)",
"identifier": "visitName",
"invocation... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_178 | {
"fields": [
{
"declarator": "treeMaker = new PythonTreeMaker()",
"modifier": "private final",
"original_string": "private final PythonTreeMaker treeMaker = new PythonTreeMaker();",
"type": "PythonTreeMaker",
"var_name": "treeMaker"
}
],
"file": "python-frontend/src/test/jav... | {
"body": "@Test\n public void string_interpolation_equal_specifier() {\n setRootRule(PythonGrammar.ATOM);\n Expression exp = parse(\"F'{bar=}'\", treeMaker::expression);\n StringLiteral stringLiteral = (StringLiteral) exp;\n assertThat(stringLiteral.stringElements()).hasSize(1);\n StringElement elmt ... | {
"fields": [
{
"declarator": "F_STRING_PARSER = new FStringParser()",
"modifier": "private static final",
"original_string": "private static final FStringParser F_STRING_PARSER = new FStringParser();",
"type": "FStringParser",
"var_name": "F_STRING_PARSER"
}
],
"file": "pyth... | {
"body": "public Expression expression(AstNode astNode) {\n if (astNode.is(PythonGrammar.ATOM) && astNode.getFirstChild().is(PythonPunctuator.LBRACKET)) {\n return listLiteral(astNode);\n }\n if (astNode.is(PythonGrammar.ATOM) && astNode.getFirstChild().is(PythonPunctuator.LPARENTHESIS)) {\n retur... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_197 | {
"fields": [
{
"declarator": "a = new ClassSymbolImpl(\"a\", \"a\")",
"modifier": "private final",
"original_string": "private final ClassSymbolImpl a = new ClassSymbolImpl(\"a\", \"a\");",
"type": "ClassSymbolImpl",
"var_name": "a"
},
{
"declarator": "b = new ClassSym... | {
"body": "@Test\n public void test_fromInferredType() {\n assertThat(fromInferredType(anyType())).isEqualTo(anyType());\n assertThat(fromInferredType(INT)).isEqualTo(DECL_INT);\n assertThat(fromInferredType(DECL_INT)).isEqualTo(DECL_INT);\n assertThat(fromInferredType(or(INT, STR))).isEqualTo(anyType())... | {
"fields": [
{
"declarator": "typeClass",
"modifier": "private final",
"original_string": "private final Symbol typeClass;",
"type": "Symbol",
"var_name": "typeClass"
},
{
"declarator": "typeArgs",
"modifier": "private final",
"original_string": "private fi... | {
"body": "public static InferredType fromInferredType(InferredType inferredType) {\n if (inferredType instanceof RuntimeType) {\n ClassSymbol typeClass = ((RuntimeType) inferredType).getTypeClass();\n return new DeclaredType(typeClass);\n }\n if (inferredType instanceof DeclaredType) {\n retu... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_97 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/semantic/SymbolUtilsTest.java",
"identifier": "SymbolUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void path_of() throws IOException, URISyntaxException {\n PythonFile pythonFile = Mockito.mock(PythonFile.class);\n URI uri = Files.createTempFile(\"foo.py\", \"py\").toUri();\n Mockito.when(pythonFile.uri()).thenReturn(uri);\n assertThat(pathOf(pythonFile)).isEqualTo(Paths.get(... | {
"fields": [],
"file": "python-frontend/src/main/java/org/sonar/python/semantic/SymbolUtils.java",
"identifier": "SymbolUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "SymbolUtils.SymbolUtils()",
"constructor": true,
"full_signature": "private SymbolUtils()",
... | {
"body": "@CheckForNull\n public static Path pathOf(PythonFile pythonFile) {\n try {\n URI uri = pythonFile.uri();\n if (\"file\".equalsIgnoreCase(uri.getScheme())) {\n return Paths.get(uri);\n }\n return null;\n } catch (InvalidPathException e) {\n return null;\n }\n }",
... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_226 | {
"fields": [
{
"declarator": "a = new ClassSymbolImpl(\"a\", \"a\")",
"modifier": "private final",
"original_string": "private final ClassSymbolImpl a = new ClassSymbolImpl(\"a\", \"a\");",
"type": "ClassSymbolImpl",
"var_name": "a"
},
{
"declarator": "b = new ClassSym... | {
"body": "@Test\n public void test_canBeOrExtend() {\n ClassSymbolImpl x = new ClassSymbolImpl(\"x\", \"x\");\n assertThat(new RuntimeType(x).canBeOrExtend(\"x\")).isTrue();\n assertThat(new RuntimeType(x).canBeOrExtend(\"y\")).isFalse();\n\n ClassSymbolImpl x1 = new ClassSymbolImpl(\"x1\", \"x1\");\n ... | {
"fields": [
{
"declarator": "typeClass",
"modifier": "private final",
"original_string": "private final ClassSymbol typeClass;",
"type": "ClassSymbol",
"var_name": "typeClass"
},
{
"declarator": "typeClassSuperClassesFQN = null",
"modifier": "private",
"or... | {
"body": "@Override\n public boolean canBeOrExtend(String typeName) {\n return typeClass.canBeOrExtend(typeName);\n }",
"class_method_signature": "RuntimeType.canBeOrExtend(String typeName)",
"constructor": false,
"full_signature": "@Override public boolean canBeOrExtend(String typeName)",
"identifier":... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_78 | {
"fields": [
{
"declarator": "file = Mockito.mock(PythonFile.class, \"file1.py\")",
"modifier": "private final",
"original_string": "private final PythonFile file = Mockito.mock(PythonFile.class, \"file1.py\");",
"type": "PythonFile",
"var_name": "file"
},
{
"declarato... | {
"body": "@Test\n public void valuesAtLocation_branches() {\n Name x = (Name) lastExpressionInFunction(\n \"if p:\",\n \" x = 1\",\n \"else:\",\n \" x = 2\",\n \"x\"\n );\n assertThat(analysis.valuesAtLocation(x)).extracting(ReachingDefinitionsAnalysisTest::getValueAsString).cont... | {
"fields": [
{
"declarator": "programStateByBlock = new HashMap<>()",
"modifier": "private final",
"original_string": "private final Map<CfgBlock, ProgramStateAtBlock> programStateByBlock = new HashMap<>();",
"type": "Map<CfgBlock, ProgramStateAtBlock>",
"var_name": "programStateByB... | {
"body": "public Set<Expression> valuesAtLocation(Name variable) {\n Symbol symbol = variable.symbol();\n if (symbol == null) {\n return Collections.emptySet();\n }\n Set<Expression> assignedExpressions = assignedExpressionByName.get(variable);\n if (assignedExpressions != null) {\n // avoid... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_158 | {
"fields": [
{
"declarator": "treeMaker = new PythonTreeMaker()",
"modifier": "private final",
"original_string": "private final PythonTreeMaker treeMaker = new PythonTreeMaker();",
"type": "PythonTreeMaker",
"var_name": "treeMaker"
}
],
"file": "python-frontend/src/test/jav... | {
"body": "@Test\n public void delStatement() {\n setRootRule(PythonGrammar.DEL_STMT);\n AstNode astNode = p.parse(\"del foo\");\n StatementWithSeparator statementWithSeparator = new StatementWithSeparator(astNode, null);\n DelStatement passStatement = treeMaker.delStatement(statementWithSeparator);\n ... | {
"fields": [
{
"declarator": "F_STRING_PARSER = new FStringParser()",
"modifier": "private static final",
"original_string": "private static final FStringParser F_STRING_PARSER = new FStringParser();",
"type": "FStringParser",
"var_name": "F_STRING_PARSER"
}
],
"file": "pyth... | {
"body": "public DelStatement delStatement(StatementWithSeparator statementWithSeparator) {\n AstNode stmt = statementWithSeparator.statement();\n Separators separators = statementWithSeparator.separator();\n List<Expression> expressionTrees = expressionsFromExprList(stmt.getFirstChild(PythonGrammar.EXPRLIS... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_39 | {
"fields": [
{
"declarator": "ABSOLUTE_PATH_PLACEHOLDER = \"{ABSOLUTE_PATH_PLACEHOLDER}\"",
"modifier": "private static final",
"original_string": "private static final String ABSOLUTE_PATH_PLACEHOLDER = \"{ABSOLUTE_PATH_PLACEHOLDER}\";",
"type": "String",
"var_name": "ABSOLUTE_PATH... | {
"body": "@Test(expected = IllegalStateException.class)\n public void should_fail_on_unexpected_eof() {\n settings.setProperty(PythonCoverageSensor.REPORT_PATHS_KEY, \"coverage_with_eof_error.xml\");\n coverageSensor.execute(context);\n }",
"class_method_signature": "PythonCoverageSensorTest.should_fail_on... | {
"fields": [
{
"declarator": "LOG = Loggers.get(PythonCoverageSensor.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = Loggers.get(PythonCoverageSensor.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "RE... | {
"body": "@Override\n public void execute(SensorContext context) {\n String baseDir = context.fileSystem().baseDir().getPath();\n Configuration config = context.config();\n\n warnDeprecatedPropertyUsage(config);\n\n HashSet<InputFile> filesCovered = new HashSet<>();\n List<File> reports = getCoverage... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_119 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/tree/ParenthesizedExpressionImplTest.java",
"identifier": "ParenthesizedExpressionImplTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void type() {\n assertThat(lastExpression(\"(42)\").type()).isEqualTo(INT);\n assertThat(lastExpression(\"('hello')\").type()).isEqualTo(STR);\n assertThat(lastExpression(\"(xxx)\").type()).isEqualTo(InferredTypes.anyType());\n }",
"class_method_signature": "ParenthesizedExpress... | {
"fields": [
{
"declarator": "leftParenthesis",
"modifier": "private final",
"original_string": "private final Token leftParenthesis;",
"type": "Token",
"var_name": "leftParenthesis"
},
{
"declarator": "expression",
"modifier": "private final",
"original_st... | {
"body": "@Override\n public InferredType type() {\n return expression.type();\n }",
"class_method_signature": "ParenthesizedExpressionImpl.type()",
"constructor": false,
"full_signature": "@Override public InferredType type()",
"identifier": "type",
"invocations": [
"type"
],
"modifiers": "@O... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_230 | {
"fields": [
{
"declarator": "a = new ClassSymbolImpl(\"a\", \"a\")",
"modifier": "private final",
"original_string": "private final ClassSymbolImpl a = new ClassSymbolImpl(\"a\", \"a\");",
"type": "ClassSymbolImpl",
"var_name": "a"
},
{
"declarator": "b = new ClassSym... | {
"body": "@Test\n public void test_isCompatibleWith_NoneType() {\n ClassSymbolImpl x1 = new ClassSymbolImpl(\"x1\", \"x1\");\n x1.addMembers(Collections.singletonList(new SymbolImpl(\"foo\", null)));\n ClassSymbolImpl none = new ClassSymbolImpl(\"NoneType\", \"NoneType\");\n\n assertThat(new RuntimeType... | {
"fields": [
{
"declarator": "typeClass",
"modifier": "private final",
"original_string": "private final ClassSymbol typeClass;",
"type": "ClassSymbol",
"var_name": "typeClass"
},
{
"declarator": "typeClassSuperClassesFQN = null",
"modifier": "private",
"or... | {
"body": "@Override\n public boolean isCompatibleWith(InferredType other) {\n return InferredTypes.isTypeClassCompatibleWith(typeClass, other);\n }",
"class_method_signature": "RuntimeType.isCompatibleWith(InferredType other)",
"constructor": false,
"full_signature": "@Override public boolean isCompatible... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_81 | {
"fields": [
{
"declarator": "file = Mockito.mock(PythonFile.class, \"file1.py\")",
"modifier": "private final",
"original_string": "private final PythonFile file = Mockito.mock(PythonFile.class, \"file1.py\");",
"type": "PythonFile",
"var_name": "file"
},
{
"declarato... | {
"body": "@Test\n public void valuesAtLocation_no_name_assignment() {\n Name x = (Name) lastExpressionInFunction(\"x.foo = 42\", \"x\");\n assertThat(analysis.valuesAtLocation(x)).isEmpty();\n }",
"class_method_signature": "ReachingDefinitionsAnalysisTest.valuesAtLocation_no_name_assignment()",
"construc... | {
"fields": [
{
"declarator": "programStateByBlock = new HashMap<>()",
"modifier": "private final",
"original_string": "private final Map<CfgBlock, ProgramStateAtBlock> programStateByBlock = new HashMap<>();",
"type": "Map<CfgBlock, ProgramStateAtBlock>",
"var_name": "programStateByB... | {
"body": "public Set<Expression> valuesAtLocation(Name variable) {\n Symbol symbol = variable.symbol();\n if (symbol == null) {\n return Collections.emptySet();\n }\n Set<Expression> assignedExpressions = assignedExpressionByName.get(variable);\n if (assignedExpressions != null) {\n // avoid... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_162 | {
"fields": [
{
"declarator": "treeMaker = new PythonTreeMaker()",
"modifier": "private final",
"original_string": "private final PythonTreeMaker treeMaker = new PythonTreeMaker();",
"type": "PythonTreeMaker",
"var_name": "treeMaker"
}
],
"file": "python-frontend/src/test/jav... | {
"body": "@Test\n public void breakStatement() {\n setRootRule(PythonGrammar.BREAK_STMT);\n AstNode astNode = p.parse(\"break\");\n StatementWithSeparator statementWithSeparator = new StatementWithSeparator(astNode, null);\n BreakStatement breakStatement = treeMaker.breakStatement(statementWithSeparator... | {
"fields": [
{
"declarator": "F_STRING_PARSER = new FStringParser()",
"modifier": "private static final",
"original_string": "private static final FStringParser F_STRING_PARSER = new FStringParser();",
"type": "FStringParser",
"var_name": "F_STRING_PARSER"
}
],
"file": "pyth... | {
"body": "public BreakStatement breakStatement(StatementWithSeparator statementWithSeparator) {\n AstNode astNode = statementWithSeparator.statement();\n Separators separators = statementWithSeparator.separator();\n return new BreakStatementImpl(toPyToken(astNode.getToken()), separators);\n }",
"class_me... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_15 | {
"fields": [
{
"declarator": "parser = PythonParser.create()",
"modifier": "private",
"original_string": "private PythonParser parser = PythonParser.create();",
"type": "PythonParser",
"var_name": "parser"
}
],
"file": "python-checks/src/test/java/org/sonar/python/checks/Exp... | {
"body": "@Test\n public void unescape_string_element_containing_ignored_line_beak() {\n // linux\n assertThat(unescape(stringElement(\"'a\\\\\\nb'\"))).isEqualTo(\"ab\");\n // windows\n assertThat(unescape(stringElement(\"'a\\\\\\r\\nb'\"))).isEqualTo(\"ab\");\n // mac\n assertThat(unescape(strin... | {
"fields": [
{
"declarator": "ZERO_VALUES = new HashSet<>(Arrays.asList(\"0\", \"0.0\", \"0j\"))",
"modifier": "private static final",
"original_string": "private static final Set<String> ZERO_VALUES = new HashSet<>(Arrays.asList(\"0\", \"0.0\", \"0j\"));",
"type": "Set<String>",
"v... | {
"body": "public static String unescape(StringLiteral stringLiteral) {\n List<StringElement> elements = stringLiteral.stringElements();\n if (elements.size() == 1) {\n return unescape(elements.get(0));\n }\n return elements.stream()\n .map(Expressions::unescape)\n .collect(Collectors.joini... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_135 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/tree/TreeUtilsTest.java",
"identifier": "TreeUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void test_nthArgumentOrKeyword() {\n FileInput fileInput = PythonTestUtils.parse(\n \"def foo(p0, p1, p2): ...\",\n \"foo(1, 2, p2 = 3)\"\n );\n CallExpression callExpr = PythonTestUtils.getLastDescendant(fileInput, tree -> tree.is(Kind.CALL_EXPR));\n RegularArgument p... | {
"fields": [
{
"declarator": "WHITESPACE_TOKEN_TYPES = EnumSet.of(\n PythonTokenType.NEWLINE,\n PythonTokenType.INDENT,\n PythonTokenType.DEDENT)",
"modifier": "private static final",
"original_string": "private static final Set<PythonTokenType> WHITESPACE_TOKEN_TYPES = EnumSet.of(\n ... | {
"body": "@CheckForNull\n public static RegularArgument nthArgumentOrKeyword(int argPosition, String keyword, List<Argument> arguments) {\n for (int i = 0; i < arguments.size(); i++) {\n Argument argument = arguments.get(i);\n if (hasKeyword(argument, keyword)) {\n return ((RegularArgument) argu... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_42 | {
"fields": [
{
"declarator": "ABSOLUTE_PATH_PLACEHOLDER = \"{ABSOLUTE_PATH_PLACEHOLDER}\"",
"modifier": "private static final",
"original_string": "private static final String ABSOLUTE_PATH_PLACEHOLDER = \"{ABSOLUTE_PATH_PLACEHOLDER}\";",
"type": "String",
"var_name": "ABSOLUTE_PATH... | {
"body": "@Test\n public void sensor_descriptor() {\n DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();\n new PythonCoverageSensor(analysisWarnings).describe(descriptor);\n assertThat(descriptor.name()).isEqualTo(\"Cobertura Sensor for Python coverage\");\n assertThat(descriptor.langua... | {
"fields": [
{
"declarator": "LOG = Loggers.get(PythonCoverageSensor.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = Loggers.get(PythonCoverageSensor.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "RE... | {
"body": "@Override\n public void describe(SensorDescriptor descriptor) {\n descriptor\n .name(\"Cobertura Sensor for Python coverage\")\n .onlyOnLanguage(Python.KEY);\n }",
"class_method_signature": "PythonCoverageSensor.describe(SensorDescriptor descriptor)",
"constructor": false,
"full_signat... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_123 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/tree/TreeUtilsTest.java",
"identifier": "TreeUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void first_ancestor() {\n String code = \"\" +\n \"def outer():\\n\" +\n \" def inner():\\n\" +\n \" pass\";\n FileInput root = parse(code);\n FunctionDef outerFunction = (FunctionDef) root.statements().statements().get(0);\n FunctionDef innerFunction = (Funct... | {
"fields": [
{
"declarator": "WHITESPACE_TOKEN_TYPES = EnumSet.of(\n PythonTokenType.NEWLINE,\n PythonTokenType.INDENT,\n PythonTokenType.DEDENT)",
"modifier": "private static final",
"original_string": "private static final Set<PythonTokenType> WHITESPACE_TOKEN_TYPES = EnumSet.of(\n ... | {
"body": "@CheckForNull\n public static Tree firstAncestor(Tree tree, Predicate<Tree> predicate) {\n Tree currentParent = tree.parent();\n while (currentParent != null) {\n if (predicate.test(currentParent)) {\n return currentParent;\n }\n currentParent = currentParent.parent();\n }\n... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_54 | {
"fields": [
{
"declarator": "FILE_1 = \"file1.py\"",
"modifier": "private static final",
"original_string": "private static final String FILE_1 = \"file1.py\";",
"type": "String",
"var_name": "FILE_1"
},
{
"declarator": "FILE_2 = \"file2.py\"",
"modifier": "priv... | {
"body": "@Test\n public void cancelled_analysis() {\n InputFile inputFile = inputFile(FILE_1);\n activeRules = (new ActiveRulesBuilder()).build();\n context.setCancelled(true);\n sensor(null).execute(context);\n assertThat(context.measure(inputFile.key(), CoreMetrics.NCLOC)).isNull();\n assertTha... | {
"fields": [
{
"declarator": "checks",
"modifier": "private final",
"original_string": "private final PythonChecks checks;",
"type": "PythonChecks",
"var_name": "checks"
},
{
"declarator": "fileLinesContextFactory",
"modifier": "private final",
"original_st... | {
"body": "@Override\n public void execute(SensorContext context) {\n List<InputFile> mainFiles = getInputFiles(Type.MAIN, context);\n List<InputFile> testFiles = getInputFiles(Type.TEST, context);\n PythonScanner scanner = new PythonScanner(context, checks, fileLinesContextFactory, noSonarFilter, mainFiles... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_7 | {
"fields": [],
"file": "python-checks/src/test/java/org/sonar/python/checks/CheckUtilsTest.java",
"identifier": "CheckUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void no_parent_class() {\n FileInput file = (FileInput) parse(\"\" +\n \"def f():\\n\" +\n \" pass\\n\");\n FunctionDef f = descendantFunction(file, \"f\");\n assertThat(f).isNotNull();\n assertThat(CheckUtils.getParentClassDef(f)).isNull();\n }",
"class_method_s... | {
"fields": [],
"file": "python-checks/src/main/java/org/sonar/python/checks/CheckUtils.java",
"identifier": "CheckUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "CheckUtils.CheckUtils()",
"constructor": true,
"full_signature": "private CheckUtils()",
"identifi... | {
"body": "public static ClassDef getParentClassDef(Tree tree) {\n Tree current = tree.parent();\n while (current != null) {\n if (current.is(Tree.Kind.CLASSDEF)) {\n return (ClassDef) current;\n } else if (current.is(Tree.Kind.FUNCDEF, Tree.Kind.LAMBDA)) {\n return null;\n }\n ... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_174 | {
"fields": [
{
"declarator": "treeMaker = new PythonTreeMaker()",
"modifier": "private final",
"original_string": "private final PythonTreeMaker treeMaker = new PythonTreeMaker();",
"type": "PythonTreeMaker",
"var_name": "treeMaker"
}
],
"file": "python-frontend/src/test/jav... | {
"body": "@Test\n public void is_expressions() {\n setRootRule(PythonGrammar.TEST);\n\n IsExpression is = (IsExpression) binaryExpression(\"a is 1\");\n assertThat(is.getKind()).isEqualTo(Tree.Kind.IS);\n assertThat(is.operator().value()).isEqualTo(\"is\");\n assertThat(is.leftOperand().getKind()).is... | {
"fields": [
{
"declarator": "F_STRING_PARSER = new FStringParser()",
"modifier": "private static final",
"original_string": "private static final FStringParser F_STRING_PARSER = new FStringParser();",
"type": "FStringParser",
"var_name": "F_STRING_PARSER"
}
],
"file": "pyth... | {
"body": "private Expression binaryExpression(AstNode astNode) {\n List<AstNode> children = astNode.getChildren();\n Expression result = expression(children.get(0));\n for (int i = 1; i < astNode.getNumberOfChildren(); i += 2) {\n AstNode operator = children.get(i);\n Expression rightOperand = exp... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_6 | {
"fields": [],
"file": "python-checks/src/test/java/org/sonar/python/checks/CheckUtilsTest.java",
"identifier": "CheckUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void lambda_equivalence() {\n assertThat(CheckUtils.areEquivalent(parse(\"x = lambda a : a + 10\"), parse(\"x = lambda a : a + 10\"))).isTrue();\n assertThat(CheckUtils.areEquivalent(parse(\"x = lambda a : a + 10\"), parse(\"x = lambda a : a + 5\"))).isFalse();\n }",
"class_method_... | {
"fields": [],
"file": "python-checks/src/main/java/org/sonar/python/checks/CheckUtils.java",
"identifier": "CheckUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "CheckUtils.CheckUtils()",
"constructor": true,
"full_signature": "private CheckUtils()",
"identifi... | {
"body": "public static boolean areEquivalent(@Nullable Tree leftTree, @Nullable Tree rightTree) {\n if (leftTree == rightTree) {\n return true;\n }\n if (leftTree == null || rightTree == null) {\n return false;\n }\n if (leftTree.getKind() != rightTree.getKind() || leftTree.children().size(... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_175 | {
"fields": [
{
"declarator": "treeMaker = new PythonTreeMaker()",
"modifier": "private final",
"original_string": "private final PythonTreeMaker treeMaker = new PythonTreeMaker();",
"type": "PythonTreeMaker",
"var_name": "treeMaker"
}
],
"file": "python-frontend/src/test/jav... | {
"body": "@Test\n public void starred_expression() {\n setRootRule(PythonGrammar.STAR_EXPR);\n UnpackingExpression starred = (UnpackingExpression) parse(\"*a\", treeMaker::expression);\n assertThat(starred.getKind()).isEqualTo(Tree.Kind.UNPACKING_EXPR);\n assertThat(starred.starToken().value()).isEqualT... | {
"fields": [
{
"declarator": "F_STRING_PARSER = new FStringParser()",
"modifier": "private static final",
"original_string": "private static final FStringParser F_STRING_PARSER = new FStringParser();",
"type": "FStringParser",
"var_name": "F_STRING_PARSER"
}
],
"file": "pyth... | {
"body": "public Expression expression(AstNode astNode) {\n if (astNode.is(PythonGrammar.ATOM) && astNode.getFirstChild().is(PythonPunctuator.LBRACKET)) {\n return listLiteral(astNode);\n }\n if (astNode.is(PythonGrammar.ATOM) && astNode.getFirstChild().is(PythonPunctuator.LPARENTHESIS)) {\n retur... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_55 | {
"fields": [],
"file": "sonar-python-plugin/src/test/java/org/sonar/plugins/python/bandit/BanditRulesDefinitionTest.java",
"identifier": "BanditRulesDefinitionTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void bandit_lint_external_repository() {\n RulesDefinition.Context context = new RulesDefinition.Context();\n BanditRulesDefinition rulesDefinition = new BanditRulesDefinition();\n rulesDefinition.define(context);\n\n assertThat(context.repositories()).hasSize(1);\n RulesDefi... | {
"fields": [
{
"declarator": "RULES_JSON = \"org/sonar/plugins/python/bandit/rules.json\"",
"modifier": "private static final",
"original_string": "private static final String RULES_JSON = \"org/sonar/plugins/python/bandit/rules.json\";",
"type": "String",
"var_name": "RULES_JSON"
... | {
"body": "@Override\n public void define(RulesDefinition.Context context) {\n RULE_LOADER.createExternalRuleRepository(context);\n }",
"class_method_signature": "BanditRulesDefinition.define(RulesDefinition.Context context)",
"constructor": false,
"full_signature": "@Override public void define(RulesDefin... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_122 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/tree/TreeUtilsTest.java",
"identifier": "TreeUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void first_ancestor_of_kind() {\n String code = \"\" +\n \"class A:\\n\" +\n \" def foo(): pass\";\n FileInput root = parse(code);\n assertThat(TreeUtils.firstAncestorOfKind(root, Kind.CLASSDEF)).isNull();\n ClassDef classDef = (ClassDef) root.statements().statements(... | {
"fields": [
{
"declarator": "WHITESPACE_TOKEN_TYPES = EnumSet.of(\n PythonTokenType.NEWLINE,\n PythonTokenType.INDENT,\n PythonTokenType.DEDENT)",
"modifier": "private static final",
"original_string": "private static final Set<PythonTokenType> WHITESPACE_TOKEN_TYPES = EnumSet.of(\n ... | {
"body": "@CheckForNull\n public static Tree firstAncestorOfKind(Tree tree, Kind... kinds) {\n return firstAncestor(tree, t -> t.is(kinds));\n }",
"class_method_signature": "TreeUtils.firstAncestorOfKind(Tree tree, Kind... kinds)",
"constructor": false,
"full_signature": "@CheckForNull public static Tree ... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_43 | {
"fields": [
{
"declarator": "inputFile = mock(InputFile.class, \"file1.py\")",
"modifier": "private",
"original_string": "private InputFile inputFile = mock(InputFile.class, \"file1.py\");",
"type": "InputFile",
"var_name": "inputFile"
},
{
"declarator": "thrown = Exp... | {
"body": "@Test\n public void unknown_file() throws Exception {\n when(inputFile.contents()).thenThrow(new FileNotFoundException());\n PythonFile pythonFile = SonarQubePythonFile.create(inputFile);\n thrown.expect(IllegalStateException.class);\n pythonFile.content();\n }",
"class_method_signature": "... | {
"fields": [
{
"declarator": "inputFile",
"modifier": "private final",
"original_string": "private final InputFile inputFile;",
"type": "InputFile",
"var_name": "inputFile"
}
],
"file": "sonar-python-plugin/src/main/java/org/sonar/plugins/python/SonarQubePythonFile.java",
... | {
"body": "public static PythonFile create(InputFile inputFile) {\n return new Sq62File(inputFile);\n }",
"class_method_signature": "SonarQubePythonFile.create(InputFile inputFile)",
"constructor": false,
"full_signature": "public static PythonFile create(InputFile inputFile)",
"identifier": "create",
"... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_134 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/tree/TreeUtilsTest.java",
"identifier": "TreeUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void topLevelFunctionDefs() {\n FileInput fileInput = PythonTestUtils.parse(\n \"class A:\",\n \" x = True\",\n \" def foo(self): pass\",\n \" if x:\",\n \" def bar(self, x): return 1\",\n \" else:\",\n \" def baz(self, x, y): ... | {
"fields": [
{
"declarator": "WHITESPACE_TOKEN_TYPES = EnumSet.of(\n PythonTokenType.NEWLINE,\n PythonTokenType.INDENT,\n PythonTokenType.DEDENT)",
"modifier": "private static final",
"original_string": "private static final Set<PythonTokenType> WHITESPACE_TOKEN_TYPES = EnumSet.of(\n ... | {
"body": "public static List<FunctionDef> topLevelFunctionDefs(ClassDef classDef) {\n CollectFunctionDefsVisitor visitor = new CollectFunctionDefsVisitor();\n classDef.body().accept(visitor);\n\n return visitor.functionDefs;\n }",
"class_method_signature": "TreeUtils.topLevelFunctionDefs(ClassDef classDe... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_14 | {
"fields": [
{
"declarator": "parser = PythonParser.create()",
"modifier": "private",
"original_string": "private PythonParser parser = PythonParser.create();",
"type": "PythonParser",
"var_name": "parser"
}
],
"file": "python-checks/src/test/java/org/sonar/python/checks/Exp... | {
"body": "@Test\n public void unescape_string_element_using_different_prefix() {\n assertThat(unescape(stringElement(\"''\"))).isEqualTo(\"\");\n assertThat(unescape(stringElement(\"b''\"))).isEqualTo(\"\");\n assertThat(unescape(stringElement(\"'a'\"))).isEqualTo(\"a\");\n assertThat(unescape(stringEle... | {
"fields": [
{
"declarator": "ZERO_VALUES = new HashSet<>(Arrays.asList(\"0\", \"0.0\", \"0j\"))",
"modifier": "private static final",
"original_string": "private static final Set<String> ZERO_VALUES = new HashSet<>(Arrays.asList(\"0\", \"0.0\", \"0j\"));",
"type": "Set<String>",
"v... | {
"body": "public static String unescape(StringLiteral stringLiteral) {\n List<StringElement> elements = stringLiteral.stringElements();\n if (elements.size() == 1) {\n return unescape(elements.get(0));\n }\n return elements.stream()\n .map(Expressions::unescape)\n .collect(Collectors.joini... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_163 | {
"fields": [
{
"declarator": "treeMaker = new PythonTreeMaker()",
"modifier": "private final",
"original_string": "private final PythonTreeMaker treeMaker = new PythonTreeMaker();",
"type": "PythonTreeMaker",
"var_name": "treeMaker"
}
],
"file": "python-frontend/src/test/jav... | {
"body": "@Test\n public void continueStatement() {\n setRootRule(PythonGrammar.CONTINUE_STMT);\n AstNode astNode = p.parse(\"continue\");\n StatementWithSeparator statementWithSeparator = new StatementWithSeparator(astNode, null);\n ContinueStatement continueStatement = treeMaker.continueStatement(stat... | {
"fields": [
{
"declarator": "F_STRING_PARSER = new FStringParser()",
"modifier": "private static final",
"original_string": "private static final FStringParser F_STRING_PARSER = new FStringParser();",
"type": "FStringParser",
"var_name": "F_STRING_PARSER"
}
],
"file": "pyth... | {
"body": "public ContinueStatement continueStatement(StatementWithSeparator statementWithSeparator) {\n AstNode astNode = statementWithSeparator.statement();\n Separators separators = statementWithSeparator.separator();\n return new ContinueStatementImpl(toPyToken(astNode.getToken()), separators);\n }",
... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_231 | {
"fields": [
{
"declarator": "a = new ClassSymbolImpl(\"a\", \"a\")",
"modifier": "private final",
"original_string": "private final ClassSymbolImpl a = new ClassSymbolImpl(\"a\", \"a\");",
"type": "ClassSymbolImpl",
"var_name": "a"
},
{
"declarator": "b = new ClassSym... | {
"body": "@Test\n public void test_isCompatibleWith_declared_union_with_missing_symbols() {\n ClassSymbolImpl x = new ClassSymbolImpl(\"x\", \"x\");\n ClassSymbolImpl union = new ClassSymbolImpl(\"union\", \"typing.Union\");\n assertThat(new RuntimeType(x).isCompatibleWith(new DeclaredType(union))).isTrue(... | {
"fields": [
{
"declarator": "typeClass",
"modifier": "private final",
"original_string": "private final ClassSymbol typeClass;",
"type": "ClassSymbol",
"var_name": "typeClass"
},
{
"declarator": "typeClassSuperClassesFQN = null",
"modifier": "private",
"or... | {
"body": "@Override\n public boolean isCompatibleWith(InferredType other) {\n return InferredTypes.isTypeClassCompatibleWith(typeClass, other);\n }",
"class_method_signature": "RuntimeType.isCompatibleWith(InferredType other)",
"constructor": false,
"full_signature": "@Override public boolean isCompatible... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_80 | {
"fields": [
{
"declarator": "file = Mockito.mock(PythonFile.class, \"file1.py\")",
"modifier": "private final",
"original_string": "private final PythonFile file = Mockito.mock(PythonFile.class, \"file1.py\");",
"type": "PythonFile",
"var_name": "file"
},
{
"declarato... | {
"body": "@Test\n public void valuesAtLocation_invalid_cfg() {\n Name x = (Name) lastExpressionInFunction(\"x = 42\", \"break\", \"x\");\n assertThat(analysis.valuesAtLocation(x)).isEmpty();\n }",
"class_method_signature": "ReachingDefinitionsAnalysisTest.valuesAtLocation_invalid_cfg()",
"constructor": f... | {
"fields": [
{
"declarator": "programStateByBlock = new HashMap<>()",
"modifier": "private final",
"original_string": "private final Map<CfgBlock, ProgramStateAtBlock> programStateByBlock = new HashMap<>();",
"type": "Map<CfgBlock, ProgramStateAtBlock>",
"var_name": "programStateByB... | {
"body": "public Set<Expression> valuesAtLocation(Name variable) {\n Symbol symbol = variable.symbol();\n if (symbol == null) {\n return Collections.emptySet();\n }\n Set<Expression> assignedExpressions = assignedExpressionByName.get(variable);\n if (assignedExpressions != null) {\n // avoid... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_118 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/tree/StringElementImplTest.java",
"identifier": "StringElementImplTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void isInterpolated() {\n assertThat(stringElement(\"'abc'\").isInterpolated()).isFalse();\n assertThat(stringElement(\"f'abc'\").isInterpolated()).isTrue();\n assertThat(stringElement(\"F'abc'\").isInterpolated()).isTrue();\n assertThat(stringElement(\"r'abc'\").isInterpolated(... | {
"fields": [
{
"declarator": "value",
"modifier": "private final",
"original_string": "private final String value;",
"type": "String",
"var_name": "value"
},
{
"declarator": "token",
"modifier": "private final",
"original_string": "private final Token token... | {
"body": "@Override\n public boolean isInterpolated() {\n String prefix = prefix();\n return prefix.indexOf('f') >= 0 || prefix.indexOf('F') >= 0;\n }",
"class_method_signature": "StringElementImpl.isInterpolated()",
"constructor": false,
"full_signature": "@Override public boolean isInterpolated()",
... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_38 | {
"fields": [
{
"declarator": "ABSOLUTE_PATH_PLACEHOLDER = \"{ABSOLUTE_PATH_PLACEHOLDER}\"",
"modifier": "private static final",
"original_string": "private static final String ABSOLUTE_PATH_PLACEHOLDER = \"{ABSOLUTE_PATH_PLACEHOLDER}\";",
"type": "String",
"var_name": "ABSOLUTE_PATH... | {
"body": "@Test(expected = IllegalStateException.class)\n public void should_fail_on_invalid_report() {\n settings.setProperty(PythonCoverageSensor.REPORT_PATHS_KEY, \"invalid-coverage-result.xml\");\n coverageSensor.execute(context);\n }",
"class_method_signature": "PythonCoverageSensorTest.should_fail_on... | {
"fields": [
{
"declarator": "LOG = Loggers.get(PythonCoverageSensor.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = Loggers.get(PythonCoverageSensor.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "RE... | {
"body": "@Override\n public void execute(SensorContext context) {\n String baseDir = context.fileSystem().baseDir().getPath();\n Configuration config = context.config();\n\n warnDeprecatedPropertyUsage(config);\n\n HashSet<InputFile> filesCovered = new HashSet<>();\n List<File> reports = getCoverage... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_159 | {
"fields": [
{
"declarator": "treeMaker = new PythonTreeMaker()",
"modifier": "private final",
"original_string": "private final PythonTreeMaker treeMaker = new PythonTreeMaker();",
"type": "PythonTreeMaker",
"var_name": "treeMaker"
}
],
"file": "python-frontend/src/test/jav... | {
"body": "@Test\n public void returnStatement() {\n setRootRule(PythonGrammar.RETURN_STMT);\n AstNode astNode = p.parse(\"return foo\");\n StatementWithSeparator statementWithSeparator = new StatementWithSeparator(astNode, null);\n ReturnStatement returnStatement = treeMaker.returnStatement(statementWit... | {
"fields": [
{
"declarator": "F_STRING_PARSER = new FStringParser()",
"modifier": "private static final",
"original_string": "private static final FStringParser F_STRING_PARSER = new FStringParser();",
"type": "FStringParser",
"var_name": "F_STRING_PARSER"
}
],
"file": "pyth... | {
"body": "public ReturnStatement returnStatement(StatementWithSeparator statementWithSeparator) {\n AstNode astNode = statementWithSeparator.statement();\n Separators separators = statementWithSeparator.separator();\n AstNode testListNode = astNode.getFirstChild(PythonGrammar.TESTLIST_STAR_EXPR);\n List<... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_96 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/semantic/SymbolUtilsTest.java",
"identifier": "SymbolUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void fqn_by_package_with_subpackage() {\n assertThat(SymbolUtils.fullyQualifiedModuleName(\"\", \"foo.py\")).isEqualTo(\"foo\");\n assertThat(SymbolUtils.fullyQualifiedModuleName(\"foo\", \"__init__.py\")).isEqualTo(\"foo\");\n assertThat(SymbolUtils.fullyQualifiedModuleName(\"foo\... | {
"fields": [],
"file": "python-frontend/src/main/java/org/sonar/python/semantic/SymbolUtils.java",
"identifier": "SymbolUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "SymbolUtils.SymbolUtils()",
"constructor": true,
"full_signature": "private SymbolUtils()",
... | {
"body": "public static String fullyQualifiedModuleName(String packageName, String fileName) {\n String moduleName = getModuleFileName(fileName);\n if (moduleName.equals(\"__init__\")) {\n return packageName;\n }\n return packageName.isEmpty()\n ? moduleName\n : (packageName + \".\" + modu... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_227 | {
"fields": [
{
"declarator": "a = new ClassSymbolImpl(\"a\", \"a\")",
"modifier": "private final",
"original_string": "private final ClassSymbolImpl a = new ClassSymbolImpl(\"a\", \"a\");",
"type": "ClassSymbolImpl",
"var_name": "a"
},
{
"declarator": "b = new ClassSym... | {
"body": "@Test\n public void test_isCompatibleWith() {\n ClassSymbolImpl x1 = new ClassSymbolImpl(\"x1\", \"x1\");\n ClassSymbolImpl x2 = new ClassSymbolImpl(\"x2\", \"x2\");\n x2.addSuperClass(x1);\n\n assertThat(new RuntimeType(x2).isCompatibleWith(new RuntimeType(x1))).isTrue();\n assertThat(new ... | {
"fields": [
{
"declarator": "typeClass",
"modifier": "private final",
"original_string": "private final ClassSymbol typeClass;",
"type": "ClassSymbol",
"var_name": "typeClass"
},
{
"declarator": "typeClassSuperClassesFQN = null",
"modifier": "private",
"or... | {
"body": "@Override\n public boolean isCompatibleWith(InferredType other) {\n return InferredTypes.isTypeClassCompatibleWith(typeClass, other);\n }",
"class_method_signature": "RuntimeType.isCompatibleWith(InferredType other)",
"constructor": false,
"full_signature": "@Override public boolean isCompatible... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_79 | {
"fields": [
{
"declarator": "file = Mockito.mock(PythonFile.class, \"file1.py\")",
"modifier": "private final",
"original_string": "private final PythonFile file = Mockito.mock(PythonFile.class, \"file1.py\");",
"type": "PythonFile",
"var_name": "file"
},
{
"declarato... | {
"body": "@Test\n public void valuesAtLocation_outside_function() {\n Name x = (Name) lastExpression(\"x = 42; x\");\n assertThat(analysis.valuesAtLocation(x)).isEmpty();\n }",
"class_method_signature": "ReachingDefinitionsAnalysisTest.valuesAtLocation_outside_function()",
"constructor": false,
"full_s... | {
"fields": [
{
"declarator": "programStateByBlock = new HashMap<>()",
"modifier": "private final",
"original_string": "private final Map<CfgBlock, ProgramStateAtBlock> programStateByBlock = new HashMap<>();",
"type": "Map<CfgBlock, ProgramStateAtBlock>",
"var_name": "programStateByB... | {
"body": "public Set<Expression> valuesAtLocation(Name variable) {\n Symbol symbol = variable.symbol();\n if (symbol == null) {\n return Collections.emptySet();\n }\n Set<Expression> assignedExpressions = assignedExpressionByName.get(variable);\n if (assignedExpressions != null) {\n // avoid... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_179 | {
"fields": [
{
"declarator": "treeMaker = new PythonTreeMaker()",
"modifier": "private final",
"original_string": "private final PythonTreeMaker treeMaker = new PythonTreeMaker();",
"type": "PythonTreeMaker",
"var_name": "treeMaker"
}
],
"file": "python-frontend/src/test/jav... | {
"body": "@Test\n public void multiline_string_literal_expression() {\n setRootRule(PythonGrammar.ATOM);\n Expression parse = parse(\"('Hello \\\\ ' #Noncompliant\\n 'world')\", treeMaker::expression);\n assertThat(parse.is(Tree.Kind.PARENTHESIZED)).isTrue();\n ParenthesizedExpression parenth... | {
"fields": [
{
"declarator": "F_STRING_PARSER = new FStringParser()",
"modifier": "private static final",
"original_string": "private static final FStringParser F_STRING_PARSER = new FStringParser();",
"type": "FStringParser",
"var_name": "F_STRING_PARSER"
}
],
"file": "pyth... | {
"body": "public Expression expression(AstNode astNode) {\n if (astNode.is(PythonGrammar.ATOM) && astNode.getFirstChild().is(PythonPunctuator.LBRACKET)) {\n return listLiteral(astNode);\n }\n if (astNode.is(PythonGrammar.ATOM) && astNode.getFirstChild().is(PythonPunctuator.LPARENTHESIS)) {\n retur... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_196 | {
"fields": [
{
"declarator": "a = new ClassSymbolImpl(\"a\", \"a\")",
"modifier": "private final",
"original_string": "private final ClassSymbolImpl a = new ClassSymbolImpl(\"a\", \"a\");",
"type": "ClassSymbolImpl",
"var_name": "a"
},
{
"declarator": "b = new ClassSym... | {
"body": "@Test\n public void test_hashCode() {\n DeclaredType aType = new DeclaredType(a);\n assertThat(aType.hashCode()).isEqualTo(new DeclaredType(a).hashCode());\n assertThat(aType.hashCode()).isNotEqualTo(new DeclaredType(b).hashCode());\n assertThat(aType.hashCode()).isNotEqualTo(new DeclaredType(... | {
"fields": [
{
"declarator": "typeClass",
"modifier": "private final",
"original_string": "private final Symbol typeClass;",
"type": "Symbol",
"var_name": "typeClass"
},
{
"declarator": "typeArgs",
"modifier": "private final",
"original_string": "private fi... | {
"body": "@Override\n public int hashCode() {\n return Objects.hash(typeClass.name(), typeClass.fullyQualifiedName(), typeArgs);\n }",
"class_method_signature": "DeclaredType.hashCode()",
"constructor": false,
"full_signature": "@Override public int hashCode()",
"identifier": "hashCode",
"invocations"... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_250 | {
"fields": [
{
"declarator": "treeMaker = new PythonTreeMaker()",
"modifier": "private final",
"original_string": "private final PythonTreeMaker treeMaker = new PythonTreeMaker();",
"type": "PythonTreeMaker",
"var_name": "treeMaker"
}
],
"file": "python-frontend/src/test/jav... | {
"body": "@Test\n public void subscription_expr() {\n setRootRule(PythonGrammar.EXPR);\n SubscriptionExpression expr = (SubscriptionExpression) parse(\"a[b]\", treeMaker::expression);\n FirstLastTokenVerifierVisitor visitor = spy(FirstLastTokenVerifierVisitor.class);\n expr.accept(visitor);\n verify(... | {
"fields": [],
"file": "python-frontend/src/main/java/org/sonar/plugins/python/api/tree/BaseTreeVisitor.java",
"identifier": "BaseTreeVisitor",
"interfaces": "implements TreeVisitor",
"methods": [
{
"class_method_signature": "BaseTreeVisitor.scan(@Nullable Tree tree)",
"constructor": false,
... | {
"body": "@Override\n public void visitName(Name pyNameTree) {\n // nothing to scan on a name\n }",
"class_method_signature": "BaseTreeVisitor.visitName(Name pyNameTree)",
"constructor": false,
"full_signature": "@Override public void visitName(Name pyNameTree)",
"identifier": "visitName",
"invocation... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_59 | {
"fields": [],
"file": "sonar-python-plugin/src/test/java/org/sonar/plugins/python/parser/StaxParserTest.java",
"identifier": "StaxParserTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void test_XML_with_XSD() throws XMLStreamException {\n StaxParser parser = new StaxParser(getTestHandler());\n parser.parse(getClass().getClassLoader().getResourceAsStream(\"org/sonar/plugins/python/parser/xsd-test.xml\"));\n }",
"class_method_signature": "StaxParserTest.test_XML_w... | {
"fields": [
{
"declarator": "inf",
"modifier": "private",
"original_string": "private SMInputFactory inf;",
"type": "SMInputFactory",
"var_name": "inf"
},
{
"declarator": "streamHandler",
"modifier": "private",
"original_string": "private XmlStreamHandler ... | {
"body": "public void parse(File xmlFile) throws XMLStreamException {\n try (FileInputStream input = new FileInputStream(xmlFile)) {\n parse(input);\n } catch (IOException e) {\n throw new XMLStreamException(e);\n }\n }",
"class_method_signature": "StaxParser.parse(File xmlFile)",
"constructo... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_207 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/types/TypeShedTest.java",
"identifier": "TypeShedTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void unknown_name() {\n TypeShed.typeShedClass(\"xxx\");\n }",
"class_method_signature": "TypeShedTest.unknown_name()",
"constructor": false,
"full_signature": "@Test(expected = IllegalArgumentException.class) public void unknown_name()",... | {
"fields": [
{
"declarator": "TYPING = \"typing\"",
"modifier": "private static final",
"original_string": "private static final String TYPING = \"typing\";",
"type": "String",
"var_name": "TYPING"
},
{
"declarator": "TYPING_EXTENSIONS = \"typing_extensions\"",
"... | {
"body": "public static ClassSymbol typeShedClass(String fullyQualifiedName) {\n Symbol symbol = builtinSymbols().get(fullyQualifiedName);\n if (symbol == null) {\n throw new IllegalArgumentException(\"No TypeShed symbol found for name: \" + fullyQualifiedName);\n }\n if (symbol.kind() != Symbol.Kin... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_138 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/tree/TreeUtilsTest.java",
"identifier": "TreeUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void test_argumentByKeyword() {\n FileInput fileInput = PythonTestUtils.parse(\n \"def foo(p0, p1, p2): ...\",\n \"foo(p1 = 1, p2 = 2)\"\n );\n CallExpression callExpr = PythonTestUtils.getLastDescendant(fileInput, tree -> tree.is(Kind.CALL_EXPR));\n RegularArgument p1... | {
"fields": [
{
"declarator": "WHITESPACE_TOKEN_TYPES = EnumSet.of(\n PythonTokenType.NEWLINE,\n PythonTokenType.INDENT,\n PythonTokenType.DEDENT)",
"modifier": "private static final",
"original_string": "private static final Set<PythonTokenType> WHITESPACE_TOKEN_TYPES = EnumSet.of(\n ... | {
"body": "@CheckForNull\n public static RegularArgument argumentByKeyword(String keyword, List<Argument> arguments) {\n for (int i = 0; i < arguments.size(); i++) {\n Argument argument = arguments.get(i);\n if (hasKeyword(argument, keyword)) {\n return ((RegularArgument) argument);\n }\n ... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_211 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/types/TypeShedTest.java",
"identifier": "TypeShedTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void package_relative_import() {\n Map<String, Symbol> osSymbols = TypeShed.symbolsForModule(\"os\").stream().collect(Collectors.toMap(Symbol::name, Function.identity(), AmbiguousSymbolImpl::create));\n Symbol sysSymbol = osSymbols.get(\"sys\");\n assertThat(sysSymbol.kind()).isEqu... | {
"fields": [
{
"declarator": "TYPING = \"typing\"",
"modifier": "private static final",
"original_string": "private static final String TYPING = \"typing\";",
"type": "String",
"var_name": "TYPING"
},
{
"declarator": "TYPING_EXTENSIONS = \"typing_extensions\"",
"... | {
"body": "public static Set<Symbol> symbolsForModule(String moduleName) {\n if (!TypeShed.typeShedSymbols.containsKey(moduleName)) {\n Set<Symbol> symbols = searchTypeShedForModule(moduleName);\n typeShedSymbols.put(moduleName, symbols);\n return symbols;\n }\n return TypeShed.typeShedSymbols... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_180 | {
"fields": [
{
"declarator": "treeMaker = new PythonTreeMaker()",
"modifier": "private final",
"original_string": "private final PythonTreeMaker treeMaker = new PythonTreeMaker();",
"type": "PythonTreeMaker",
"var_name": "treeMaker"
}
],
"file": "python-frontend/src/test/jav... | {
"body": "@Test\n public void parenthesized_expression() {\n setRootRule(PythonGrammar.TEST);\n ParenthesizedExpression parenthesized = (ParenthesizedExpression) parse(\"(42)\", treeMaker::expression);\n assertThat(parenthesized.getKind()).isEqualTo(Tree.Kind.PARENTHESIZED);\n assertThat(parenthesized.c... | {
"fields": [
{
"declarator": "F_STRING_PARSER = new FStringParser()",
"modifier": "private static final",
"original_string": "private static final FStringParser F_STRING_PARSER = new FStringParser();",
"type": "FStringParser",
"var_name": "F_STRING_PARSER"
}
],
"file": "pyth... | {
"body": "public Expression expression(AstNode astNode) {\n if (astNode.is(PythonGrammar.ATOM) && astNode.getFirstChild().is(PythonPunctuator.LBRACKET)) {\n return listLiteral(astNode);\n }\n if (astNode.is(PythonGrammar.ATOM) && astNode.getFirstChild().is(PythonPunctuator.LPARENTHESIS)) {\n retur... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_18 | {
"fields": [
{
"declarator": "parser = PythonParser.create()",
"modifier": "private",
"original_string": "private PythonParser parser = PythonParser.create();",
"type": "PythonParser",
"var_name": "parser"
}
],
"file": "python-checks/src/test/java/org/sonar/python/checks/Exp... | {
"body": "@Test\n public void unescape_string_element_python_string_with_x_u_U_escape_sequences() {\n assertThat(unescape(stringElement(\"'\\\\x48\\\\u0065\\\\U0000006c\\\\x6c\\\\x6f\\\\x20\\\\x57\\\\x6f\\\\x72\\\\x6c\\\\x64\\\\x21'\")))\n .isEqualTo(\"Hello World!\");\n }",
"class_method_signature": "Ex... | {
"fields": [
{
"declarator": "ZERO_VALUES = new HashSet<>(Arrays.asList(\"0\", \"0.0\", \"0j\"))",
"modifier": "private static final",
"original_string": "private static final Set<String> ZERO_VALUES = new HashSet<>(Arrays.asList(\"0\", \"0.0\", \"0j\"));",
"type": "Set<String>",
"v... | {
"body": "public static String unescape(StringLiteral stringLiteral) {\n List<StringElement> elements = stringLiteral.stringElements();\n if (elements.size() == 1) {\n return unescape(elements.get(0));\n }\n return elements.stream()\n .map(Expressions::unescape)\n .collect(Collectors.joini... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_246 | {
"fields": [
{
"declarator": "file = Mockito.mock(PythonFile.class, \"file1.py\")",
"modifier": "private",
"original_string": "private PythonFile file = Mockito.mock(PythonFile.class, \"file1.py\");",
"type": "PythonFile",
"var_name": "file"
}
],
"file": "python-frontend/src... | {
"body": "@Test\n public void CFG_toString() {\n ControlFlowGraph cfg = cfg(\"\" +\n \"if x:\",\n \" return 1\",\n \"else:\",\n \" foo()\",\n \" return 2\"\n );\n assertThat(cfg.toString()).isEqualTo(\"\" +\n \"0[label=\\\"2:2:NAME\\\"];\" +\n \"1[label=\\\"3:6:R... | {
"fields": [
{
"declarator": "LOG = Loggers.get(ControlFlowGraph.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = Loggers.get(ControlFlowGraph.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "blocks",
... | {
"body": "@Override\n public String toString() {\n StringBuilder sb = new StringBuilder();\n\n Function<Collection<CfgBlock>, List<CfgBlock>> sortedByDisplayString = list -> list.stream()\n .sorted(Comparator.comparing(Object::toString))\n .collect(Collectors.toList());\n\n List<CfgBlock> sortedB... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_114 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/semantic/SymbolImplTest.java",
"identifier": "SymbolImplTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void assert_is() {\n Symbol x = symbols(\"x = 42\").get(\"x\");\n assertThat(x.is(Symbol.Kind.OTHER)).isTrue();\n\n Symbol foo = symbols(\"def foo(): ...\").get(\"foo\");\n assertThat(foo.is(Symbol.Kind.FUNCTION)).isTrue();\n assertThat(foo.is(Symbol.Kind.OTHER)).isFalse();\n... | {
"fields": [
{
"declarator": "name",
"modifier": "private final",
"original_string": "private final String name;",
"type": "String",
"var_name": "name"
},
{
"declarator": "fullyQualifiedName",
"modifier": "@Nullable",
"original_string": "@Nullable\n String... | {
"body": "@Override\n public boolean is(Kind... kinds) {\n Kind symbolKind = kind();\n for (Kind kindIter : kinds) {\n if (symbolKind == kindIter) {\n return true;\n }\n }\n return false;\n }",
"class_method_signature": "SymbolImpl.is(Kind... kinds)",
"constructor": false,
"full_... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_63 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/metrics/FileMetricsTest.java",
"identifier": "FileMetricsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void functions() {\n assertThat(metrics(\"functions.py\").numberOfFunctions()).isEqualTo(1);\n }",
"class_method_signature": "FileMetricsTest.functions()",
"constructor": false,
"full_signature": "@Test public void functions()",
"identifier": "functions",
"invocations": [
... | {
"fields": [
{
"declarator": "numberOfStatements",
"modifier": "private",
"original_string": "private int numberOfStatements;",
"type": "int",
"var_name": "numberOfStatements"
},
{
"declarator": "numberOfClasses",
"modifier": "private",
"original_string": "... | {
"body": "public int numberOfFunctions() {\n return functionComplexities.size();\n }",
"class_method_signature": "FileMetrics.numberOfFunctions()",
"constructor": false,
"full_signature": "public int numberOfFunctions()",
"identifier": "numberOfFunctions",
"invocations": [
"size"
],
"modifiers"... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_143 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/tree/SliceExpressionImplTest.java",
"identifier": "SliceExpressionImplTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void type() {\n assertThat(lastExpression(\"[42, 43][1:2]\").type()).isEqualTo(LIST);\n assertThat(lastExpression(\"(42, 43)[1:2]\").type()).isEqualTo(TUPLE);\n assertThat(lastExpression(\"foo()[1:2]\").type()).isEqualTo(InferredTypes.anyType());\n\n assertThat(isDeclaredTypeWit... | {
"fields": [
{
"declarator": "object",
"modifier": "private final",
"original_string": "private final Expression object;",
"type": "Expression",
"var_name": "object"
},
{
"declarator": "leftBracket",
"modifier": "private final",
"original_string": "private ... | {
"body": "@Override\n public InferredType type() {\n InferredType objectType = object.type();\n if (objectType.equals(LIST)) {\n return LIST;\n }\n if (isDeclaredTypeWithTypeClass(objectType, BuiltinTypes.LIST)) {\n return objectType;\n }\n if (objectType.equals(TUPLE)) {\n return T... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_34 | {
"fields": [
{
"declarator": "ABSOLUTE_PATH_PLACEHOLDER = \"{ABSOLUTE_PATH_PLACEHOLDER}\"",
"modifier": "private static final",
"original_string": "private static final String ABSOLUTE_PATH_PLACEHOLDER = \"{ABSOLUTE_PATH_PLACEHOLDER}\";",
"type": "String",
"var_name": "ABSOLUTE_PATH... | {
"body": "@Test\n public void test_report_with_absolute_path() throws Exception {\n String reportPath = createReportWithAbsolutePaths();\n settings.setProperty(PythonCoverageSensor.REPORT_PATHS_KEY, reportPath);\n\n coverageSensor.execute(context);\n\n assertThat(context.lineHits(FILE1_KEY, 1)).isEqualT... | {
"fields": [
{
"declarator": "LOG = Loggers.get(PythonCoverageSensor.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = Loggers.get(PythonCoverageSensor.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "RE... | {
"body": "@Override\n public void execute(SensorContext context) {\n String baseDir = context.fileSystem().baseDir().getPath();\n Configuration config = context.config();\n\n warnDeprecatedPropertyUsage(config);\n\n HashSet<InputFile> filesCovered = new HashSet<>();\n List<File> reports = getCoverage... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_155 | {
"fields": [
{
"declarator": "treeMaker = new PythonTreeMaker()",
"modifier": "private final",
"original_string": "private final PythonTreeMaker treeMaker = new PythonTreeMaker();",
"type": "PythonTreeMaker",
"var_name": "treeMaker"
}
],
"file": "python-frontend/src/test/jav... | {
"body": "@Test\n public void execStatement() {\n setRootRule(PythonGrammar.EXEC_STMT);\n AstNode astNode = p.parse(\"exec 'foo'\");\n StatementWithSeparator statementWithSeparator = new StatementWithSeparator(astNode, null);\n ExecStatement execStatement = treeMaker.execStatement(statementWithSeparator... | {
"fields": [
{
"declarator": "F_STRING_PARSER = new FStringParser()",
"modifier": "private static final",
"original_string": "private static final FStringParser F_STRING_PARSER = new FStringParser();",
"type": "FStringParser",
"var_name": "F_STRING_PARSER"
}
],
"file": "pyth... | {
"body": "public ExecStatement execStatement(StatementWithSeparator statementWithSeparator) {\n AstNode astNode = statementWithSeparator.statement();\n Expression expression = expression(astNode.getFirstChild(PythonGrammar.EXPR));\n List<Expression> expressions = expressionsFromTest(astNode);\n Separator... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_22 | {
"fields": [
{
"declarator": "parser = PythonParser.create()",
"modifier": "private",
"original_string": "private PythonParser parser = PythonParser.create();",
"type": "PythonParser",
"var_name": "parser"
}
],
"file": "python-checks/src/test/java/org/sonar/python/checks/Exp... | {
"body": "@Test\n public void singleAssignedValue() {\n assertThat(lastNameValue(\"x = 42; x\").getKind()).isEqualTo(Kind.NUMERIC_LITERAL);\n assertThat(lastNameValue(\"x = ''; x\").getKind()).isEqualTo(Kind.STRING_LITERAL);\n assertThat(lastNameValue(\"(x, y) = (42, 43); x\")).isNull();\n assertThat(la... | {
"fields": [
{
"declarator": "ZERO_VALUES = new HashSet<>(Arrays.asList(\"0\", \"0.0\", \"0j\"))",
"modifier": "private static final",
"original_string": "private static final Set<String> ZERO_VALUES = new HashSet<>(Arrays.asList(\"0\", \"0.0\", \"0j\"));",
"type": "Set<String>",
"v... | {
"body": "public static Expression singleAssignedValue(Name name) {\n Symbol symbol = name.symbol();\n if (symbol == null) {\n return null;\n }\n Expression result = null;\n for (Usage usage : symbol.usages()) {\n if (usage.kind() == Usage.Kind.ASSIGNMENT_LHS) {\n if (result != null) ... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_102 | {
"fields": [],
"file": "python-frontend/src/test/java/org/sonar/python/semantic/ProjectLevelSymbolTableTest.java",
"identifier": "ProjectLevelSymbolTableTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void function_symbol() {\n FunctionDef functionDef = (FunctionDef) parse(\"def fn(p1, p2): pass\").statements().statements().get(0);\n FunctionSymbolImpl fnSymbol = new FunctionSymbolImpl(functionDef, \"mod.fn\", pythonFile(\"mod.py\"));\n List<Symbol> modSymbols = Collections.sing... | {
"fields": [
{
"declarator": "globalSymbolsByModuleName",
"modifier": "private final",
"original_string": "private final Map<String, Set<Symbol>> globalSymbolsByModuleName;",
"type": "Map<String, Set<Symbol>>",
"var_name": "globalSymbolsByModuleName"
},
{
"declarator":... | {
"body": "public static ProjectLevelSymbolTable from(Map<String, Set<Symbol>> globalSymbolsByModuleName) {\n return new ProjectLevelSymbolTable(globalSymbolsByModuleName);\n }",
"class_method_signature": "ProjectLevelSymbolTable.from(Map<String, Set<Symbol>> globalSymbolsByModuleName)",
"constructor": false,... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
4810329_75 | {
"fields": [
{
"declarator": "visitor = new ComplexityVisitor()",
"modifier": "private",
"original_string": "private ComplexityVisitor visitor = new ComplexityVisitor();",
"type": "ComplexityVisitor",
"var_name": "visitor"
},
{
"declarator": "parser = PythonParser.crea... | {
"body": "@Test\n public void for_statement() {\n assertThat(complexity(\"for i in list: pass\")).isEqualTo(1);\n }",
"class_method_signature": "ComplexityVisitorTest.for_statement()",
"constructor": false,
"full_signature": "@Test public void for_statement()",
"identifier": "for_statement",
"invocati... | {
"fields": [
{
"declarator": "complexity = 0",
"modifier": "private",
"original_string": "private int complexity = 0;",
"type": "int",
"var_name": "complexity"
}
],
"file": "python-frontend/src/main/java/org/sonar/python/metrics/ComplexityVisitor.java",
"identifier": "Comp... | {
"body": "public static int complexity(Tree pyTree) {\n ComplexityVisitor visitor = pyTree.is(Tree.Kind.FUNCDEF) ? new FunctionComplexityVisitor() : new ComplexityVisitor();\n pyTree.accept(visitor);\n return visitor.complexity;\n }",
"class_method_signature": "ComplexityVisitor.complexity(Tree pyTree)",... | {
"created": "6/27/2012 3:50:36 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 4810329,
"size": null,
"stargazer_count": null,
"stars": 138,
"updates": "2020-01-27T13:20:07+00:00",
"url": "https://github.com/SonarSource/sonar... |
22337952_42 | {
"fields": [
{
"declarator": "mListener",
"modifier": "@Nonnull\n private",
"original_string": "@Nonnull\n private RequestListener mListener;",
"type": "RequestListener",
"var_name": "mListener"
},
{
"declarator": "mFlow",
"modifier": "@Nonnull\n private... | {
"body": "@Test\n public void testShouldErrorIfResultCodeItNotOk() throws Exception {\n mFlow.onActivityResult(1, Activity.RESULT_CANCELED, new Intent());\n\n verifyError(OK, BillingException.class);\n }",
"class_method_signature": "PurchaseFlowTest.testShouldErrorIfResultCodeItNotOk()",
"con... | {
"fields": [
{
"declarator": "EXTRA_RESPONSE = \"RESPONSE_CODE\"",
"modifier": "static final",
"original_string": "static final String EXTRA_RESPONSE = \"RESPONSE_CODE\";",
"type": "String",
"var_name": "EXTRA_RESPONSE"
},
{
"declarator": "EXTRA_PURCHASE_DATA = \"INAPP... | {
"body": "void onActivityResult(int requestCode, int resultCode, Intent intent) {\n try {\n Check.equals(mRequestCode, requestCode);\n if (intent == null) {\n // sometimes intent is null (it's not obvious when it happens but it happens from time to time)\n h... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_2 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/PurchasesTest.java",
"identifier": "PurchasesTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testShouldReadEmptyList() throws Exception {\n final Bundle bundle = new Bundle();\n bundle.putStringArrayList(Purchases.BUNDLE_DATA_LIST, new ArrayList<String>());\n final Purchases purchases = Purchases.fromBundle(bundle, \"test\");\n assertTrue(purchase... | {
"fields": [
{
"declarator": "BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\"",
"modifier": "static final",
"original_string": "static final String BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\";",
"type": "String",
"var_name": "BUNDLE_DATA_LIST"
},
{
"declarator": "B... | {
"body": "@Nonnull\n static Purchases fromBundle(@Nonnull Bundle bundle, @Nonnull String product) throws JSONException {\n final String continuationToken = getContinuationTokenFromBundle(bundle);\n final List<Purchase> purchases = getListFromBundle(bundle);\n return new Purchases(product, pur... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_15 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/PurchasesTest.java",
"identifier": "PurchasesTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testSinglePurchaseCantBeNeutralized() throws Exception {\n List<Purchase> purchases = Purchases.neutralize(asList(newPurchase(\"test\", 1, EXPIRED)));\n assertEquals(1, purchases.size());\n Purchase purchase = purchases.get(0);\n assertEquals(1, purchase.t... | {
"fields": [
{
"declarator": "BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\"",
"modifier": "static final",
"original_string": "static final String BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\";",
"type": "String",
"var_name": "BUNDLE_DATA_LIST"
},
{
"declarator": "B... | {
"body": "@Nonnull\n static List<Purchase> neutralize(@Nonnull List<Purchase> purchases) {\n // probably, it's possible to avoid creation of temporary list. The reason for it is that we don't want to\n // modify original list\n purchases = new LinkedList<>(purchases);\n\n final List<Pu... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_54 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/ConcurrentCacheTest.java",
"identifier": "ConcurrentCacheTest",
"interfaces": "",
"superclass": "extends CacheTestBase"
} | {
"body": "@Test\n public void testShouldPutAllEntries() throws Exception {\n final Cache mockCache = mock(Cache.class);\n final ConcurrentCache cache = new ConcurrentCache(mockCache);\n\n final Cache.Entry entry = newEntry();\n cache.put(newKey(), entry);\n cache.put(newKey(), e... | {
"fields": [
{
"declarator": "TAG = \"Cache\"",
"modifier": "@Nonnull\n private static final",
"original_string": "@Nonnull\n private static final String TAG = \"Cache\";",
"type": "String",
"var_name": "TAG"
},
{
"declarator": "mCache",
"modifier": "@Guard... | {
"body": "@Override\n public void put(@Nonnull Key key, @Nonnull Entry entry) {\n if (mCache == null) {\n return;\n }\n synchronized (this) {\n Billing.debug(TAG, \"Adding entry with key=\" + key + \" to the cache\");\n mCache.put(key, entry);\n }\n ... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_39 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/MainThreadRequestListenerTest.java",
"identifier": "MainThreadRequestListenerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testShouldCancelErrorRunnable() throws Exception {\n final RequestListener l = mock(RequestListener.class);\n final CancellableExecutor executor = new TestExecutor();\n final MainThreadRequestListener mtl = new MainThreadRequestListener(executor, l);\n\n m... | {
"fields": [
{
"declarator": "mMainThread",
"modifier": "@Nonnull\n private final",
"original_string": "@Nonnull\n private final CancellableExecutor mMainThread;",
"type": "CancellableExecutor",
"var_name": "mMainThread"
},
{
"declarator": "mSuccessRunnable",
... | {
"body": "@Override\n public void onError(final int response, @Nonnull final Exception e) {\n mErrorRunnable = new Runnable() {\n @Override\n public void run() {\n mListener.onError(response, e);\n }\n };\n mMainThread.execute(mErrorRunnable);\n... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_19 | {
"fields": [
{
"declarator": "mSkus",
"modifier": "@Nonnull\n private",
"original_string": "@Nonnull\n private Skus mSkus;",
"type": "Skus",
"var_name": "mSkus"
}
],
"file": "lib/src/test/java/org/solovyev/android/checkout/SkusTest.java",
"identifier": "SkusTest",
... | {
"body": "@Test\n public void testShouldReturnSkuById() throws Exception {\n assertNotNull(mSkus.getSku(\"2\"));\n }",
"class_method_signature": "SkusTest.testShouldReturnSkuById()",
"constructor": false,
"full_signature": "@Test public void testShouldReturnSkuById()",
"identifier": "testShouldR... | {
"fields": [
{
"declarator": "BUNDLE_LIST = \"DETAILS_LIST\"",
"modifier": "@Nonnull\n static final",
"original_string": "@Nonnull\n static final String BUNDLE_LIST = \"DETAILS_LIST\";",
"type": "String",
"var_name": "BUNDLE_LIST"
},
{
"declarator": "product",
... | {
"body": "@Nullable\n public Sku getSku(@Nonnull String sku) {\n for (Sku s : list) {\n if (s.id.code.equals(sku)) {\n return s;\n }\n }\n return null;\n }",
"class_method_signature": "Skus.getSku(@Nonnull String sku)",
"constructor": false,
"full... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_58 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/BasePurchaseVerifierTest.java",
"identifier": "BasePurchaseVerifierTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testVerifierIsCalledOnBackgroundThreadFromMainThread() throws Exception {\n final ThreadAwareVerifier verifier = new ThreadAwareVerifier();\n final CountDownLatchRequestListener listener = new CountDownLatchRequestListener();\n\n verifier.verify(new ArrayList<Pur... | {
"fields": [
{
"declarator": "mBackground",
"modifier": "@Nonnull\n private final",
"original_string": "@Nonnull\n private final Executor mBackground;",
"type": "Executor",
"var_name": "mBackground"
},
{
"declarator": "mMainThread",
"modifier": "@Nonnull\n ... | {
"body": "@Override\n public final void verify(@Nonnull final List<Purchase> purchases, @Nonnull final RequestListener<List<Purchase>> listener) {\n if (MainThread.isMainThread()) {\n mBackground.execute(new Runnable() {\n @Override\n public void run() {\n ... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_23 | {
"fields": [
{
"declarator": "mSkus",
"modifier": "@Nonnull\n private",
"original_string": "@Nonnull\n private Skus mSkus;",
"type": "Skus",
"var_name": "mSkus"
}
],
"file": "lib/src/test/java/org/solovyev/android/checkout/SkusTest.java",
"identifier": "SkusTest",
... | {
"body": "@Test\n public void testShouldReadNullList() throws Exception {\n final Skus skus = Skus.fromBundle(new Bundle(), \"test\");\n assertTrue(skus.list.isEmpty());\n }",
"class_method_signature": "SkusTest.testShouldReadNullList()",
"constructor": false,
"full_signature": "@Test publi... | {
"fields": [
{
"declarator": "BUNDLE_LIST = \"DETAILS_LIST\"",
"modifier": "@Nonnull\n static final",
"original_string": "@Nonnull\n static final String BUNDLE_LIST = \"DETAILS_LIST\";",
"type": "String",
"var_name": "BUNDLE_LIST"
},
{
"declarator": "product",
... | {
"body": "@Nonnull\n static Skus fromBundle(@Nonnull Bundle bundle, @Nonnull String product) throws RequestException {\n final List<String> list = extractList(bundle);\n\n final List<Sku> skus = new ArrayList<>(list.size());\n for (String response : list) {\n try {\n ... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_35 | {
"fields": [
{
"declarator": "mCheckout",
"modifier": "@Nonnull\n private",
"original_string": "@Nonnull\n private Checkout mCheckout;",
"type": "Checkout",
"var_name": "mCheckout"
},
{
"declarator": "mDb",
"modifier": "@Nonnull\n private",
"origin... | {
"body": "@Test\n public void testShouldCreateValidInClause() throws Exception {\n assertEquals(\"(?)\", makeInClause(1));\n assertEquals(\"(?,?)\", makeInClause(2));\n assertEquals(\"(?,?,?)\", makeInClause(3));\n assertEquals(\"(?,?,?,?)\", makeInClause(4));\n\n try {\n ... | {
"fields": [
{
"declarator": "NAME = \"billing.db\"",
"modifier": "static final",
"original_string": "static final String NAME = \"billing.db\";",
"type": "String",
"var_name": "NAME"
},
{
"declarator": "mContext",
"modifier": "@Nonnull\n private final",
... | {
"body": "@Nonnull\n static String makeInClause(int count) {\n Check.isTrue(count > 0, \"Should be positive\");\n final StringBuilder sb = new StringBuilder(count * 2 + 1);\n sb.append(\"(\");\n sb.append(\"?\");\n for (int i = 1; i < count; i++) {\n sb.append(\",?\")... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_34 | {
"fields": [
{
"declarator": "mCheckout",
"modifier": "@Nonnull\n private",
"original_string": "@Nonnull\n private Checkout mCheckout;",
"type": "Checkout",
"var_name": "mCheckout"
},
{
"declarator": "mDb",
"modifier": "@Nonnull\n private",
"origin... | {
"body": "@Test\n public void testShouldReadEmptyList() throws Exception {\n final RobotmediaInventory inventory = new RobotmediaInventory(mCheckout, sameThreadExecutor(), sameThreadExecutor());\n final CountDownCallback l = new CountDownCallback();\n inventory.load(mRequest, l);\n\n f... | {
"fields": [
{
"declarator": "NAME = \"billing.db\"",
"modifier": "static final",
"original_string": "static final String NAME = \"billing.db\";",
"type": "String",
"var_name": "NAME"
},
{
"declarator": "mContext",
"modifier": "@Nonnull\n private final",
... | {
"body": "@Nonnull\n Inventory.Products load(@Nonnull Inventory.Request request) {\n SQLiteDatabase db = null;\n try {\n final String databasePath = RobotmediaDatabase.getDatabasePath(mContext);\n db = openDatabase(databasePath, null, OPEN_READONLY);\n return loadPro... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_22 | {
"fields": [
{
"declarator": "mSkus",
"modifier": "@Nonnull\n private",
"original_string": "@Nonnull\n private Skus mSkus;",
"type": "Skus",
"var_name": "mSkus"
}
],
"file": "lib/src/test/java/org/solovyev/android/checkout/SkusTest.java",
"identifier": "SkusTest",
... | {
"body": "@Test\n public void testShouldNotHaveSku() throws Exception {\n assertFalse(mSkus.hasSku(\"4\"));\n }",
"class_method_signature": "SkusTest.testShouldNotHaveSku()",
"constructor": false,
"full_signature": "@Test public void testShouldNotHaveSku()",
"identifier": "testShouldNotHaveSku",... | {
"fields": [
{
"declarator": "BUNDLE_LIST = \"DETAILS_LIST\"",
"modifier": "@Nonnull\n static final",
"original_string": "@Nonnull\n static final String BUNDLE_LIST = \"DETAILS_LIST\";",
"type": "String",
"var_name": "BUNDLE_LIST"
},
{
"declarator": "product",
... | {
"body": "public boolean hasSku(@Nonnull String sku) {\n return getSku(sku) != null;\n }",
"class_method_signature": "Skus.hasSku(@Nonnull String sku)",
"constructor": false,
"full_signature": "public boolean hasSku(@Nonnull String sku)",
"identifier": "hasSku",
"invocations": [
"getSku"
],... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_59 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/BasePurchaseVerifierTest.java",
"identifier": "BasePurchaseVerifierTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testVerifierIsCalledOnTheSameBackgroundThread() throws Exception {\n final ThreadAwareVerifier verifier = new ThreadAwareVerifier();\n final CountDownLatchRequestListener listener = new CountDownLatchRequestListener();\n\n new Thread(new Runnable() {\n ... | {
"fields": [
{
"declarator": "mBackground",
"modifier": "@Nonnull\n private final",
"original_string": "@Nonnull\n private final Executor mBackground;",
"type": "Executor",
"var_name": "mBackground"
},
{
"declarator": "mMainThread",
"modifier": "@Nonnull\n ... | {
"body": "@Override\n public final void verify(@Nonnull final List<Purchase> purchases, @Nonnull final RequestListener<List<Purchase>> listener) {\n if (MainThread.isMainThread()) {\n mBackground.execute(new Runnable() {\n @Override\n public void run() {\n ... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_18 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/GetSkuDetailsRequestTest.java",
"identifier": "GetSkuDetailsRequestTest",
"interfaces": "",
"superclass": "extends RequestTestBase"
} | {
"body": "@Test\n public void testShouldContainAllSkusInCacheKey() throws Exception {\n final GetSkuDetailsRequest request = new GetSkuDetailsRequest(\"test\", asList(\"1\", \"2\", \"3\"));\n\n assertEquals(\"test_[1,2,3]\", request.getCacheKey());\n }",
"class_method_signature": "GetSkuDetails... | {
"fields": [
{
"declarator": "MAX_SIZE_PER_REQUEST = 20",
"modifier": "private static final",
"original_string": "private static final int MAX_SIZE_PER_REQUEST = 20;",
"type": "int",
"var_name": "MAX_SIZE_PER_REQUEST"
},
{
"declarator": "mProduct",
"modifier": "@... | {
"body": "@Nullable\n @Override\n protected String getCacheKey() {\n if (mSkus.size() == 1) {\n return mProduct + \"_\" + mSkus.get(0);\n } else {\n final StringBuilder sb = new StringBuilder(5 * mSkus.size());\n sb.append(\"[\");\n for (int i = 0; i < ... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_38 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/MainThreadRequestListenerTest.java",
"identifier": "MainThreadRequestListenerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testShouldCancelSuccessRunnable() throws Exception {\n final RequestListener l = mock(RequestListener.class);\n final CancellableExecutor executor = new TestExecutor();\n final MainThreadRequestListener mtl = new MainThreadRequestListener(executor, l);\n\n ... | {
"fields": [
{
"declarator": "mMainThread",
"modifier": "@Nonnull\n private final",
"original_string": "@Nonnull\n private final CancellableExecutor mMainThread;",
"type": "CancellableExecutor",
"var_name": "mMainThread"
},
{
"declarator": "mSuccessRunnable",
... | {
"body": "@Override\n public void onSuccess(@Nonnull final R result) {\n mSuccessRunnable = new Runnable() {\n @Override\n public void run() {\n mListener.onSuccess(result);\n }\n };\n mMainThread.execute(mSuccessRunnable);\n }",
"class_met... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_55 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/ConcurrentCacheTest.java",
"identifier": "ConcurrentCacheTest",
"interfaces": "",
"superclass": "extends CacheTestBase"
} | {
"body": "@Test\n public void testShouldCallInit() throws Exception {\n final Cache mockCache = mock(Cache.class);\n final ConcurrentCache cache = new ConcurrentCache(mockCache);\n\n cache.init();\n\n verify(mockCache, times(1)).init();\n }",
"class_method_signature": "ConcurrentC... | {
"fields": [
{
"declarator": "TAG = \"Cache\"",
"modifier": "@Nonnull\n private static final",
"original_string": "@Nonnull\n private static final String TAG = \"Cache\";",
"type": "String",
"var_name": "TAG"
},
{
"declarator": "mCache",
"modifier": "@Guard... | {
"body": "@Override\n public void init() {\n if (mCache == null) {\n return;\n }\n synchronized (this) {\n Billing.debug(TAG, \"Initializing cache\");\n mCache.init();\n }\n }",
"class_method_signature": "ConcurrentCache.init()",
"constructor": f... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_3 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/PurchasesTest.java",
"identifier": "PurchasesTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testShouldReadNullList() throws Exception {\n final Bundle bundle = new Bundle();\n final Purchases purchases = Purchases.fromBundle(bundle, \"test\");\n assertTrue(purchases.list.isEmpty());\n }",
"class_method_signature": "PurchasesTest.testShouldReadNullL... | {
"fields": [
{
"declarator": "BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\"",
"modifier": "static final",
"original_string": "static final String BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\";",
"type": "String",
"var_name": "BUNDLE_DATA_LIST"
},
{
"declarator": "B... | {
"body": "@Nonnull\n static Purchases fromBundle(@Nonnull Bundle bundle, @Nonnull String product) throws JSONException {\n final String continuationToken = getContinuationTokenFromBundle(bundle);\n final List<Purchase> purchases = getListFromBundle(bundle);\n return new Purchases(product, pur... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_14 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/PurchasesTest.java",
"identifier": "PurchasesTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testShouldNeutralizeDanglingPurchases() throws Exception {\n List<Purchase> purchases = Purchases.neutralize(asList(newPurchase(\"test\", 1, EXPIRED),\n newPurchase(\"test\", 2, PURCHASED)));\n\n assertEquals(1, purchases.size());\n final Purchase ... | {
"fields": [
{
"declarator": "BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\"",
"modifier": "static final",
"original_string": "static final String BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\";",
"type": "String",
"var_name": "BUNDLE_DATA_LIST"
},
{
"declarator": "B... | {
"body": "@Nonnull\n static List<Purchase> neutralize(@Nonnull List<Purchase> purchases) {\n // probably, it's possible to avoid creation of temporary list. The reason for it is that we don't want to\n // modify original list\n purchases = new LinkedList<>(purchases);\n\n final List<Pu... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_43 | {
"fields": [
{
"declarator": "mListener",
"modifier": "@Nonnull\n private",
"original_string": "@Nonnull\n private RequestListener mListener;",
"type": "RequestListener",
"var_name": "mListener"
},
{
"declarator": "mFlow",
"modifier": "@Nonnull\n private... | {
"body": "@Test\n public void testShouldErrorIfResponseCodeItNotOk() throws Exception {\n mFlow.onActivityResult(1, RESULT_OK, newIntent(ResponseCodes.ACCOUNT_ERROR, null, null));\n\n verifyError(ResponseCodes.ACCOUNT_ERROR, BillingException.class);\n }",
"class_method_signature": "PurchaseFlow... | {
"fields": [
{
"declarator": "EXTRA_RESPONSE = \"RESPONSE_CODE\"",
"modifier": "static final",
"original_string": "static final String EXTRA_RESPONSE = \"RESPONSE_CODE\";",
"type": "String",
"var_name": "EXTRA_RESPONSE"
},
{
"declarator": "EXTRA_PURCHASE_DATA = \"INAPP... | {
"body": "void onActivityResult(int requestCode, int resultCode, Intent intent) {\n try {\n Check.equals(mRequestCode, requestCode);\n if (intent == null) {\n // sometimes intent is null (it's not obvious when it happens but it happens from time to time)\n h... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_48 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/SkuTest.java",
"identifier": "SkuTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testInAppSkuShouldBeCreatedFromJson() throws Exception {\n final Sku sku = Sku.fromJson(newInAppJson(\"1\"), ProductTypes.IN_APP);\n\n verifySku(sku, \"1\");\n }",
"class_method_signature": "SkuTest.testInAppSkuShouldBeCreatedFromJson()",
"constructor": false,
... | {
"fields": [
{
"declarator": "id",
"modifier": "@Nonnull\n public final",
"original_string": "@Nonnull\n public final Id id;",
"type": "Id",
"var_name": "id"
},
{
"declarator": "price",
"modifier": "@Nonnull\n public final",
"original_string": "@No... | {
"body": "@Nonnull\n static Sku fromJson(@Nonnull String json, @Nonnull String product) throws JSONException {\n return new Sku(json, product);\n }",
"class_method_signature": "Sku.fromJson(@Nonnull String json, @Nonnull String product)",
"constructor": false,
"full_signature": "@Nonnull static Sk... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_8 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/PurchasesTest.java",
"identifier": "PurchasesTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testShouldNotIncludeSignaturesInJson() throws Exception {\n final Purchases purchases = new Purchases(\"test\", asList(newPurchase(0), newPurchase(1), newPurchase(2)), null);\n\n final JSONObject json = purchases.toJsonObject(false);\n final JSONArray jsonArray =... | {
"fields": [
{
"declarator": "BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\"",
"modifier": "static final",
"original_string": "static final String BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\";",
"type": "String",
"var_name": "BUNDLE_DATA_LIST"
},
{
"declarator": "B... | {
"body": "@Nonnull\n JSONObject toJsonObject(boolean withSignatures) {\n final JSONObject json = new JSONObject();\n try {\n json.put(\"product\", product);\n final JSONArray array = new JSONArray();\n for (int i = 0; i < list.size(); i++) {\n final Pu... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_25 | {
"fields": [
{
"declarator": "mSkus",
"modifier": "@Nonnull\n private",
"original_string": "@Nonnull\n private Skus mSkus;",
"type": "Skus",
"var_name": "mSkus"
}
],
"file": "lib/src/test/java/org/solovyev/android/checkout/SkusTest.java",
"identifier": "SkusTest",
... | {
"body": "@Test\n public void testShouldHaveCorrectProduct() throws Exception {\n final Skus skus = Skus.fromBundle(new Bundle(), \"test\");\n assertEquals(\"test\", skus.product);\n }",
"class_method_signature": "SkusTest.testShouldHaveCorrectProduct()",
"constructor": false,
"full_signatu... | {
"fields": [
{
"declarator": "BUNDLE_LIST = \"DETAILS_LIST\"",
"modifier": "@Nonnull\n static final",
"original_string": "@Nonnull\n static final String BUNDLE_LIST = \"DETAILS_LIST\";",
"type": "String",
"var_name": "BUNDLE_LIST"
},
{
"declarator": "product",
... | {
"body": "@Nonnull\n static Skus fromBundle(@Nonnull Bundle bundle, @Nonnull String product) throws RequestException {\n final List<String> list = extractList(bundle);\n\n final List<Sku> skus = new ArrayList<>(list.size());\n for (String response : list) {\n try {\n ... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_33 | {
"fields": [
{
"declarator": "mCheckout",
"modifier": "@Nonnull\n private",
"original_string": "@Nonnull\n private Checkout mCheckout;",
"type": "Checkout",
"var_name": "mCheckout"
},
{
"declarator": "mDb",
"modifier": "@Nonnull\n private",
"origin... | {
"body": "@Test\n public void testShouldReadTransactions() throws Exception {\n mDb.insert(newTransaction(0));\n mDb.insert(newTransaction(1));\n mDb.insert(newTransaction(2));\n mDb.insert(newTransaction(3));\n mDb.insert(newTransaction(4));\n mDb.insert(newTransaction(5... | {
"fields": [
{
"declarator": "NAME = \"billing.db\"",
"modifier": "static final",
"original_string": "static final String NAME = \"billing.db\";",
"type": "String",
"var_name": "NAME"
},
{
"declarator": "mContext",
"modifier": "@Nonnull\n private final",
... | {
"body": "@Nonnull\n Inventory.Products load(@Nonnull Inventory.Request request) {\n SQLiteDatabase db = null;\n try {\n final String databasePath = RobotmediaDatabase.getDatabasePath(mContext);\n db = openDatabase(databasePath, null, OPEN_READONLY);\n return loadPro... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_44 | {
"fields": [
{
"declarator": "mListener",
"modifier": "@Nonnull\n private",
"original_string": "@Nonnull\n private RequestListener mListener;",
"type": "RequestListener",
"var_name": "mListener"
},
{
"declarator": "mFlow",
"modifier": "@Nonnull\n private... | {
"body": "@Test\n public void testShouldErrorWithNoData() throws Exception {\n mFlow.onActivityResult(1, RESULT_OK, newIntent(OK, null, \"signature\"));\n\n verifyError(ResponseCodes.EXCEPTION, RuntimeException.class);\n }",
"class_method_signature": "PurchaseFlowTest.testShouldErrorWithNoData(... | {
"fields": [
{
"declarator": "EXTRA_RESPONSE = \"RESPONSE_CODE\"",
"modifier": "static final",
"original_string": "static final String EXTRA_RESPONSE = \"RESPONSE_CODE\";",
"type": "String",
"var_name": "EXTRA_RESPONSE"
},
{
"declarator": "EXTRA_PURCHASE_DATA = \"INAPP... | {
"body": "void onActivityResult(int requestCode, int resultCode, Intent intent) {\n try {\n Check.equals(mRequestCode, requestCode);\n if (intent == null) {\n // sometimes intent is null (it's not obvious when it happens but it happens from time to time)\n h... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_4 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/PurchasesTest.java",
"identifier": "PurchasesTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testShouldReadList() throws Exception {\n final Purchases purchases = Purchases.fromBundle(prepareBundle(), \"test\");\n\n assertEquals(3, purchases.list.size());\n verifyPurchase(purchases.list.get(0), 1, Purchase.State.REFUNDED);\n verifyPurchase(purchas... | {
"fields": [
{
"declarator": "BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\"",
"modifier": "static final",
"original_string": "static final String BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\";",
"type": "String",
"var_name": "BUNDLE_DATA_LIST"
},
{
"declarator": "B... | {
"body": "@Nonnull\n static Purchases fromBundle(@Nonnull Bundle bundle, @Nonnull String product) throws JSONException {\n final String continuationToken = getContinuationTokenFromBundle(bundle);\n final List<Purchase> purchases = getListFromBundle(bundle);\n return new Purchases(product, pur... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_13 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/PurchasesTest.java",
"identifier": "PurchasesTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testShouldRemovePurchaseDuplicates() throws Exception {\n List<Purchase> purchases = Purchases.neutralize(asList(newPurchase(\"test\", 1, PURCHASED),\n newPurchase(\"test\", 2, PURCHASED),\n newPurchase(\"test\", 3, PURCHASED)));\n\n assert... | {
"fields": [
{
"declarator": "BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\"",
"modifier": "static final",
"original_string": "static final String BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\";",
"type": "String",
"var_name": "BUNDLE_DATA_LIST"
},
{
"declarator": "B... | {
"body": "@Nonnull\n static List<Purchase> neutralize(@Nonnull List<Purchase> purchases) {\n // probably, it's possible to avoid creation of temporary list. The reason for it is that we don't want to\n // modify original list\n purchases = new LinkedList<>(purchases);\n\n final List<Pu... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_52 | {
"fields": [
{
"declarator": "mVerifier",
"modifier": "@Nonnull\n private",
"original_string": "@Nonnull\n private DefaultPurchaseVerifier mVerifier;",
"type": "DefaultPurchaseVerifier",
"var_name": "mVerifier"
}
],
"file": "lib/src/test/java/org/solovyev/android/check... | {
"body": "@SuppressWarnings(\"unchecked\")\n @Test\n public void testShouldAutoVerifyTestPurchases() throws Exception {\n final List<Purchase> testPurchases = new ArrayList<>();\n for (String sku : DefaultPurchaseVerifier.TEST_SKUS) {\n testPurchases.add(new Purchase(sku, \"\", \"\", 0... | {
"fields": [
{
"declarator": "TEST_SKUS = new HashSet<>(Arrays.asList(\n \"android.test.purchased\",\n \"android.test.canceled\",\n \"android.test.refunded\",\n \"android.test.item_unavailable\"\n ))",
"modifier": "static final",
"original_string":... | {
"body": "@Override\n public void verify(@Nonnull List<Purchase> purchases, @Nonnull RequestListener<List<Purchase>> listener) {\n final List<Purchase> verifiedPurchases = new ArrayList<Purchase>(purchases.size());\n for (Purchase purchase : purchases) {\n // test purchases don't contain ... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_29 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/BillingSupportedRequestTest.java",
"identifier": "BillingSupportedRequestTest",
"interfaces": "",
"superclass": "extends RequestTestBase"
} | {
"body": "@Test\n public void testShouldUseExtraParams() throws Exception {\n final Bundle extraParams = new Bundle();\n extraParams.putString(\"extra\", \"test\");\n final BillingSupportedRequest request = new BillingSupportedRequest(\"product\", Billing.V7, extraParams);\n final IInA... | {
"fields": [
{
"declarator": "mProduct",
"modifier": "@Nonnull\n private final",
"original_string": "@Nonnull\n private final String mProduct;",
"type": "String",
"var_name": "mProduct"
},
{
"declarator": "mExtraParams",
"modifier": "@Nullable\n private ... | {
"body": "@Override\n public void start(@Nonnull IInAppBillingService service, @Nonnull String packageName) throws RemoteException {\n final int response = mExtraParams != null ? service.isBillingSupportedExtraParams(mApiVersion, packageName, mProduct, mExtraParams) : service.isBillingSupported(mApiVersion... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_28 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/BillingSupportedRequestTest.java",
"identifier": "BillingSupportedRequestTest",
"interfaces": "",
"superclass": "extends RequestTestBase"
} | {
"body": "@Test\n public void testShouldNotBeCachedWithExtraParams() throws Exception {\n final BillingSupportedRequest request = new BillingSupportedRequest(\"test\", Billing.V7, new Bundle());\n assertNull(request.getCacheKey());\n }",
"class_method_signature": "BillingSupportedRequestTest.te... | {
"fields": [
{
"declarator": "mProduct",
"modifier": "@Nonnull\n private final",
"original_string": "@Nonnull\n private final String mProduct;",
"type": "String",
"var_name": "mProduct"
},
{
"declarator": "mExtraParams",
"modifier": "@Nullable\n private ... | {
"body": "@Nullable\n @Override\n protected String getCacheKey() {\n if (mExtraParams != null) {\n // disable cache if there are any extra parameters\n return null;\n }\n if (mApiVersion == Billing.V3) {\n return mProduct;\n }\n return mProduc... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_53 | {
"fields": [
{
"declarator": "mVerifier",
"modifier": "@Nonnull\n private",
"original_string": "@Nonnull\n private DefaultPurchaseVerifier mVerifier;",
"type": "DefaultPurchaseVerifier",
"var_name": "mVerifier"
}
],
"file": "lib/src/test/java/org/solovyev/android/check... | {
"body": "@SuppressWarnings(\"unchecked\")\n @Test\n public void testShouldNotAutoVerifyRealPurchases() throws Exception {\n final List<Purchase> purchases = Collections.singletonList(\n new Purchase(\"android.test.boom\", \"\", \"\", 0, 0, \"\", \"\", false, \"\", \"\"));\n final ... | {
"fields": [
{
"declarator": "TEST_SKUS = new HashSet<>(Arrays.asList(\n \"android.test.purchased\",\n \"android.test.canceled\",\n \"android.test.refunded\",\n \"android.test.item_unavailable\"\n ))",
"modifier": "static final",
"original_string":... | {
"body": "@Override\n public void verify(@Nonnull List<Purchase> purchases, @Nonnull RequestListener<List<Purchase>> listener) {\n final List<Purchase> verifiedPurchases = new ArrayList<Purchase>(purchases.size());\n for (Purchase purchase : purchases) {\n // test purchases don't contain ... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_5 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/PurchasesTest.java",
"identifier": "PurchasesTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testShouldReadListWithSignatures() throws Exception {\n final Bundle bundle = prepareBundle();\n final ArrayList<String> signatures = new ArrayList<String>();\n signatures.add(\"sig_1\");\n signatures.add(\"sig_2\");\n signatures.add(\"sig_3\");\n ... | {
"fields": [
{
"declarator": "BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\"",
"modifier": "static final",
"original_string": "static final String BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\";",
"type": "String",
"var_name": "BUNDLE_DATA_LIST"
},
{
"declarator": "B... | {
"body": "@Nonnull\n static Purchases fromBundle(@Nonnull Bundle bundle, @Nonnull String product) throws JSONException {\n final String continuationToken = getContinuationTokenFromBundle(bundle);\n final List<Purchase> purchases = getListFromBundle(bundle);\n return new Purchases(product, pur... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_12 | {
"fields": [],
"file": "lib/src/test/java/org/solovyev/android/checkout/PurchasesTest.java",
"identifier": "PurchasesTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testShouldNotNeutralizePurchasesWithDifferentSkus() throws Exception {\n List<Purchase> purchases = Purchases.neutralize(asList(newPurchase(\"0\", 100, PURCHASED),\n newPurchase(\"1\", 120, CANCELLED),\n newPurchase(\"2\", 122, EXPIRED),\n ... | {
"fields": [
{
"declarator": "BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\"",
"modifier": "static final",
"original_string": "static final String BUNDLE_DATA_LIST = \"INAPP_PURCHASE_DATA_LIST\";",
"type": "String",
"var_name": "BUNDLE_DATA_LIST"
},
{
"declarator": "B... | {
"body": "@Nonnull\n static List<Purchase> neutralize(@Nonnull List<Purchase> purchases) {\n // probably, it's possible to avoid creation of temporary list. The reason for it is that we don't want to\n // modify original list\n purchases = new LinkedList<>(purchases);\n\n final List<Pu... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_45 | {
"fields": [
{
"declarator": "mListener",
"modifier": "@Nonnull\n private",
"original_string": "@Nonnull\n private RequestListener mListener;",
"type": "RequestListener",
"var_name": "mListener"
},
{
"declarator": "mFlow",
"modifier": "@Nonnull\n private... | {
"body": "@Test\n public void testShouldErrorWithNoSignature() throws Exception {\n mFlow.onActivityResult(1, RESULT_OK, newIntent(OK, \"data\", null));\n\n verifyError(ResponseCodes.EXCEPTION, RuntimeException.class);\n }",
"class_method_signature": "PurchaseFlowTest.testShouldErrorWithNoSigna... | {
"fields": [
{
"declarator": "EXTRA_RESPONSE = \"RESPONSE_CODE\"",
"modifier": "static final",
"original_string": "static final String EXTRA_RESPONSE = \"RESPONSE_CODE\";",
"type": "String",
"var_name": "EXTRA_RESPONSE"
},
{
"declarator": "EXTRA_PURCHASE_DATA = \"INAPP... | {
"body": "void onActivityResult(int requestCode, int resultCode, Intent intent) {\n try {\n Check.equals(mRequestCode, requestCode);\n if (intent == null) {\n // sometimes intent is null (it's not obvious when it happens but it happens from time to time)\n h... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
22337952_32 | {
"fields": [
{
"declarator": "mCheckout",
"modifier": "@Nonnull\n private",
"original_string": "@Nonnull\n private Checkout mCheckout;",
"type": "Checkout",
"var_name": "mCheckout"
},
{
"declarator": "mDb",
"modifier": "@Nonnull\n private",
"origin... | {
"body": "@Test\n public void testShouldCreateEmptyProductsIfError() throws Exception {\n mDb.close();\n RuntimeEnvironment.application.deleteDatabase(RobotmediaDatabase.NAME);\n\n final RobotmediaInventory inventory = new RobotmediaInventory(mCheckout, sameThreadExecutor(), sameThreadExecuto... | {
"fields": [
{
"declarator": "NAME = \"billing.db\"",
"modifier": "static final",
"original_string": "static final String NAME = \"billing.db\";",
"type": "String",
"var_name": "NAME"
},
{
"declarator": "mContext",
"modifier": "@Nonnull\n private final",
... | {
"body": "@Nonnull\n Inventory.Products load(@Nonnull Inventory.Request request) {\n SQLiteDatabase db = null;\n try {\n final String databasePath = RobotmediaDatabase.getDatabasePath(mContext);\n db = openDatabase(databasePath, null, OPEN_READONLY);\n return loadPro... | {
"created": null,
"fork": null,
"fork_count": 161,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 22337952,
"size": 2110,
"stargazer_count": 985,
"stars": null,
"updates": null,
"url": "https://github.com/serso/android-checkout"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.