Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def builtin_compliant():
1 < int("1")
4 > 3
float(4) < 4
d1 = dict()
d2 = dict()
r = d1 | d2


def custom_noncompliant():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,8 @@ def data(self):
...
def f(self):
self.data[1] # OK

def python3_9():
from asyncio import Future
class A(Future[TSource]): ...

Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ public static Map<String, Symbol> builtinSymbols() {
if (TypeShed.builtins == null && !InferredTypes.isInitialized()) {
Map<String, Symbol> builtins = new HashMap<>();
builtins.put(NONE_TYPE, new ClassSymbolImpl(NONE_TYPE, NONE_TYPE));
InputStream resource = TypeShed.class.getResourceAsStream("typeshed/stdlib/2and3/builtins.pyi");
// 2and3/builtins.pyi has been split into 2/builtins.pyi and 3/builtins.pyi
// for the time being sonar-python still relies on a copied version of '2and3/builtins.pyi'
// (https://github.com/python/typeshed/blob/b0f4900c9fbf5092ee40936f0b831641d6f49e03/stdlib/2and3/builtins.pyi)
// TODO: change logic to automatically merge 2/builtins.pyi and 3/builtins.pyi
InputStream resource = TypeShed.class.getResourceAsStream("builtins.pyi");
PythonFile file = new TypeShedPythonFile(resource, "");
AstNode astNode = PythonParser.create().parse(file.content());
FileInput fileInput = new PythonTreeMaker().fileInput(astNode);
Expand Down
Loading