Skip to content

Commit 0c5ab81

Browse files
committed
chore: Add initial typehint support for oxml.chart and oxml.dml
Signed-off-by: Avishrant Sharma <[email protected]>
1 parent 761e32f commit 0c5ab81

File tree

14 files changed

+2154
-51
lines changed

14 files changed

+2154
-51
lines changed

pptx-stubs/opc/oxml.pyi

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
from collections.abc import Callable
2+
3+
from pptx.opc.packuri import PackURI
4+
from pptx.oxml.xmlchemy import BaseOxmlElement
5+
6+
nsmap: dict[str, str] = ...
7+
8+
def oxml_to_encoded_bytes(
9+
element: BaseOxmlElement, encoding: str = ..., pretty_print: bool = ..., standalone: bool | None = ...
10+
) -> bytes: ...
11+
def oxml_tostring(
12+
elm: BaseOxmlElement, encoding: str | None = ..., pretty_print: bool = ..., standalone: bool | None = ...
13+
): ...
14+
def serialize_part_xml(part_elm: BaseOxmlElement) -> bytes: ...
15+
16+
class CT_Default(BaseOxmlElement):
17+
@property
18+
def extension(self) -> str:
19+
"""ST_Extension type-converted value of ``Extension`` attribute."""
20+
...
21+
22+
@extension.setter
23+
def extension(self, value: str) -> None: ...
24+
@property
25+
def contentType(self) -> str:
26+
"""ST_ContentType type-converted value of ``ContentType`` attribute."""
27+
...
28+
29+
@contentType.setter
30+
def contentType(self, value: str) -> None: ...
31+
32+
class CT_Override(BaseOxmlElement):
33+
@property
34+
def partName(self) -> str:
35+
"""XsdAnyUri type-converted value of ``PartName`` attribute."""
36+
...
37+
38+
@partName.setter
39+
def partName(self, value: str) -> None: ...
40+
@property
41+
def contentType(self) -> str:
42+
"""ST_ContentType type-converted value of ``ContentType`` attribute."""
43+
...
44+
45+
@contentType.setter
46+
def contentType(self, value: str) -> None: ...
47+
48+
class CT_Relationship(BaseOxmlElement):
49+
@property
50+
def rId(self) -> str:
51+
"""XsdId type-converted value of ``Id`` attribute."""
52+
...
53+
54+
@rId.setter
55+
def rId(self, value: str) -> None: ...
56+
@property
57+
def reltype(self) -> str:
58+
"""XsdAnyUri type-converted value of ``Type`` attribute."""
59+
...
60+
61+
@reltype.setter
62+
def reltype(self, value: str) -> None: ...
63+
@property
64+
def target_ref(self) -> str:
65+
"""XsdAnyUri type-converted value of ``Target`` attribute."""
66+
...
67+
68+
@target_ref.setter
69+
def target_ref(self, value: str) -> None: ...
70+
@property
71+
def targetMode(self) -> str:
72+
"""ST_TargetMode type-converted value of ``TargetMode`` attribute, or |INTERNAL|. Assigning the default value causes the attribute to be removed from the element."""
73+
...
74+
75+
@targetMode.setter
76+
def targetMode(self, value: str) -> None: ...
77+
@classmethod
78+
def new(cls, rId: str, reltype: str, target_ref: str, target_mode: str = ...) -> CT_Relationship: ...
79+
80+
class CT_Relationships(BaseOxmlElement):
81+
_insert_relationship: Callable[[CT_Relationship], CT_Relationship]
82+
83+
@property
84+
def relationship_lst(self) -> list[CT_Relationship]:
85+
"""A list containing each of the ``<pr:Relationship>`` child elements, in the order they appear."""
86+
...
87+
88+
def add_rel(self, rId: str, reltype: str, target: str, is_external: bool = ...) -> CT_Relationship: ...
89+
@classmethod
90+
def new(cls) -> CT_Relationships: ...
91+
@property
92+
def xml_file_bytes(self) -> bytes: ...
93+
94+
class CT_Types(BaseOxmlElement):
95+
_add_default: Callable[..., CT_Default]
96+
_add_override: Callable[..., CT_Override]
97+
98+
@property
99+
def default_lst(self) -> list[CT_Default]:
100+
"""A list containing each of the ``<ct:Default>`` child elements, in the order they appear."""
101+
...
102+
103+
@property
104+
def override_lst(self) -> list[CT_Override]:
105+
"""A list containing each of the ``<ct:Override>`` child elements, in the order they appear."""
106+
...
107+
108+
def add_default(self, ext: str, content_type: str) -> CT_Default: ...
109+
def add_override(self, partname: PackURI, content_type: str) -> CT_Override: ...
110+
@classmethod
111+
def new(cls) -> CT_Types: ...

0 commit comments

Comments
 (0)