FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Python: Allow trailing commas in type parameter lists by jketema · Pull Request #22743 · github/codeql · GitHub

Repository navigation

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

Filter by extension

Filter by extension .c  (1) .expected  (1) .js  (1) .json  (1) .py  (2) All 5 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion python/extractor/semmle/util.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#Semantic version of extractor.
#Update this if any changes are made
VERSION = "7.2.0"
VERSION = "7.2.1"

PY_EXTENSIONS = ".py", ".pyw"

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Module: [1, 0] - [12, 0]
body: [
TypeAlias: [1, 0] - [3, 5]
name:
Name: [1, 5] - [1, 10]
variable: Variable('Alias', None)
ctx: Store
type_parameters: [
TypeVar: [2, 4] - [2, 5]
name:
Name: [2, 4] - [2, 5]
variable: Variable('T', None)
ctx: Store
bound: None
default: None
]
value:
Name: [3, 4] - [3, 5]
variable: Variable('T', None)
ctx: Load
Assign: [5, 0] - [7, 4]
targets: [
Name: [5, 4] - [5, 12]
variable: Variable('function', None)
ctx: Store
]
value:
FunctionExpr: [5, 0] - [7, 4]
name: 'function'
args:
arguments
defaults: []
kw_defaults: []
annotations: []
varargannotation: None
kwargannotation: None
kw_annotations: []
returns: None
inner_scope:
Function: [5, 0] - [7, 4]
name: 'function'
type_parameters: [
TypeVar: [6, 4] - [6, 5]
name:
Name: [6, 4] - [6, 5]
variable: Variable('T', None)
ctx: Store
bound: None
default: None
]
args: []
vararg: None
kwonlyargs: []
kwarg: None
body: [
Expr: [7, 5] - [7, 8]
value:
Ellipsis: [7, 5] - [7, 8]
]
Assign: [9, 0] - [11, 2]
targets: [
Name: [9, 6] - [9, 11]
variable: Variable('Class', None)
ctx: Store
]
value:
ClassExpr: [9, 0] - [11, 2]
name: 'Class'
type_parameters: [
TypeVar: [10, 4] - [10, 5]
name:
Name: [10, 4] - [10, 5]
variable: Variable('T', None)
ctx: Store
bound: None
default: None
]
bases: []
keywords: []
inner_scope:
Class: [9, 0] - [11, 2]
name: 'Class'
body: [
Expr: [11, 3] - [11, 6]
value:
Ellipsis: [11, 3] - [11, 6]
]
]
11 changes: 11 additions & 0 deletions python/extractor/tests/parser/type_parameters_new.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
type Alias[
T,
] = T

def function[
T,
](): ...

class Class[
T,
]: ...
1 change: 1 addition & 0 deletions python/extractor/tsg-python/tsp/grammar.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ module.exports = grammar({
type_parameters: $ => seq(
'[',
commaSep1(field('type_parameter', $._type_parameter)),
optional(','),
Comment thread
jketema marked this conversation as resolved.
']'
),

Expand Down
12 changes: 12 additions & 0 deletions python/extractor/tsg-python/tsp/src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading

Back | FazBrowse Home | New Git URL