Skip to content

Commit a002400

Browse files
committed
ENH: auto convert __doc__ to be format ready
1 parent ede988c commit a002400

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pandas/core/indexing.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class IndexingMixin:
9090

9191
@property
9292
def iloc(self) -> "_iLocIndexer":
93-
f"""
93+
"""
9494
Purely integer-location based indexing for selection by position.
9595
9696
``.iloc[]`` is primarily integer position based (from ``0`` to
@@ -123,9 +123,9 @@ def iloc(self) -> "_iLocIndexer":
123123
124124
Examples
125125
--------
126-
>>> mydict = [{{'a': 1, 'b': 2, 'c': 3, 'd': 4}},
127-
... {{'a': 100, 'b': 200, 'c': 300, 'd': 400}},
128-
... {{'a': 1000, 'b': 2000, 'c': 3000, 'd': 4000 }}]
126+
>>> mydict = [{'a': 1, 'b': 2, 'c': 3, 'd': 4},
127+
... {'a': 100, 'b': 200, 'c': 300, 'd': 400},
128+
... {'a': 1000, 'b': 2000, 'c': 3000, 'd': 4000 }]
129129
>>> df = pd.DataFrame(mydict)
130130
>>> df
131131
a b c d

pandas/util/_decorators.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ def wrapper(*args, **kwargs) -> Callable:
275275
elif hasattr(arg, "_docstr_template"):
276276
templates.append(arg._docstr_template) # type: ignore
277277
elif arg.__doc__:
278-
templates.append(arg.__doc__)
278+
doc_tmp = arg.__doc__.replace("{", "{{").replace("}", "}}")
279+
templates.append(doc_tmp)
279280

280281
wrapper._docstr_template = "".join(dedent(t) for t in templates) # type: ignore
281282
wrapper.__doc__ = wrapper._docstr_template.format(**kwargs) # type: ignore

0 commit comments

Comments
 (0)