We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fc5e8ec commit 6b13fc6Copy full SHA for 6b13fc6
3 files changed
python/ql/test/3/extractor-tests/unpacking-comprehensions/test.expected
@@ -0,0 +1,4 @@
1
+| 3 | ListComp |
2
+| 5 | SetComp |
3
+| 7 | DictComp |
4
+| 9 | GeneratorExp |
python/ql/test/3/extractor-tests/unpacking-comprehensions/test.py
@@ -0,0 +1,12 @@
+# PEP 798: Unpacking in comprehensions
+
+flat_list = [*x for x in nested]
5
+flat_set = {*x for x in nested}
6
7
+merged = {**d for d in dicts}
8
9
+gen = (*x for x in nested)
10
11
+# Force the new parser (the old parser cannot handle lazy imports)
12
+lazy import _pep798_parser_hint
python/ql/test/3/extractor-tests/unpacking-comprehensions/test.ql
+import python
+from Expr e
+where
+ e.getLocation().getFile().getShortName() = "test.py" and
+ (
+ e instanceof ListComp or
+ e instanceof SetComp or
+ e instanceof DictComp or
+ e instanceof GeneratorExp
+ )
+select e.getLocation().getStartLine(), e.toString()
0 commit comments