Skip to content

Commit 56338fa

Browse files
committed
fix typing of add_chart
1 parent 278b47b commit 56338fa

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/pptx/shapes/shapetree.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
from pptx.util import Emu, lazyproperty
3737

3838
if TYPE_CHECKING:
39-
from pptx.chart.chart import Chart
4039
from pptx.chart.data import ChartData
4140
from pptx.enum.chart import XL_CHART_TYPE
4241
from pptx.enum.shapes import MSO_CONNECTOR_TYPE, MSO_SHAPE
@@ -241,7 +240,7 @@ def add_chart(
241240
cx: Length,
242241
cy: Length,
243242
chart_data: ChartData,
244-
) -> Chart:
243+
) -> GraphicFrame:
245244
"""Add a new chart of `chart_type` to the slide.
246245
247246
The chart is positioned at (`x`, `y`), has size (`cx`, `cy`), and depicts `chart_data`.
@@ -255,7 +254,7 @@ def add_chart(
255254
rId = self.part.add_chart_part(chart_type, chart_data)
256255
graphicFrame = self._add_chart_graphicFrame(rId, x, y, cx, cy)
257256
self._recalculate_extents()
258-
return cast("Chart", self._shape_factory(graphicFrame))
257+
return cast(GraphicFrame, self._shape_factory(graphicFrame))
259258

260259
def add_connector(
261260
self,
@@ -287,7 +286,8 @@ def add_group_shape(self, shapes: Iterable[BaseShape] = ()) -> GroupShape:
287286
grpSp = self._element.add_grpSp()
288287
for shape in shapes:
289288
grpSp.insert_element_before(
290-
shape._element, "p:extLst" # pyright: ignore[reportPrivateUsage]
289+
shape._element,
290+
"p:extLst", # pyright: ignore[reportPrivateUsage]
291291
)
292292
if shapes:
293293
grpSp.recalculate_extents()

0 commit comments

Comments
 (0)