mirror of
https://github.com/github/codeql.git
synced 2026-05-05 13:45:19 +02:00
Python: Better API for parameters.
This commit is contained in:
@@ -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