diff --git a/stubs/pyperclip/@tests/stubtest_allowlist.txt b/stubs/pyperclip/@tests/stubtest_allowlist.txt new file mode 100644 index 000000000..096a89722 --- /dev/null +++ b/stubs/pyperclip/@tests/stubtest_allowlist.txt @@ -0,0 +1 @@ +pyperclip.__main__ diff --git a/stubs/pyperclip/METADATA.toml b/stubs/pyperclip/METADATA.toml new file mode 100644 index 000000000..d8fd275f4 --- /dev/null +++ b/stubs/pyperclip/METADATA.toml @@ -0,0 +1,6 @@ +version = "1.9.*" +upstream_repository = "https://github.com/asweigart/pyperclip" + +[tool.stubtest] +platforms = ["win32", "linux", "darwin"] +apt_dependencies = ["xclip"] diff --git a/stubs/pyperclip/pyperclip/__init__.pyi b/stubs/pyperclip/pyperclip/__init__.pyi new file mode 100644 index 000000000..4d2947e84 --- /dev/null +++ b/stubs/pyperclip/pyperclip/__init__.pyi @@ -0,0 +1,24 @@ +__all__ = ["copy", "paste", "set_clipboard", "determine_clipboard"] + +from collections.abc import Callable +from typing import Literal +from typing_extensions import TypeAlias + +class PyperclipException(RuntimeError): ... + +class PyperclipWindowsException(PyperclipException): + def __init__(self, message: str) -> None: ... + +class PyperclipTimeoutException(PyperclipException): ... + +_ClipboardMechanismName: TypeAlias = Literal[ + "pbcopy", "pyobjc", "qt", "xclip", "xsel", "wl-clipboard", "klipper", "windows", "no" +] +_ClipboardCopyMechanism: TypeAlias = Callable[[str], None] +_ClipboardPasteMechanism: TypeAlias = Callable[[], str] + +def copy(text: str) -> None: ... +def paste() -> str: ... +def set_clipboard(clipboard: _ClipboardMechanismName) -> None: ... +def determine_clipboard() -> tuple[_ClipboardCopyMechanism, _ClipboardPasteMechanism]: ... +def is_available() -> bool: ...