MCPcopy Create free account
hub / github.com/scanny/python-pptx / BaseShapeFactory

Function BaseShapeFactory

src/pptx/shapes/shapetree.py:803–820  ·  view source on GitHub ↗

Return an instance of the appropriate shape proxy class for `shape_elm`.

(shape_elm: ShapeElement, parent: ProvidesPart)

Source from the content-addressed store, hash-verified

801
802
803def BaseShapeFactory(shape_elm: ShapeElement, parent: ProvidesPart) -> BaseShape:
804 """Return an instance of the appropriate shape proxy class for `shape_elm`."""
805 tag = shape_elm.tag
806
807 if isinstance(shape_elm, CT_Picture):
808 videoFiles = shape_elm.xpath("./p:nvPicPr/p:nvPr/a:videoFile")
809 if videoFiles:
810 return Movie(shape_elm, parent)
811 return Picture(shape_elm, parent)
812
813 shape_cls = {
814 qn("p:cxnSp"): Connector,
815 qn("p:grpSp"): GroupShape,
816 qn("p:sp"): Shape,
817 qn("p:graphicFrame"): GraphicFrame,
818 }.get(tag, BaseShape)
819
820 return shape_cls(shape_elm, parent) # pyright: ignore[reportArgumentType]
821
822
823def _LayoutShapeFactory(shape_elm: ShapeElement, parent: ProvidesPart) -> BaseShape:

Callers 8

rotation_get_fixtureMethod · 0.90
rotation_set_fixtureMethod · 0.90
_shape_factoryMethod · 0.85
_LayoutShapeFactoryFunction · 0.85
_MasterShapeFactoryFunction · 0.85
_NotesSlideShapeFactoryFunction · 0.85
SlideShapeFactoryFunction · 0.85

Calls 5

MovieClass · 0.90
PictureClass · 0.90
qnFunction · 0.90
xpathMethod · 0.45
getMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…