Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typing to filepath #4980

Merged
merged 21 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' of https://github.com/PyCQA/pylint into pyannotat…
…e-pylint
  • Loading branch information
DanielNoord committed Sep 15, 2021
commit 48592881f08b9901c67ad3bc8e0bb8f31359b7e6
7 changes: 5 additions & 2 deletions pylint/lint/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@

import collections
import functools
from typing import Any, DefaultDict, Iterable, List, Tuple
from typing import Any, DefaultDict, Iterable, List, Tuple, TYPE_CHECKING, Dict, Union

from pylint import reporters
from pylint.lint.utils import _patch_sys_path
from pylint.message import Message
from pylint.typing import FileItem
from pylint.typing import CheckerStats, FileItem

if TYPE_CHECKING:
from typing import Counter # typing.Counter added in Python 3.6.1

try:
import multiprocessing
Expand Down
2 changes: 1 addition & 1 deletion pylint/lint/pylinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
)
from pylint.message import MessageDefinitionStore, MessagesHandlerMixIn
from pylint.reporters.ureports import nodes as report_nodes
from pylint.typing import FileItem, ModuleDescriptionDict
from pylint.typing import FileItem, ModuleDescriptionDict, CheckerStats
from pylint.utils import ASTWalker, FileState, utils
from pylint.utils.pragma_parser import (
OPTION_PO,
Expand Down
2 changes: 1 addition & 1 deletion pylint/reporters/multi_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


import os
from typing import IO, Any, AnyStr, Callable, List, Mapping, Optional
from typing import IO, Any, AnyStr, Callable, List, Optional

from pylint.interfaces import IReporter
from pylint.message import Message
Expand Down
11 changes: 10 additions & 1 deletion pylint/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

"""A collection of typing utilities."""
import sys
from typing import NamedTuple, Union
from typing import NamedTuple, Union, TYPE_CHECKING, Dict, List

if TYPE_CHECKING:
from typing import Counter # typing.Counter added in Python 3.6.1

if sys.version_info >= (3, 8):
from typing import Literal, TypedDict
Expand Down Expand Up @@ -35,3 +38,9 @@ class ErrorDescriptionDict(TypedDict):
key: Literal["fatal"]
mod: str
ex: Union[ImportError, SyntaxError]


# The base type of the "stats" attribute of a checker
CheckerStats = Dict[
str, Union[int, "Counter[str]", List, Dict[str, Union[int, str, Dict[str, int]]]]
]
2 changes: 1 addition & 1 deletion tests/test_check_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from pylint.lint.parallel import _worker_initialize as worker_initialize
from pylint.lint.parallel import check_parallel
from pylint.testutils import GenericTestReporter as Reporter
from pylint.typing import FileItem
from pylint.typing import FileItem, CheckerStats


def _gen_file_data(idx: int = 0) -> FileItem:
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.