From 23147f60f1d27781fe0612be2e4a0dfb7a362f85 Mon Sep 17 00:00:00 2001 From: Jeffrey Goldberg Date: Sat, 17 Feb 2024 13:37:07 -0600 Subject: [PATCH 1/5] 1st shot at pyi --- src/pyperclip/__init__.pyi | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/pyperclip/__init__.pyi diff --git a/src/pyperclip/__init__.pyi b/src/pyperclip/__init__.pyi new file mode 100644 index 0000000..4e39321 --- /dev/null +++ b/src/pyperclip/__init__.pyi @@ -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] + ]: ... From 46543a2f30b2beb5698c50467e8d6aaf0f32c813 Mon Sep 17 00:00:00 2001 From: Jeffrey Goldberg Date: Mon, 19 Feb 2024 12:00:38 -0600 Subject: [PATCH 2/5] py.typed --- py.typed | 5 +++++ src/pyperclip/__init__.pyi | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 py.typed diff --git a/py.typed b/py.typed new file mode 100644 index 0000000..5088c99 --- /dev/null +++ b/py.typed @@ -0,0 +1,5 @@ +""" +To maintain compatibility with Python versions that do +not support type hinting, the type hints are provided in the +PEP 561 stub file src/__init__.py +""" \ No newline at end of file diff --git a/src/pyperclip/__init__.pyi b/src/pyperclip/__init__.pyi index 4e39321..64785b9 100644 --- a/src/pyperclip/__init__.pyi +++ b/src/pyperclip/__init__.pyi @@ -7,7 +7,7 @@ from typing import Callable, Optional # All and only those functions listed in __all__ are given -# type annotated signatures here. +# type annotated signatures here. def copy(text: str) -> None: ... From 48e55d9a3fa0d17643e8f45112309c9ee9ee0cb9 Mon Sep 17 00:00:00 2001 From: Jeffrey Goldberg Date: Mon, 19 Feb 2024 12:22:18 -0600 Subject: [PATCH 3/5] Comment fix --- py.typed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py.typed b/py.typed index 5088c99..9195169 100644 --- a/py.typed +++ b/py.typed @@ -1,5 +1,5 @@ """ To maintain compatibility with Python versions that do not support type hinting, the type hints are provided in the -PEP 561 stub file src/__init__.py +PEPs 484 and 561 stub file src/__init__.py """ \ No newline at end of file From c1dcc790fb19dd51b499a2ea960edf0bbdaf1a52 Mon Sep 17 00:00:00 2001 From: Jeffrey Goldberg Date: Mon, 19 Feb 2024 13:20:05 -0600 Subject: [PATCH 4/5] Put py.typed in right place --- py.typed => src/pyperclip/py.typed | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename py.typed => src/pyperclip/py.typed (100%) diff --git a/py.typed b/src/pyperclip/py.typed similarity index 100% rename from py.typed rename to src/pyperclip/py.typed From d95e559a3ecbe27f0c7d8fdfa85440844654257d Mon Sep 17 00:00:00 2001 From: Jeffrey Goldberg Date: Mon, 19 Feb 2024 13:24:09 -0600 Subject: [PATCH 5/5] typo --- src/pyperclip/py.typed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyperclip/py.typed b/src/pyperclip/py.typed index 9195169..f68fa5e 100644 --- a/src/pyperclip/py.typed +++ b/src/pyperclip/py.typed @@ -1,5 +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__.py +PEPs 484 and 561 stub file src/__init__.pyi """ \ No newline at end of file