mirror of
https://github.com/github/codeql.git
synced 2026-05-03 12:45:27 +02:00
Python: Better API for parameters.
This commit is contained in:
@@ -18,9 +18,7 @@
|
||||
| a_simple.py:11 | Global Variable C | ControlFlowNode for C | definition |
|
||||
| a_simple.py:14 | Global Variable vararg_kwarg | ControlFlowNode for vararg_kwarg | definition |
|
||||
| a_simple.py:14 | Local Variable d | ControlFlowNode for d | definition |
|
||||
| a_simple.py:14 | Local Variable d | Entry node for Function vararg_kwarg | definition |
|
||||
| a_simple.py:14 | Local Variable t | ControlFlowNode for t | definition |
|
||||
| a_simple.py:14 | Local Variable t | Entry node for Function vararg_kwarg | definition |
|
||||
| a_simple.py:18 | Global Variable multi_loop | ControlFlowNode for multi_loop | definition |
|
||||
| a_simple.py:18 | Local Variable seq | ControlFlowNode for seq | definition |
|
||||
| a_simple.py:18 | Local Variable x | Entry node for Function multi_loop | definition |
|
||||
@@ -40,9 +38,7 @@
|
||||
| a_simple.py:29 | Local Variable q | ControlFlowNode for q | definition |
|
||||
| a_simple.py:34 | Global Variable f | ControlFlowNode for f | definition |
|
||||
| a_simple.py:34 | Local Variable args | ControlFlowNode for args | definition |
|
||||
| a_simple.py:34 | Local Variable args | Entry node for Function f | definition |
|
||||
| a_simple.py:34 | Local Variable kwargs | ControlFlowNode for kwargs | definition |
|
||||
| a_simple.py:34 | Local Variable kwargs | Entry node for Function f | definition |
|
||||
| a_simple.py:38 | Global Variable multi_assign_and_packing | ControlFlowNode for multi_assign_and_packing | definition |
|
||||
| a_simple.py:38 | Local Variable a | ControlFlowNode for a | definition |
|
||||
| a_simple.py:38 | Local Variable b | ControlFlowNode for b | definition |
|
||||
@@ -142,7 +138,6 @@
|
||||
| b_condition.py:99 | Local Variable x | ControlFlowNode for use() | refinement |
|
||||
| b_condition.py:101 | Global Variable not_or_not | ControlFlowNode for not_or_not | definition |
|
||||
| b_condition.py:101 | Local Variable a | ControlFlowNode for a | definition |
|
||||
| b_condition.py:101 | Local Variable a | Entry node for Function not_or_not | definition |
|
||||
| b_condition.py:109 | Global Variable method_check | ControlFlowNode for method_check | definition |
|
||||
| b_condition.py:109 | Local Variable x | ControlFlowNode for x | definition |
|
||||
| b_condition.py:111 | Local Variable x | ControlFlowNode for use() | refinement |
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
| args | test.py:5:13:5:22 | Subscript |
|
||||
| b | test.py:2:12:2:14 | str |
|
||||
| d | test.py:2:27:2:29 | int |
|
||||
| kwargs | test.py:5:34:5:47 | Subscript |
|
||||
6
python/ql/test/library-tests/parameters/Annotations.ql
Normal file
6
python/ql/test/library-tests/parameters/Annotations.ql
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
import python
|
||||
|
||||
|
||||
from Parameter p
|
||||
select p.getName(), p.getAnnotation()
|
||||
@@ -0,0 +1,2 @@
|
||||
| c | test.py:2:19:2:22 | None |
|
||||
| d | test.py:2:31:2:34 | True |
|
||||
6
python/ql/test/library-tests/parameters/Defaults.ql
Normal file
6
python/ql/test/library-tests/parameters/Defaults.ql
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
import python
|
||||
|
||||
|
||||
from Parameter p
|
||||
select p.getName(), p.getDefault()
|
||||
6
python/ql/test/library-tests/parameters/Special.expected
Normal file
6
python/ql/test/library-tests/parameters/Special.expected
Normal file
@@ -0,0 +1,6 @@
|
||||
| a | normal |
|
||||
| args | varargs |
|
||||
| b | normal |
|
||||
| c | normal |
|
||||
| d | normal |
|
||||
| kwargs | kwargs |
|
||||
13
python/ql/test/library-tests/parameters/Special.ql
Normal file
13
python/ql/test/library-tests/parameters/Special.ql
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
import python
|
||||
|
||||
from Parameter p, string type
|
||||
where
|
||||
p.isKwargs() and type = "kwargs"
|
||||
or
|
||||
p.isVarargs() and type = "varargs"
|
||||
or
|
||||
not p.isKwargs() and not p.isVarargs() and type = "normal"
|
||||
|
||||
select p.getName(), type
|
||||
6
python/ql/test/library-tests/parameters/test.py
Normal file
6
python/ql/test/library-tests/parameters/test.py
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
def f(a, b:str, c=None, d:int=True):
|
||||
pass
|
||||
|
||||
def g(*args:Tuple[int], **kwargs:Dict[str, int]):
|
||||
pass
|
||||
Reference in New Issue
Block a user