Skip to content

Commit 48a42bf

Browse files
author
MomIsBestFriend
committed
Fixes for @jbrockmendel review
1 parent 77009b7 commit 48a42bf

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

pandas/core/internals/blocks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def make_block_same_class(self, values, placement=None, ndim=None):
261261

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

267267
result = "{name}: {len} dtype: {dtype}".format(

pandas/core/internals/managers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def __len__(self) -> int:
321321
return len(self.items)
322322

323323
def __repr__(self) -> str:
324-
output = pprint_thing(type(self).__name__)
324+
output = type(self).__name__
325325
for i, ax in enumerate(self.axes):
326326
if i == 0:
327327
output += "\nItems: {ax}".format(ax=ax)

pandas/core/series.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def __init__(
256256
elif is_extension_array_dtype(data):
257257
pass
258258
elif isinstance(data, (set, frozenset)):
259-
raise TypeError("{0!r} type is unordered".format(type(data).__name__))
259+
raise TypeError(f"{repr(type(data).__name__)} type is unordered")
260260
elif isinstance(data, ABCSparseArray):
261261
# handle sparse passed here (and force conversion)
262262
data = data.to_dense()
@@ -1569,9 +1569,8 @@ def to_string(
15691569
# catch contract violations
15701570
if not isinstance(result, str):
15711571
raise AssertionError(
1572-
"result must be of type unicode, type"
1573-
" of result is {0!r}"
1574-
"".format(type(result).__name__)
1572+
"result must be of type str, type"
1573+
f" of result is {repr(type(result).__name__)}"
15751574
)
15761575

15771576
if buf is None:

pandas/io/clipboard/__init__.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(self, message):
9191
super().__init__(message)
9292

9393

94-
def _stringifyText(text):
94+
def _stringifyText(text) -> str:
9595
acceptedTypes = (str, int, float, bool)
9696
if not isinstance(text, acceptedTypes):
9797
raise PyperclipException(
@@ -156,7 +156,7 @@ def copy_qt(text):
156156
cb = app.clipboard()
157157
cb.setText(text)
158158

159-
def paste_qt():
159+
def paste_qt() -> str:
160160
cb = app.clipboard()
161161
return str(cb.text())
162162

@@ -273,7 +273,7 @@ def copy_dev_clipboard(text):
273273
with open("/dev/clipboard", "wt") as fo:
274274
fo.write(text)
275275

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

289-
def __bool__(self):
289+
def __bool__(self) -> bool:
290290
return False
291291

292292
return ClipboardUnavailable(), ClipboardUnavailable()
@@ -650,7 +650,7 @@ def lazy_load_stub_paste():
650650
return paste()
651651

652652

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

656656

0 commit comments

Comments
 (0)