Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type hinting stub file #255

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/pyperclip/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Type signature stub file for pyperclip,
#
# Pyperclip is delibarately backwards compatable with
# python 2.6, and so type annotation within the source
# directly are not an option.

from typing import Callable, Optional

# All and only those functions listed in __all__ are given
# type annotated signatures here.


def copy(text: str) -> None: ...


def paste() -> str: ...


# timeout will typically be an int, but floats work.
def waitForPaste(timeout: Optional[float] = None) -> str: ...


def waitForNewPaste(timeout: Optional[float] = None) -> str: ...


def set_clipboard(clipboard: str) -> None: ...


def determine_clipboard() -> tuple[
Callable[[str], None],
Callable[[], str]
]: ...
5 changes: 5 additions & 0 deletions src/pyperclip/py.typed
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""
To maintain compatibility with Python versions that do
not support type hinting, the type hints are provided in the
PEPs 484 and 561 stub file src/__init__.pyi
"""