Skip to content

Convert core/indexes/base.py to f-strings #29903

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

Merged
merged 3 commits into from
Dec 1, 2019
Merged
Changes from 1 commit
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
Prev Previous commit
use repr
  • Loading branch information
topper-123 committed Nov 30, 2019
commit 38d9d691832a0fe10b388c8f000d3adf19433287
10 changes: 5 additions & 5 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def __new__(
except IncompatibleFrequency:
pass
if kwargs:
raise TypeError(f"Unexpected keyword arguments {set(kwargs)!r}")
raise TypeError(f"Unexpected keyword arguments {repr(set(kwargs))}")
return cls._simple_new(subarr, name, **kwargs)

elif hasattr(data, "__array__"):
Expand Down Expand Up @@ -2932,7 +2932,7 @@ def _get_fill_indexer_searchsorted(self, target, method, limit=None):
"""
if limit is not None:
raise ValueError(
f"limit argument for {method!r} method only well-defined "
f"limit argument for {repr(method)} method only well-defined "
"if index and target are monotonic"
)

Expand Down Expand Up @@ -3984,7 +3984,7 @@ def _scalar_data_error(cls, data):
# in order to keep mypy happy
return TypeError(
f"{cls.__name__}(...) must be called with a collection of some "
f"kind, {data!r} was passed"
f"kind, {repr(data)} was passed"
)

@classmethod
Expand Down Expand Up @@ -4103,7 +4103,7 @@ def contains(self, key) -> bool:
return key in self

def __hash__(self):
raise TypeError(f"unhashable type: {type(self).__name__!r}")
raise TypeError(f"unhashable type: {repr(type(self).__name__)}")

def __setitem__(self, key, value):
raise TypeError("Index does not support mutable operations")
Expand Down Expand Up @@ -5043,7 +5043,7 @@ def get_slice_bound(self, label, side, kind):
if isinstance(slc, np.ndarray):
raise KeyError(
f"Cannot get {side} slice bound for non-unique "
f"label: {original_label!r}"
f"label: {repr(original_label)}"
)

if isinstance(slc, slice):
Expand Down