stdlib: Use Literal in difflib.SequenceMatcher.get_opcodes (#11464)

This commit is contained in:
Kanishk Pachauri
2024-02-23 21:14:29 +05:30
committed by GitHub
parent 3c08a97656
commit 49b1a1a96a

View File

@@ -1,6 +1,6 @@
import sys
from collections.abc import Callable, Iterable, Iterator, Sequence
from typing import Any, AnyStr, Generic, NamedTuple, TypeVar, overload
from typing import Any, AnyStr, Generic, Literal, NamedTuple, TypeVar, overload
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -49,7 +49,7 @@ class SequenceMatcher(Generic[_T]):
def find_longest_match(self, alo: int, ahi: int, blo: int, bhi: int) -> Match: ...
def get_matching_blocks(self) -> list[Match]: ...
def get_opcodes(self) -> list[tuple[str, int, int, int, int]]: ...
def get_opcodes(self) -> list[tuple[Literal["replace", "delete", "insert", "equal"], int, int, int, int]]: ...
def get_grouped_opcodes(self, n: int = 3) -> Iterable[list[tuple[str, int, int, int, int]]]: ...
def ratio(self) -> float: ...
def quick_ratio(self) -> float: ...