third_party.pylibs.pylint.src/pylint/typing.py
Daniël van Noord 16c09cb48a
Refactor `LinterStats` (#5074)
* Refactor ``self.stats`` on linter and checker
This adds a new class ``LinterStats`` which is used to store all
kinds of stats during a run of ``pylint``. Tests have been changed
slightly to be able to use the new class.

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2021-10-07 09:40:31 +02:00

55 lines
1.2 KiB
Python

# 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, 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