Mark stub-only private symbols as @type_check_only in third-party stubs (#14545)

This commit is contained in:
Brian Schubert
2025-08-08 11:29:48 +02:00
committed by GitHub
parent a358dc24e8
commit 81c8fcb2e6
131 changed files with 334 additions and 147 deletions
+2 -1
View File
@@ -1,12 +1,13 @@
import datetime
from collections.abc import Iterable
from decimal import Decimal
from typing import TypedDict
from typing import TypedDict, type_check_only
from .feedback import _Feedback
from .matching import _Match
from .time_estimates import _TimeEstimate
@type_check_only
class _Result(_TimeEstimate, TypedDict):
password: str
guesses: Decimal
+2 -1
View File
@@ -1,8 +1,9 @@
from collections.abc import Sequence
from typing import Literal, TypedDict
from typing import Literal, TypedDict, type_check_only
from .matching import _Match
@type_check_only
class _Feedback(TypedDict):
warning: str
suggestions: list[str]
+4 -2
View File
@@ -1,11 +1,12 @@
from collections.abc import Iterable, Mapping
from decimal import Decimal
from re import Pattern
from typing import Any, Literal, TypedDict
from typing import Any, Literal, TypedDict, type_check_only
from typing_extensions import NotRequired
from .adjacency_graphs import _Graph
@type_check_only
class _Match(TypedDict):
pattern: Literal["dictionary", "spatial", "repeat", "sequence", "regex", "date"]
token: str
@@ -80,11 +81,12 @@ def regex_match(
password: str, _regexen: dict[str, Pattern[str]] = ..., _ranked_dictionaries: dict[str, dict[str, int]] = ...
) -> list[_Match]: ...
def date_match(password: str, _ranked_dictionaries: dict[str, dict[str, int]] = ...) -> list[_Match]: ...
@type_check_only
class _DM(TypedDict):
month: int
day: int
@type_check_only
class _DMY(TypedDict):
year: int
month: int
+2 -1
View File
@@ -1,7 +1,7 @@
from collections.abc import Iterable
from decimal import Decimal
from re import Pattern
from typing import TypedDict
from typing import TypedDict, type_check_only
from .adjacency_graphs import _Graph
from .matching import _Match
@@ -15,6 +15,7 @@ MIN_SUBMATCH_GUESSES_MULTI_CHAR: int
MIN_YEAR_SPACE: int
REFERENCE_YEAR: int
@type_check_only
class _GuessesResult(TypedDict):
password: str
guesses: int
+4 -1
View File
@@ -1,17 +1,20 @@
from decimal import Decimal
from typing import Literal, TypedDict
from typing import Literal, TypedDict, type_check_only
@type_check_only
class _TimeEstimate(TypedDict):
crack_times_seconds: _CrackTimeSeconds
crack_times_display: _CrackTimesDisplay
score: Literal[0, 1, 2, 3, 4]
@type_check_only
class _CrackTimeSeconds(TypedDict):
online_throttling_100_per_hour: Decimal
online_no_throttling_10_per_second: Decimal
offline_slow_hashing_1e4_per_second: Decimal
offline_fast_hashing_1e10_per_second: Decimal
@type_check_only
class _CrackTimesDisplay(TypedDict):
online_throttling_100_per_hour: str
online_no_throttling_10_per_second: str