Debian Codegraph @

test/completion/isinstance.py

raw symbols SCIP
1 if isinstance(i, str):
2 #? str()
3 i
4
5 if isinstance(j, (str, int)):
6 #? str() int()
7 j
8
9 while isinstance(k, (str, int)):
10 #? str() int()
11 k
12
13 if not isinstance(k, (str, int)):
14 #?
15 k
16
17 while not isinstance(k, (str, int)):
18 #?
19 k
20
21 assert isinstance(ass, int)
22 #? int()
23 ass
24
25 assert isinstance(ass, str)
26 assert not isinstance(ass, int)
27
28 if 2:
29 #? str()
30 ass
31
32 # -----------------
33 # invalid arguments
34 # -----------------
35
36 if isinstance(wrong, str()):
37 #?
38 wrong
39
40 # -----------------
41 # in functions
42 # -----------------
43
44 import datetime
45
46
47 def fooooo(obj):
48 if isinstance(obj, datetime.datetime):
49 #? datetime.datetime()
50 obj
51
52
53 def fooooo2(obj):
54 if isinstance(obj, datetime.date):
55 return obj
56 else:
57 return 1
58
59 a
60 # In earlier versions of Jedi, this returned both datetime and int, but now
61 # Jedi does flow checks and realizes that the top return isn't executed.
62 #? int()
63 fooooo2('')
64
65
66 def isinstance_func(arr):
67 for value in arr:
68 if isinstance(value, dict):
69 # Shouldn't fail, even with the dot.
70 #? 17 dict()
71 value.
72 elif isinstance(value, int):
73 x = value
74 #? int()
75 x
76
77 # -----------------
78 # Names with multiple indices.
79 # -----------------
80
81 class Test():
82 def __init__(self, testing):
83 if isinstance(testing, str):
84 self.testing = testing
85 else:
86 self.testing = 10
87
88 def boo(self):
89 if isinstance(self.testing, str):
90 # TODO this is wrong, it should only be str.
91 #? str() int()
92 self.testing
93 #? Test()
94 self
95
96 # -----------------
97 # Syntax
98 # -----------------
99
100 #?
101 isinstance(1, int())
102
103 # -----------------
104 # more complicated arguments
105 # -----------------
106
107 def ayyyyyye(obj):
108 if isinstance(obj.obj, str):
109 #?
110 obj.obj
111 #?
112 obj