Skip to content

Commit fbd303c

Browse files
committed
Removed unecessary repr
1 parent eed4528 commit fbd303c

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

pandas/core/frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7785,7 +7785,7 @@ def _get_agg_axis(self, axis_num):
77857785
elif axis_num == 1:
77867786
return self.index
77877787
else:
7788-
raise ValueError("Axis must be 0 or 1 (got %r)" % axis_num)
7788+
raise ValueError(f"Axis must be 0 or 1 (got {axis_num})")
77897789

77907790
def mode(self, axis=0, numeric_only=False, dropna=True):
77917791
"""

pandas/core/indexes/numeric.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,9 @@ def _convert_tolerance(self, tolerance, target):
130130
else:
131131
raise ValueError(
132132
(
133-
"tolerance argument for %s must be numeric "
134-
"if it is a scalar: %r"
133+
f"tolerance argument for {type(self).__name__} must be numeric "
134+
f"if it is a scalar: {tolerance}"
135135
)
136-
% (type(self).__name__, tolerance)
137136
)
138137
return tolerance
139138

pandas/io/html.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def _get_skiprows(skiprows):
103103
elif skiprows is None:
104104
return 0
105105
raise TypeError(
106-
f"{repr(type(skiprows).__name__)} is not a valid type for skipping rows"
106+
f"{(type(skiprows).__name__)} is not a valid type for skipping rows"
107107
)
108108

109109

@@ -133,7 +133,7 @@ def _read(obj):
133133
except (TypeError, ValueError):
134134
pass
135135
else:
136-
raise TypeError(f"Cannot read object of type {repr(type(obj).__name__)}")
136+
raise TypeError(f"Cannot read object of type {(type(obj).__name__)}")
137137
return text
138138

139139

@@ -560,7 +560,7 @@ def _parse_tables(self, doc, match, attrs):
560560
unique_tables.add(table)
561561

562562
if not result:
563-
raise ValueError(f"No tables found matching pattern {repr(match.pattern)}")
563+
raise ValueError(f"No tables found matching pattern {match.pattern}")
564564
return result
565565

566566
def _text_getter(self, obj):
@@ -659,7 +659,7 @@ def _parse_tables(self, doc, match, kwargs):
659659

660660
# 1. check all descendants for the given pattern and only search tables
661661
# 2. go up the tree until we find a table
662-
xpath_expr = f"//table//*[re:test(text(), {repr(pattern)})]/ancestor::table"
662+
xpath_expr = f"//table//*[re:test(text(), {pattern})]/ancestor::table"
663663

664664
# if any table attributes were given build an xpath expression to
665665
# search for them
@@ -679,7 +679,7 @@ def _parse_tables(self, doc, match, kwargs):
679679
elem.getparent().remove(elem)
680680

681681
if not tables:
682-
raise ValueError(f"No tables found matching regex {repr(pattern)}")
682+
raise ValueError(f"No tables found matching regex {pattern}")
683683
return tables
684684

685685
def _equals_tag(self, obj, tag):
@@ -857,7 +857,7 @@ def _validate_flavor(flavor):
857857
elif isinstance(flavor, abc.Iterable):
858858
if not all(isinstance(flav, str) for flav in flavor):
859859
raise TypeError(
860-
f"Object of type {repr(type(flavor).__name__)} "
860+
f"Object of type {(type(flavor).__name__)} "
861861
f"is not an iterable of strings"
862862
)
863863
else:

pandas/io/parsers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,8 @@ def _get_options_with_defaults(self, engine):
913913
pass
914914
else:
915915
raise ValueError(
916-
f"The {repr(argname)} option is not supported with the"
917-
f" {repr(engine)} engine"
916+
f"The {argname} option is not supported with the"
917+
f" {engine} engine"
918918
)
919919
else:
920920
value = _deprecated_defaults.get(argname, default)

0 commit comments

Comments
 (0)