From eaf36dcc4dc73a5cf30a3d1f554e8f0dedeac255 Mon Sep 17 00:00:00 2001 From: Tesla2000 Date: Tue, 14 Apr 2026 16:40:46 +0200 Subject: [PATCH 1/2] Added pyphen --- stubs/pyphen/METADATA.toml | 2 ++ stubs/pyphen/pyphen/__init__.pyi | 40 ++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 stubs/pyphen/METADATA.toml create mode 100644 stubs/pyphen/pyphen/__init__.pyi diff --git a/stubs/pyphen/METADATA.toml b/stubs/pyphen/METADATA.toml new file mode 100644 index 000000000000..f6b2d875f6b8 --- /dev/null +++ b/stubs/pyphen/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.17.2" +upstream-repository = "https://github.com/Kozea/Pyphen" diff --git a/stubs/pyphen/pyphen/__init__.pyi b/stubs/pyphen/pyphen/__init__.pyi new file mode 100644 index 000000000000..32709e6e1a02 --- /dev/null +++ b/stubs/pyphen/pyphen/__init__.pyi @@ -0,0 +1,40 @@ +from collections.abc import Generator +from pathlib import Path +from typing import Any +from typing_extensions import Self + +__all__ = ("LANGUAGES", "Pyphen", "language_fallback") +LANGUAGES: dict[str, Path] + +def language_fallback(language: str) -> str: ... + +class AlternativeParser: + change: str + index: int + cut: int + + def __init__(self, pattern: str, alternative: str) -> None: ... + def __call__(self, value: str) -> int: ... + +class DataInt(int): + def __new__(cls, value: int, data: Any = ..., reference: DataInt | None = ...) -> Self: ... + +class HyphDict: + patterns: dict[str, tuple[int, tuple[int, ...]]] + cache: dict[str, list[DataInt]] + maxlen: int + + def __init__(self, path: Path) -> None: ... + def positions(self, word: str) -> list[DataInt]: ... + +class Pyphen: + hd: HyphDict + + def __init__( + self, filename: str | Path | None = ..., lang: str | None = ..., left: int = 2, right: int = 2, cache: bool = True + ) -> None: ... + def positions(self, word: str) -> list[DataInt]: ... + def iterate(self, word: str) -> Generator[tuple[str, str], None, None]: ... + def wrap(self, word: str, width: int, hyphen: str = "-") -> tuple[str, str] | None: ... + def inserted(self, word: str, hyphen: str = "-") -> str: ... + __call__ = iterate From fdc57f077ef3fc4198bf78ecd6bf9138ac8e87bb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 14 Apr 2026 14:54:31 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/pyphen/pyphen/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/pyphen/pyphen/__init__.pyi b/stubs/pyphen/pyphen/__init__.pyi index 32709e6e1a02..0507b0c3eff1 100644 --- a/stubs/pyphen/pyphen/__init__.pyi +++ b/stubs/pyphen/pyphen/__init__.pyi @@ -34,7 +34,7 @@ class Pyphen: self, filename: str | Path | None = ..., lang: str | None = ..., left: int = 2, right: int = 2, cache: bool = True ) -> None: ... def positions(self, word: str) -> list[DataInt]: ... - def iterate(self, word: str) -> Generator[tuple[str, str], None, None]: ... + def iterate(self, word: str) -> Generator[tuple[str, str]]: ... def wrap(self, word: str, width: int, hyphen: str = "-") -> tuple[str, str] | None: ... def inserted(self, word: str, hyphen: str = "-") -> str: ... __call__ = iterate