blob: 84c49df5582ce61337e68487d724aa3d8e8a723e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
"""A collection of typing utilities."""
import sys
from typing import NamedTuple, Optional, Union
if sys.version_info >= (3, 8):
from typing import Literal, TypedDict
else:
from typing_extensions import Literal, TypedDict
class FileItem(NamedTuple):
"""Represents data about a file handled by pylint.
Each file item has:
- name: full name of the module
- filepath: path of the file
- modname: module name
"""
name: str
filepath: str
modpath: str
class ModuleDescriptionDict(TypedDict):
"""Represents data about a checked module."""
path: str
name: str
isarg: bool
basepath: str
basename: str
class ErrorDescriptionDict(TypedDict):
"""Represents data about errors collected during checking of a module."""
key: Literal["fatal"]
mod: str
ex: Union[ImportError, SyntaxError]
class MessageLocationTuple(NamedTuple):
"""Tuple with information about the location of a to-be-displayed message."""
abspath: str
path: str
module: str
obj: str
line: int
column: int
end_line: Optional[int] = None
end_column: Optional[int] = None
class ManagedMessage(NamedTuple):
"""Tuple with information about a managed message of the linter."""
name: Optional[str]
msgid: str
symbol: str
line: Optional[int]
is_disabled: bool
MessageTypesFullName = Literal[
"convention", "error", "fatal", "info", "refactor", "statement", "warning"
]
"""All possible message categories."""
|