File tree Expand file tree Collapse file tree 1 file changed +22
-18
lines changed Expand file tree Collapse file tree 1 file changed +22
-18
lines changed Original file line number Diff line number Diff line change 7
7
from __future__ import annotations
8
8
9
9
import json
10
+ import sys
10
11
from typing import TYPE_CHECKING , Any , Optional
11
12
12
13
from pylint .interfaces import UNDEFINED
13
14
from pylint .message import Message
14
15
from pylint .reporters .base_reporter import BaseReporter
15
16
from pylint .typing import MessageLocationTuple
16
17
17
- if TYPE_CHECKING :
18
+ if sys . version_info >= ( 3 , 8 ) :
18
19
from typing import TypedDict
20
+ else :
21
+ from typing_extensions import TypedDict
19
22
23
+ if TYPE_CHECKING :
20
24
from pylint .lint .pylinter import PyLinter
21
25
from pylint .reporters .ureports .nodes import Section
22
26
23
- OldJsonExport = TypedDict (
24
- "OldJsonExport" ,
25
- {
26
- "type" : str ,
27
- "module " : str ,
28
- "obj " : str ,
29
- "line " : int ,
30
- "column " : int ,
31
- "endLine " : Optional [ int ] ,
32
- "endColumn " : Optional [int ],
33
- "path " : str ,
34
- "symbol " : str ,
35
- "message " : str ,
36
- # "message-id" is not a valid name, so we have to define the TypedDict like this
37
- "message-id" : str ,
38
- },
39
- )
27
+ # Since message-id is an invalid name we need to use the alternative syntax
28
+ OldJsonExport = TypedDict (
29
+ "OldJsonExport" ,
30
+ {
31
+ "type " : str ,
32
+ "module " : str ,
33
+ "obj " : str ,
34
+ "line " : int ,
35
+ "column " : int ,
36
+ "endLine " : Optional [int ],
37
+ "endColumn " : Optional [ int ] ,
38
+ "path " : str ,
39
+ "symbol " : str ,
40
+ "message" : str ,
41
+ "message-id" : str ,
42
+ },
43
+ )
40
44
41
45
42
46
class BaseJSONReporter (BaseReporter ):
You can’t perform that action at this time.
0 commit comments