Skip to content

Commit

Permalink
Fixes for @jbrockmendel review
Browse files Browse the repository at this point in the history
  • Loading branch information
MomIsBestFriend committed Nov 27, 2019
1 parent 77009b7 commit 48a42bf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pandas/core/internals/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def make_block_same_class(self, values, placement=None, ndim=None):

def __repr__(self) -> str:
# don't want to print out all of the items here
name = pprint_thing(type(self).__name__)
name = type(self).__name__
if self._is_single_block:

result = "{name}: {len} dtype: {dtype}".format(
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/internals/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def __len__(self) -> int:
return len(self.items)

def __repr__(self) -> str:
output = pprint_thing(type(self).__name__)
output = type(self).__name__
for i, ax in enumerate(self.axes):
if i == 0:
output += "\nItems: {ax}".format(ax=ax)
Expand Down
7 changes: 3 additions & 4 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def __init__(
elif is_extension_array_dtype(data):
pass
elif isinstance(data, (set, frozenset)):
raise TypeError("{0!r} type is unordered".format(type(data).__name__))
raise TypeError(f"{repr(type(data).__name__)} type is unordered")
elif isinstance(data, ABCSparseArray):
# handle sparse passed here (and force conversion)
data = data.to_dense()
Expand Down Expand Up @@ -1569,9 +1569,8 @@ def to_string(
# catch contract violations
if not isinstance(result, str):
raise AssertionError(
"result must be of type unicode, type"
" of result is {0!r}"
"".format(type(result).__name__)
"result must be of type str, type"
f" of result is {repr(type(result).__name__)}"
)

if buf is None:
Expand Down
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

0 comments on commit 48a42bf

Please sign in to comment.