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

TYP: Typing annotations in clipboard #29850

Merged
merged 3 commits into from
Nov 27, 2019
Merged
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
10 changes: 5 additions & 5 deletions pandas/io/clipboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __init__(self, message):
super().__init__(message)


def _stringifyText(text):
def _stringifyText(text) -> str:
acceptedTypes = (str, int, float, bool)
if not isinstance(text, acceptedTypes):
raise PyperclipException(
Expand Down Expand Up @@ -156,7 +156,7 @@ def copy_qt(text):
cb = app.clipboard()
cb.setText(text)

def paste_qt():
def paste_qt() -> str:
cb = app.clipboard()
return str(cb.text())

Expand Down Expand Up @@ -273,7 +273,7 @@ def copy_dev_clipboard(text):
with open("/dev/clipboard", "wt") as fo:
fo.write(text)

def paste_dev_clipboard():
def paste_dev_clipboard() -> str:
with open("/dev/clipboard", "rt") as fo:
content = fo.read()
return content
Expand All @@ -286,7 +286,7 @@ class ClipboardUnavailable:
def __call__(self, *args, **kwargs):
raise PyperclipException(EXCEPT_MSG)

def __bool__(self):
def __bool__(self) -> bool:
return False

return ClipboardUnavailable(), ClipboardUnavailable()
Expand Down Expand Up @@ -650,7 +650,7 @@ def lazy_load_stub_paste():
return paste()


def is_available():
def is_available() -> bool:
return copy != lazy_load_stub_copy and paste != lazy_load_stub_paste


Expand Down