From 49b1a1a96a90946ff8885792eec30acb5cf39af0 Mon Sep 17 00:00:00 2001 From: Kanishk Pachauri <itskanishkp.py@gmail.com> Date: Fri, 23 Feb 2024 21:14:29 +0530 Subject: [PATCH] stdlib: Use Literal in difflib.SequenceMatcher.get_opcodes (#11464) --- stdlib/difflib.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/difflib.pyi b/stdlib/difflib.pyi index 894ebaaeca98..d5b77b8f0e2c 100644 --- a/stdlib/difflib.pyi +++ b/stdlib/difflib.pyi @@ -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: ...