repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
python-openxml/python-docx | docx/opc/packuri.py | PackURI.rels_uri | def rels_uri(self):
"""
The pack URI of the .rels part corresponding to the current pack URI.
Only produces sensible output if the pack URI is a partname or the
package pseudo-partname '/'.
"""
rels_filename = '%s.rels' % self.filename
rels_uri_str = posixpath.joi... | python | def rels_uri(self):
"""
The pack URI of the .rels part corresponding to the current pack URI.
Only produces sensible output if the pack URI is a partname or the
package pseudo-partname '/'.
"""
rels_filename = '%s.rels' % self.filename
rels_uri_str = posixpath.joi... | [
"def",
"rels_uri",
"(",
"self",
")",
":",
"rels_filename",
"=",
"'%s.rels'",
"%",
"self",
".",
"filename",
"rels_uri_str",
"=",
"posixpath",
".",
"join",
"(",
"self",
".",
"baseURI",
",",
"'_rels'",
",",
"rels_filename",
")",
"return",
"PackURI",
"(",
"rel... | The pack URI of the .rels part corresponding to the current pack URI.
Only produces sensible output if the pack URI is a partname or the
package pseudo-partname '/'. | [
"The",
"pack",
"URI",
"of",
"the",
".",
"rels",
"part",
"corresponding",
"to",
"the",
"current",
"pack",
"URI",
".",
"Only",
"produces",
"sensible",
"output",
"if",
"the",
"pack",
"URI",
"is",
"a",
"partname",
"or",
"the",
"package",
"pseudo",
"-",
"part... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/packuri.py#L105-L113 | train | Returns the pack URI of the. rels part corresponding to the current pack URI. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/opc/oxml.py | CT_Default.new | def new(ext, content_type):
"""
Return a new ``<Default>`` element with attributes set to parameter
values.
"""
xml = '<Default xmlns="%s"/>' % nsmap['ct']
default = parse_xml(xml)
default.set('Extension', ext)
default.set('ContentType', content_type)
... | python | def new(ext, content_type):
"""
Return a new ``<Default>`` element with attributes set to parameter
values.
"""
xml = '<Default xmlns="%s"/>' % nsmap['ct']
default = parse_xml(xml)
default.set('Extension', ext)
default.set('ContentType', content_type)
... | [
"def",
"new",
"(",
"ext",
",",
"content_type",
")",
":",
"xml",
"=",
"'<Default xmlns=\"%s\"/>'",
"%",
"nsmap",
"[",
"'ct'",
"]",
"default",
"=",
"parse_xml",
"(",
"xml",
")",
"default",
".",
"set",
"(",
"'Extension'",
",",
"ext",
")",
"default",
".",
... | Return a new ``<Default>`` element with attributes set to parameter
values. | [
"Return",
"a",
"new",
"<Default",
">",
"element",
"with",
"attributes",
"set",
"to",
"parameter",
"values",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/oxml.py#L109-L118 | train | Return a new empty element with the specified extension and content type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/opc/oxml.py | CT_Override.new | def new(partname, content_type):
"""
Return a new ``<Override>`` element with attributes set to parameter
values.
"""
xml = '<Override xmlns="%s"/>' % nsmap['ct']
override = parse_xml(xml)
override.set('PartName', partname)
override.set('ContentType', cont... | python | def new(partname, content_type):
"""
Return a new ``<Override>`` element with attributes set to parameter
values.
"""
xml = '<Override xmlns="%s"/>' % nsmap['ct']
override = parse_xml(xml)
override.set('PartName', partname)
override.set('ContentType', cont... | [
"def",
"new",
"(",
"partname",
",",
"content_type",
")",
":",
"xml",
"=",
"'<Override xmlns=\"%s\"/>'",
"%",
"nsmap",
"[",
"'ct'",
"]",
"override",
"=",
"parse_xml",
"(",
"xml",
")",
"override",
".",
"set",
"(",
"'PartName'",
",",
"partname",
")",
"overrid... | Return a new ``<Override>`` element with attributes set to parameter
values. | [
"Return",
"a",
"new",
"<Override",
">",
"element",
"with",
"attributes",
"set",
"to",
"parameter",
"values",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/oxml.py#L135-L144 | train | Return a new element with the specified partname and content type set to parameter
values. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/opc/oxml.py | CT_Relationship.new | def new(rId, reltype, target, target_mode=RTM.INTERNAL):
"""
Return a new ``<Relationship>`` element.
"""
xml = '<Relationship xmlns="%s"/>' % nsmap['pr']
relationship = parse_xml(xml)
relationship.set('Id', rId)
relationship.set('Type', reltype)
relations... | python | def new(rId, reltype, target, target_mode=RTM.INTERNAL):
"""
Return a new ``<Relationship>`` element.
"""
xml = '<Relationship xmlns="%s"/>' % nsmap['pr']
relationship = parse_xml(xml)
relationship.set('Id', rId)
relationship.set('Type', reltype)
relations... | [
"def",
"new",
"(",
"rId",
",",
"reltype",
",",
"target",
",",
"target_mode",
"=",
"RTM",
".",
"INTERNAL",
")",
":",
"xml",
"=",
"'<Relationship xmlns=\"%s\"/>'",
"%",
"nsmap",
"[",
"'pr'",
"]",
"relationship",
"=",
"parse_xml",
"(",
"xml",
")",
"relationsh... | Return a new ``<Relationship>`` element. | [
"Return",
"a",
"new",
"<Relationship",
">",
"element",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/oxml.py#L161-L172 | train | Return a new Relationship element. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/opc/oxml.py | CT_Relationships.add_rel | def add_rel(self, rId, reltype, target, is_external=False):
"""
Add a child ``<Relationship>`` element with attributes set according
to parameter values.
"""
target_mode = RTM.EXTERNAL if is_external else RTM.INTERNAL
relationship = CT_Relationship.new(rId, reltype, targe... | python | def add_rel(self, rId, reltype, target, is_external=False):
"""
Add a child ``<Relationship>`` element with attributes set according
to parameter values.
"""
target_mode = RTM.EXTERNAL if is_external else RTM.INTERNAL
relationship = CT_Relationship.new(rId, reltype, targe... | [
"def",
"add_rel",
"(",
"self",
",",
"rId",
",",
"reltype",
",",
"target",
",",
"is_external",
"=",
"False",
")",
":",
"target_mode",
"=",
"RTM",
".",
"EXTERNAL",
"if",
"is_external",
"else",
"RTM",
".",
"INTERNAL",
"relationship",
"=",
"CT_Relationship",
"... | Add a child ``<Relationship>`` element with attributes set according
to parameter values. | [
"Add",
"a",
"child",
"<Relationship",
">",
"element",
"with",
"attributes",
"set",
"according",
"to",
"parameter",
"values",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/oxml.py#L212-L219 | train | Add a child relationship element with attributes set according
to parameter values. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/opc/oxml.py | CT_Types.add_default | def add_default(self, ext, content_type):
"""
Add a child ``<Default>`` element with attributes set to parameter
values.
"""
default = CT_Default.new(ext, content_type)
self.append(default) | python | def add_default(self, ext, content_type):
"""
Add a child ``<Default>`` element with attributes set to parameter
values.
"""
default = CT_Default.new(ext, content_type)
self.append(default) | [
"def",
"add_default",
"(",
"self",
",",
"ext",
",",
"content_type",
")",
":",
"default",
"=",
"CT_Default",
".",
"new",
"(",
"ext",
",",
"content_type",
")",
"self",
".",
"append",
"(",
"default",
")"
] | Add a child ``<Default>`` element with attributes set to parameter
values. | [
"Add",
"a",
"child",
"<Default",
">",
"element",
"with",
"attributes",
"set",
"to",
"parameter",
"values",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/oxml.py#L251-L257 | train | Add a child <Default > element with the specified extension and content type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/opc/oxml.py | CT_Types.add_override | def add_override(self, partname, content_type):
"""
Add a child ``<Override>`` element with attributes set to parameter
values.
"""
override = CT_Override.new(partname, content_type)
self.append(override) | python | def add_override(self, partname, content_type):
"""
Add a child ``<Override>`` element with attributes set to parameter
values.
"""
override = CT_Override.new(partname, content_type)
self.append(override) | [
"def",
"add_override",
"(",
"self",
",",
"partname",
",",
"content_type",
")",
":",
"override",
"=",
"CT_Override",
".",
"new",
"(",
"partname",
",",
"content_type",
")",
"self",
".",
"append",
"(",
"override",
")"
] | Add a child ``<Override>`` element with attributes set to parameter
values. | [
"Add",
"a",
"child",
"<Override",
">",
"element",
"with",
"attributes",
"set",
"to",
"parameter",
"values",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/oxml.py#L259-L265 | train | Add a child element with the specified partname and content type to the override list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/blkcntnr.py | BlockItemContainer.add_paragraph | def add_paragraph(self, text='', style=None):
"""
Return a paragraph newly added to the end of the content in this
container, having *text* in a single run if present, and having
paragraph style *style*. If *style* is |None|, no paragraph style is
applied, which has the same effe... | python | def add_paragraph(self, text='', style=None):
"""
Return a paragraph newly added to the end of the content in this
container, having *text* in a single run if present, and having
paragraph style *style*. If *style* is |None|, no paragraph style is
applied, which has the same effe... | [
"def",
"add_paragraph",
"(",
"self",
",",
"text",
"=",
"''",
",",
"style",
"=",
"None",
")",
":",
"paragraph",
"=",
"self",
".",
"_add_paragraph",
"(",
")",
"if",
"text",
":",
"paragraph",
".",
"add_run",
"(",
"text",
")",
"if",
"style",
"is",
"not",... | Return a paragraph newly added to the end of the content in this
container, having *text* in a single run if present, and having
paragraph style *style*. If *style* is |None|, no paragraph style is
applied, which has the same effect as applying the 'Normal' style. | [
"Return",
"a",
"paragraph",
"newly",
"added",
"to",
"the",
"end",
"of",
"the",
"content",
"in",
"this",
"container",
"having",
"*",
"text",
"*",
"in",
"a",
"single",
"run",
"if",
"present",
"and",
"having",
"paragraph",
"style",
"*",
"style",
"*",
".",
... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/blkcntnr.py#L28-L40 | train | Add a single paragraph to the end of the content in this Arc. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/blkcntnr.py | BlockItemContainer.add_table | def add_table(self, rows, cols, width):
"""
Return a table of *width* having *rows* rows and *cols* columns,
newly appended to the content in this container. *width* is evenly
distributed between the table columns.
"""
from .table import Table
tbl = CT_Tbl.new_tbl... | python | def add_table(self, rows, cols, width):
"""
Return a table of *width* having *rows* rows and *cols* columns,
newly appended to the content in this container. *width* is evenly
distributed between the table columns.
"""
from .table import Table
tbl = CT_Tbl.new_tbl... | [
"def",
"add_table",
"(",
"self",
",",
"rows",
",",
"cols",
",",
"width",
")",
":",
"from",
".",
"table",
"import",
"Table",
"tbl",
"=",
"CT_Tbl",
".",
"new_tbl",
"(",
"rows",
",",
"cols",
",",
"width",
")",
"self",
".",
"_element",
".",
"_insert_tbl"... | Return a table of *width* having *rows* rows and *cols* columns,
newly appended to the content in this container. *width* is evenly
distributed between the table columns. | [
"Return",
"a",
"table",
"of",
"*",
"width",
"*",
"having",
"*",
"rows",
"*",
"rows",
"and",
"*",
"cols",
"*",
"columns",
"newly",
"appended",
"to",
"the",
"content",
"in",
"this",
"container",
".",
"*",
"width",
"*",
"is",
"evenly",
"distributed",
"bet... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/blkcntnr.py#L42-L51 | train | Return a new table with rows and cols and width added to the content of this container. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/blkcntnr.py | BlockItemContainer.tables | def tables(self):
"""
A list containing the tables in this container, in document order.
Read-only.
"""
from .table import Table
return [Table(tbl, self) for tbl in self._element.tbl_lst] | python | def tables(self):
"""
A list containing the tables in this container, in document order.
Read-only.
"""
from .table import Table
return [Table(tbl, self) for tbl in self._element.tbl_lst] | [
"def",
"tables",
"(",
"self",
")",
":",
"from",
".",
"table",
"import",
"Table",
"return",
"[",
"Table",
"(",
"tbl",
",",
"self",
")",
"for",
"tbl",
"in",
"self",
".",
"_element",
".",
"tbl_lst",
"]"
] | A list containing the tables in this container, in document order.
Read-only. | [
"A",
"list",
"containing",
"the",
"tables",
"in",
"this",
"container",
"in",
"document",
"order",
".",
"Read",
"-",
"only",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/blkcntnr.py#L62-L68 | train | A list containing the tables in this container in document order. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/png.py | _ChunkFactory | def _ChunkFactory(chunk_type, stream_rdr, offset):
"""
Return a |_Chunk| subclass instance appropriate to *chunk_type* parsed
from *stream_rdr* at *offset*.
"""
chunk_cls_map = {
PNG_CHUNK_TYPE.IHDR: _IHDRChunk,
PNG_CHUNK_TYPE.pHYs: _pHYsChunk,
}
chunk_cls = chunk_cls_map.get... | python | def _ChunkFactory(chunk_type, stream_rdr, offset):
"""
Return a |_Chunk| subclass instance appropriate to *chunk_type* parsed
from *stream_rdr* at *offset*.
"""
chunk_cls_map = {
PNG_CHUNK_TYPE.IHDR: _IHDRChunk,
PNG_CHUNK_TYPE.pHYs: _pHYsChunk,
}
chunk_cls = chunk_cls_map.get... | [
"def",
"_ChunkFactory",
"(",
"chunk_type",
",",
"stream_rdr",
",",
"offset",
")",
":",
"chunk_cls_map",
"=",
"{",
"PNG_CHUNK_TYPE",
".",
"IHDR",
":",
"_IHDRChunk",
",",
"PNG_CHUNK_TYPE",
".",
"pHYs",
":",
"_pHYsChunk",
",",
"}",
"chunk_cls",
"=",
"chunk_cls_ma... | Return a |_Chunk| subclass instance appropriate to *chunk_type* parsed
from *stream_rdr* at *offset*. | [
"Return",
"a",
"|_Chunk|",
"subclass",
"instance",
"appropriate",
"to",
"*",
"chunk_type",
"*",
"parsed",
"from",
"*",
"stream_rdr",
"*",
"at",
"*",
"offset",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/png.py#L204-L214 | train | Returns a |_Chunk| subclass instance appropriate to chunk_type * parsed
from stream_rdr at offset. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/png.py | _PngParser.horz_dpi | def horz_dpi(self):
"""
Integer dots per inch for the width of this image. Defaults to 72
when not present in the file, as is often the case.
"""
pHYs = self._chunks.pHYs
if pHYs is None:
return 72
return self._dpi(pHYs.units_specifier, pHYs.horz_px_pe... | python | def horz_dpi(self):
"""
Integer dots per inch for the width of this image. Defaults to 72
when not present in the file, as is often the case.
"""
pHYs = self._chunks.pHYs
if pHYs is None:
return 72
return self._dpi(pHYs.units_specifier, pHYs.horz_px_pe... | [
"def",
"horz_dpi",
"(",
"self",
")",
":",
"pHYs",
"=",
"self",
".",
"_chunks",
".",
"pHYs",
"if",
"pHYs",
"is",
"None",
":",
"return",
"72",
"return",
"self",
".",
"_dpi",
"(",
"pHYs",
".",
"units_specifier",
",",
"pHYs",
".",
"horz_px_per_unit",
")"
] | Integer dots per inch for the width of this image. Defaults to 72
when not present in the file, as is often the case. | [
"Integer",
"dots",
"per",
"inch",
"for",
"the",
"width",
"of",
"this",
"image",
".",
"Defaults",
"to",
"72",
"when",
"not",
"present",
"in",
"the",
"file",
"as",
"is",
"often",
"the",
"case",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/png.py#L81-L89 | train | Integer dots per inch for the width of this image. Defaults to 72 if not present in the file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/png.py | _PngParser.vert_dpi | def vert_dpi(self):
"""
Integer dots per inch for the height of this image. Defaults to 72
when not present in the file, as is often the case.
"""
pHYs = self._chunks.pHYs
if pHYs is None:
return 72
return self._dpi(pHYs.units_specifier, pHYs.vert_px_p... | python | def vert_dpi(self):
"""
Integer dots per inch for the height of this image. Defaults to 72
when not present in the file, as is often the case.
"""
pHYs = self._chunks.pHYs
if pHYs is None:
return 72
return self._dpi(pHYs.units_specifier, pHYs.vert_px_p... | [
"def",
"vert_dpi",
"(",
"self",
")",
":",
"pHYs",
"=",
"self",
".",
"_chunks",
".",
"pHYs",
"if",
"pHYs",
"is",
"None",
":",
"return",
"72",
"return",
"self",
".",
"_dpi",
"(",
"pHYs",
".",
"units_specifier",
",",
"pHYs",
".",
"vert_px_per_unit",
")"
] | Integer dots per inch for the height of this image. Defaults to 72
when not present in the file, as is often the case. | [
"Integer",
"dots",
"per",
"inch",
"for",
"the",
"height",
"of",
"this",
"image",
".",
"Defaults",
"to",
"72",
"when",
"not",
"present",
"in",
"the",
"file",
"as",
"is",
"often",
"the",
"case",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/png.py#L92-L100 | train | Integer dots per inch for the height of this image. Defaults to 72. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/png.py | _Chunks.from_stream | def from_stream(cls, stream):
"""
Return a |_Chunks| instance containing the PNG chunks in *stream*.
"""
chunk_parser = _ChunkParser.from_stream(stream)
chunks = [chunk for chunk in chunk_parser.iter_chunks()]
return cls(chunks) | python | def from_stream(cls, stream):
"""
Return a |_Chunks| instance containing the PNG chunks in *stream*.
"""
chunk_parser = _ChunkParser.from_stream(stream)
chunks = [chunk for chunk in chunk_parser.iter_chunks()]
return cls(chunks) | [
"def",
"from_stream",
"(",
"cls",
",",
"stream",
")",
":",
"chunk_parser",
"=",
"_ChunkParser",
".",
"from_stream",
"(",
"stream",
")",
"chunks",
"=",
"[",
"chunk",
"for",
"chunk",
"in",
"chunk_parser",
".",
"iter_chunks",
"(",
")",
"]",
"return",
"cls",
... | Return a |_Chunks| instance containing the PNG chunks in *stream*. | [
"Return",
"a",
"|_Chunks|",
"instance",
"containing",
"the",
"PNG",
"chunks",
"in",
"*",
"stream",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/png.py#L122-L128 | train | Return a |_Chunks| instance containing the PNG chunks in stream. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/png.py | _Chunks.IHDR | def IHDR(self):
"""
IHDR chunk in PNG image
"""
match = lambda chunk: chunk.type_name == PNG_CHUNK_TYPE.IHDR # noqa
IHDR = self._find_first(match)
if IHDR is None:
raise InvalidImageStreamError('no IHDR chunk in PNG image')
return IHDR | python | def IHDR(self):
"""
IHDR chunk in PNG image
"""
match = lambda chunk: chunk.type_name == PNG_CHUNK_TYPE.IHDR # noqa
IHDR = self._find_first(match)
if IHDR is None:
raise InvalidImageStreamError('no IHDR chunk in PNG image')
return IHDR | [
"def",
"IHDR",
"(",
"self",
")",
":",
"match",
"=",
"lambda",
"chunk",
":",
"chunk",
".",
"type_name",
"==",
"PNG_CHUNK_TYPE",
".",
"IHDR",
"# noqa",
"IHDR",
"=",
"self",
".",
"_find_first",
"(",
"match",
")",
"if",
"IHDR",
"is",
"None",
":",
"raise",
... | IHDR chunk in PNG image | [
"IHDR",
"chunk",
"in",
"PNG",
"image"
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/png.py#L131-L139 | train | IHDR chunk in PNG image | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/png.py | _Chunks.pHYs | def pHYs(self):
"""
pHYs chunk in PNG image, or |None| if not present
"""
match = lambda chunk: chunk.type_name == PNG_CHUNK_TYPE.pHYs # noqa
return self._find_first(match) | python | def pHYs(self):
"""
pHYs chunk in PNG image, or |None| if not present
"""
match = lambda chunk: chunk.type_name == PNG_CHUNK_TYPE.pHYs # noqa
return self._find_first(match) | [
"def",
"pHYs",
"(",
"self",
")",
":",
"match",
"=",
"lambda",
"chunk",
":",
"chunk",
".",
"type_name",
"==",
"PNG_CHUNK_TYPE",
".",
"pHYs",
"# noqa",
"return",
"self",
".",
"_find_first",
"(",
"match",
")"
] | pHYs chunk in PNG image, or |None| if not present | [
"pHYs",
"chunk",
"in",
"PNG",
"image",
"or",
"|None|",
"if",
"not",
"present"
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/png.py#L142-L147 | train | Return the first pHYs chunk in PNG image or |None| if no pHYs chunk is present | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/png.py | _ChunkParser.iter_chunks | def iter_chunks(self):
"""
Generate a |_Chunk| subclass instance for each chunk in this parser's
PNG stream, in the order encountered in the stream.
"""
for chunk_type, offset in self._iter_chunk_offsets():
chunk = _ChunkFactory(chunk_type, self._stream_rdr, offset)
... | python | def iter_chunks(self):
"""
Generate a |_Chunk| subclass instance for each chunk in this parser's
PNG stream, in the order encountered in the stream.
"""
for chunk_type, offset in self._iter_chunk_offsets():
chunk = _ChunkFactory(chunk_type, self._stream_rdr, offset)
... | [
"def",
"iter_chunks",
"(",
"self",
")",
":",
"for",
"chunk_type",
",",
"offset",
"in",
"self",
".",
"_iter_chunk_offsets",
"(",
")",
":",
"chunk",
"=",
"_ChunkFactory",
"(",
"chunk_type",
",",
"self",
".",
"_stream_rdr",
",",
"offset",
")",
"yield",
"chunk... | Generate a |_Chunk| subclass instance for each chunk in this parser's
PNG stream, in the order encountered in the stream. | [
"Generate",
"a",
"|_Chunk|",
"subclass",
"instance",
"for",
"each",
"chunk",
"in",
"this",
"parser",
"s",
"PNG",
"stream",
"in",
"the",
"order",
"encountered",
"in",
"the",
"stream",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/png.py#L177-L184 | train | Iterate over the PNG chunks in this parser s internal cache. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/png.py | _ChunkParser._iter_chunk_offsets | def _iter_chunk_offsets(self):
"""
Generate a (chunk_type, chunk_offset) 2-tuple for each of the chunks
in the PNG image stream. Iteration stops after the IEND chunk is
returned.
"""
chunk_offset = 8
while True:
chunk_data_len = self._stream_rdr.read_l... | python | def _iter_chunk_offsets(self):
"""
Generate a (chunk_type, chunk_offset) 2-tuple for each of the chunks
in the PNG image stream. Iteration stops after the IEND chunk is
returned.
"""
chunk_offset = 8
while True:
chunk_data_len = self._stream_rdr.read_l... | [
"def",
"_iter_chunk_offsets",
"(",
"self",
")",
":",
"chunk_offset",
"=",
"8",
"while",
"True",
":",
"chunk_data_len",
"=",
"self",
".",
"_stream_rdr",
".",
"read_long",
"(",
"chunk_offset",
")",
"chunk_type",
"=",
"self",
".",
"_stream_rdr",
".",
"read_str",
... | Generate a (chunk_type, chunk_offset) 2-tuple for each of the chunks
in the PNG image stream. Iteration stops after the IEND chunk is
returned. | [
"Generate",
"a",
"(",
"chunk_type",
"chunk_offset",
")",
"2",
"-",
"tuple",
"for",
"each",
"of",
"the",
"chunks",
"in",
"the",
"PNG",
"image",
"stream",
".",
"Iteration",
"stops",
"after",
"the",
"IEND",
"chunk",
"is",
"returned",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/png.py#L186-L201 | train | Iterate over the chunk offsets in the PNG image stream. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/png.py | _IHDRChunk.from_offset | def from_offset(cls, chunk_type, stream_rdr, offset):
"""
Return an _IHDRChunk instance containing the image dimensions
extracted from the IHDR chunk in *stream* at *offset*.
"""
px_width = stream_rdr.read_long(offset)
px_height = stream_rdr.read_long(offset, 4)
r... | python | def from_offset(cls, chunk_type, stream_rdr, offset):
"""
Return an _IHDRChunk instance containing the image dimensions
extracted from the IHDR chunk in *stream* at *offset*.
"""
px_width = stream_rdr.read_long(offset)
px_height = stream_rdr.read_long(offset, 4)
r... | [
"def",
"from_offset",
"(",
"cls",
",",
"chunk_type",
",",
"stream_rdr",
",",
"offset",
")",
":",
"px_width",
"=",
"stream_rdr",
".",
"read_long",
"(",
"offset",
")",
"px_height",
"=",
"stream_rdr",
".",
"read_long",
"(",
"offset",
",",
"4",
")",
"return",
... | Return an _IHDRChunk instance containing the image dimensions
extracted from the IHDR chunk in *stream* at *offset*. | [
"Return",
"an",
"_IHDRChunk",
"instance",
"containing",
"the",
"image",
"dimensions",
"extracted",
"from",
"the",
"IHDR",
"chunk",
"in",
"*",
"stream",
"*",
"at",
"*",
"offset",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/png.py#L251-L258 | train | Return an _IHDRChunk instance containing the image dimensions and height extracted from the IHDR chunk at the given offset. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/png.py | _pHYsChunk.from_offset | def from_offset(cls, chunk_type, stream_rdr, offset):
"""
Return a _pHYsChunk instance containing the image resolution
extracted from the pHYs chunk in *stream* at *offset*.
"""
horz_px_per_unit = stream_rdr.read_long(offset)
vert_px_per_unit = stream_rdr.read_long(offset... | python | def from_offset(cls, chunk_type, stream_rdr, offset):
"""
Return a _pHYsChunk instance containing the image resolution
extracted from the pHYs chunk in *stream* at *offset*.
"""
horz_px_per_unit = stream_rdr.read_long(offset)
vert_px_per_unit = stream_rdr.read_long(offset... | [
"def",
"from_offset",
"(",
"cls",
",",
"chunk_type",
",",
"stream_rdr",
",",
"offset",
")",
":",
"horz_px_per_unit",
"=",
"stream_rdr",
".",
"read_long",
"(",
"offset",
")",
"vert_px_per_unit",
"=",
"stream_rdr",
".",
"read_long",
"(",
"offset",
",",
"4",
")... | Return a _pHYsChunk instance containing the image resolution
extracted from the pHYs chunk in *stream* at *offset*. | [
"Return",
"a",
"_pHYsChunk",
"instance",
"containing",
"the",
"image",
"resolution",
"extracted",
"from",
"the",
"pHYs",
"chunk",
"in",
"*",
"stream",
"*",
"at",
"*",
"offset",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/png.py#L281-L291 | train | Create a _pHYsChunk instance from the given chunk type and offset. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/helpers.py | StreamReader.read_byte | def read_byte(self, base, offset=0):
"""
Return the int value of the byte at the file position defined by
self._base_offset + *base* + *offset*. If *base* is None, the byte is
read from the current position in the stream.
"""
fmt = 'B'
return self._read_int(fmt, b... | python | def read_byte(self, base, offset=0):
"""
Return the int value of the byte at the file position defined by
self._base_offset + *base* + *offset*. If *base* is None, the byte is
read from the current position in the stream.
"""
fmt = 'B'
return self._read_int(fmt, b... | [
"def",
"read_byte",
"(",
"self",
",",
"base",
",",
"offset",
"=",
"0",
")",
":",
"fmt",
"=",
"'B'",
"return",
"self",
".",
"_read_int",
"(",
"fmt",
",",
"base",
",",
"offset",
")"
] | Return the int value of the byte at the file position defined by
self._base_offset + *base* + *offset*. If *base* is None, the byte is
read from the current position in the stream. | [
"Return",
"the",
"int",
"value",
"of",
"the",
"byte",
"at",
"the",
"file",
"position",
"defined",
"by",
"self",
".",
"_base_offset",
"+",
"*",
"base",
"*",
"+",
"*",
"offset",
"*",
".",
"If",
"*",
"base",
"*",
"is",
"None",
"the",
"byte",
"is",
"re... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/helpers.py#L34-L41 | train | Read a byte from the file and return it as an integer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/helpers.py | StreamReader.read_long | def read_long(self, base, offset=0):
"""
Return the int value of the four bytes at the file position defined by
self._base_offset + *base* + *offset*. If *base* is None, the long is
read from the current position in the stream. The endian setting of
this instance is used to inter... | python | def read_long(self, base, offset=0):
"""
Return the int value of the four bytes at the file position defined by
self._base_offset + *base* + *offset*. If *base* is None, the long is
read from the current position in the stream. The endian setting of
this instance is used to inter... | [
"def",
"read_long",
"(",
"self",
",",
"base",
",",
"offset",
"=",
"0",
")",
":",
"fmt",
"=",
"'<L'",
"if",
"self",
".",
"_byte_order",
"is",
"LITTLE_ENDIAN",
"else",
"'>L'",
"return",
"self",
".",
"_read_int",
"(",
"fmt",
",",
"base",
",",
"offset",
... | Return the int value of the four bytes at the file position defined by
self._base_offset + *base* + *offset*. If *base* is None, the long is
read from the current position in the stream. The endian setting of
this instance is used to interpret the byte layout of the long. | [
"Return",
"the",
"int",
"value",
"of",
"the",
"four",
"bytes",
"at",
"the",
"file",
"position",
"defined",
"by",
"self",
".",
"_base_offset",
"+",
"*",
"base",
"*",
"+",
"*",
"offset",
"*",
".",
"If",
"*",
"base",
"*",
"is",
"None",
"the",
"long",
... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/helpers.py#L43-L51 | train | Reads a long value from the stream. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/helpers.py | StreamReader.read_short | def read_short(self, base, offset=0):
"""
Return the int value of the two bytes at the file position determined
by *base* and *offset*, similarly to ``read_long()`` above.
"""
fmt = b'<H' if self._byte_order is LITTLE_ENDIAN else b'>H'
return self._read_int(fmt, base, off... | python | def read_short(self, base, offset=0):
"""
Return the int value of the two bytes at the file position determined
by *base* and *offset*, similarly to ``read_long()`` above.
"""
fmt = b'<H' if self._byte_order is LITTLE_ENDIAN else b'>H'
return self._read_int(fmt, base, off... | [
"def",
"read_short",
"(",
"self",
",",
"base",
",",
"offset",
"=",
"0",
")",
":",
"fmt",
"=",
"b'<H'",
"if",
"self",
".",
"_byte_order",
"is",
"LITTLE_ENDIAN",
"else",
"b'>H'",
"return",
"self",
".",
"_read_int",
"(",
"fmt",
",",
"base",
",",
"offset",... | Return the int value of the two bytes at the file position determined
by *base* and *offset*, similarly to ``read_long()`` above. | [
"Return",
"the",
"int",
"value",
"of",
"the",
"two",
"bytes",
"at",
"the",
"file",
"position",
"determined",
"by",
"*",
"base",
"*",
"and",
"*",
"offset",
"*",
"similarly",
"to",
"read_long",
"()",
"above",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/helpers.py#L53-L59 | train | Read a 2 byte short integer from the file and return it as a signed integer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/helpers.py | StreamReader.read_str | def read_str(self, char_count, base, offset=0):
"""
Return a string containing the *char_count* bytes at the file
position determined by self._base_offset + *base* + *offset*.
"""
def str_struct(char_count):
format_ = '%ds' % char_count
return Struct(forma... | python | def read_str(self, char_count, base, offset=0):
"""
Return a string containing the *char_count* bytes at the file
position determined by self._base_offset + *base* + *offset*.
"""
def str_struct(char_count):
format_ = '%ds' % char_count
return Struct(forma... | [
"def",
"read_str",
"(",
"self",
",",
"char_count",
",",
"base",
",",
"offset",
"=",
"0",
")",
":",
"def",
"str_struct",
"(",
"char_count",
")",
":",
"format_",
"=",
"'%ds'",
"%",
"char_count",
"return",
"Struct",
"(",
"format_",
")",
"struct",
"=",
"st... | Return a string containing the *char_count* bytes at the file
position determined by self._base_offset + *base* + *offset*. | [
"Return",
"a",
"string",
"containing",
"the",
"*",
"char_count",
"*",
"bytes",
"at",
"the",
"file",
"position",
"determined",
"by",
"self",
".",
"_base_offset",
"+",
"*",
"base",
"*",
"+",
"*",
"offset",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/helpers.py#L61-L72 | train | Read the string from the file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/package.py | Package._gather_image_parts | def _gather_image_parts(self):
"""Load the image part collection with all the image parts in package."""
for rel in self.iter_rels():
if rel.is_external:
continue
if rel.reltype != RT.IMAGE:
continue
if rel.target_part in self.image_par... | python | def _gather_image_parts(self):
"""Load the image part collection with all the image parts in package."""
for rel in self.iter_rels():
if rel.is_external:
continue
if rel.reltype != RT.IMAGE:
continue
if rel.target_part in self.image_par... | [
"def",
"_gather_image_parts",
"(",
"self",
")",
":",
"for",
"rel",
"in",
"self",
".",
"iter_rels",
"(",
")",
":",
"if",
"rel",
".",
"is_external",
":",
"continue",
"if",
"rel",
".",
"reltype",
"!=",
"RT",
".",
"IMAGE",
":",
"continue",
"if",
"rel",
"... | Load the image part collection with all the image parts in package. | [
"Load",
"the",
"image",
"part",
"collection",
"with",
"all",
"the",
"image",
"parts",
"in",
"package",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/package.py#L38-L47 | train | Load the image part collection with all the image parts in package. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/package.py | ImageParts.get_or_add_image_part | def get_or_add_image_part(self, image_descriptor):
"""Return |ImagePart| object containing image identified by *image_descriptor*.
The image-part is newly created if a matching one is not present in the
collection.
"""
image = Image.from_file(image_descriptor)
matching_i... | python | def get_or_add_image_part(self, image_descriptor):
"""Return |ImagePart| object containing image identified by *image_descriptor*.
The image-part is newly created if a matching one is not present in the
collection.
"""
image = Image.from_file(image_descriptor)
matching_i... | [
"def",
"get_or_add_image_part",
"(",
"self",
",",
"image_descriptor",
")",
":",
"image",
"=",
"Image",
".",
"from_file",
"(",
"image_descriptor",
")",
"matching_image_part",
"=",
"self",
".",
"_get_by_sha1",
"(",
"image",
".",
"sha1",
")",
"if",
"matching_image_... | Return |ImagePart| object containing image identified by *image_descriptor*.
The image-part is newly created if a matching one is not present in the
collection. | [
"Return",
"|ImagePart|",
"object",
"containing",
"image",
"identified",
"by",
"*",
"image_descriptor",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/package.py#L68-L78 | train | Return |ImagePart| object containing image identified by image_descriptor. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/package.py | ImageParts._add_image_part | def _add_image_part(self, image):
"""
Return an |ImagePart| instance newly created from image and appended
to the collection.
"""
partname = self._next_image_partname(image.ext)
image_part = ImagePart.from_image(image, partname)
self.append(image_part)
ret... | python | def _add_image_part(self, image):
"""
Return an |ImagePart| instance newly created from image and appended
to the collection.
"""
partname = self._next_image_partname(image.ext)
image_part = ImagePart.from_image(image, partname)
self.append(image_part)
ret... | [
"def",
"_add_image_part",
"(",
"self",
",",
"image",
")",
":",
"partname",
"=",
"self",
".",
"_next_image_partname",
"(",
"image",
".",
"ext",
")",
"image_part",
"=",
"ImagePart",
".",
"from_image",
"(",
"image",
",",
"partname",
")",
"self",
".",
"append"... | Return an |ImagePart| instance newly created from image and appended
to the collection. | [
"Return",
"an",
"|ImagePart|",
"instance",
"newly",
"created",
"from",
"image",
"and",
"appended",
"to",
"the",
"collection",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/package.py#L80-L88 | train | Add an |ImagePart| instance to the collection and return it appended. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/package.py | ImageParts._get_by_sha1 | def _get_by_sha1(self, sha1):
"""
Return the image part in this collection having a SHA1 hash matching
*sha1*, or |None| if not found.
"""
for image_part in self._image_parts:
if image_part.sha1 == sha1:
return image_part
return None | python | def _get_by_sha1(self, sha1):
"""
Return the image part in this collection having a SHA1 hash matching
*sha1*, or |None| if not found.
"""
for image_part in self._image_parts:
if image_part.sha1 == sha1:
return image_part
return None | [
"def",
"_get_by_sha1",
"(",
"self",
",",
"sha1",
")",
":",
"for",
"image_part",
"in",
"self",
".",
"_image_parts",
":",
"if",
"image_part",
".",
"sha1",
"==",
"sha1",
":",
"return",
"image_part",
"return",
"None"
] | Return the image part in this collection having a SHA1 hash matching
*sha1*, or |None| if not found. | [
"Return",
"the",
"image",
"part",
"in",
"this",
"collection",
"having",
"a",
"SHA1",
"hash",
"matching",
"*",
"sha1",
"*",
"or",
"|None|",
"if",
"not",
"found",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/package.py#L90-L98 | train | Return the image part with the given SHA1 hash or None if not found. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/section.py | _BaseHeaderFooter._get_or_add_definition | def _get_or_add_definition(self):
"""Return HeaderPart or FooterPart object for this section.
If this header/footer inherits its content, the part for the prior header/footer
is returned; this process continue recursively until a definition is found. If
the definition cannot be inherite... | python | def _get_or_add_definition(self):
"""Return HeaderPart or FooterPart object for this section.
If this header/footer inherits its content, the part for the prior header/footer
is returned; this process continue recursively until a definition is found. If
the definition cannot be inherite... | [
"def",
"_get_or_add_definition",
"(",
"self",
")",
":",
"# ---note this method is called recursively to access inherited definitions---",
"# ---case-1: definition is not inherited---",
"if",
"self",
".",
"_has_definition",
":",
"return",
"self",
".",
"_definition",
"# ---case-2: de... | Return HeaderPart or FooterPart object for this section.
If this header/footer inherits its content, the part for the prior header/footer
is returned; this process continue recursively until a definition is found. If
the definition cannot be inherited (because the header/footer belongs to the
... | [
"Return",
"HeaderPart",
"or",
"FooterPart",
"object",
"for",
"this",
"section",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/section.py#L325-L343 | train | Return HeaderPart or FooterPart object for this section. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/section.py | _Footer._add_definition | def _add_definition(self):
"""Return newly-added footer part."""
footer_part, rId = self._document_part.add_footer_part()
self._sectPr.add_footerReference(self._hdrftr_index, rId)
return footer_part | python | def _add_definition(self):
"""Return newly-added footer part."""
footer_part, rId = self._document_part.add_footer_part()
self._sectPr.add_footerReference(self._hdrftr_index, rId)
return footer_part | [
"def",
"_add_definition",
"(",
"self",
")",
":",
"footer_part",
",",
"rId",
"=",
"self",
".",
"_document_part",
".",
"add_footer_part",
"(",
")",
"self",
".",
"_sectPr",
".",
"add_footerReference",
"(",
"self",
".",
"_hdrftr_index",
",",
"rId",
")",
"return"... | Return newly-added footer part. | [
"Return",
"newly",
"-",
"added",
"footer",
"part",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/section.py#L369-L373 | train | Return newly - added footer part. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/section.py | _Footer._definition | def _definition(self):
"""|FooterPart| object containing content of this footer."""
footerReference = self._sectPr.get_footerReference(self._hdrftr_index)
return self._document_part.footer_part(footerReference.rId) | python | def _definition(self):
"""|FooterPart| object containing content of this footer."""
footerReference = self._sectPr.get_footerReference(self._hdrftr_index)
return self._document_part.footer_part(footerReference.rId) | [
"def",
"_definition",
"(",
"self",
")",
":",
"footerReference",
"=",
"self",
".",
"_sectPr",
".",
"get_footerReference",
"(",
"self",
".",
"_hdrftr_index",
")",
"return",
"self",
".",
"_document_part",
".",
"footer_part",
"(",
"footerReference",
".",
"rId",
")... | |FooterPart| object containing content of this footer. | [
"|FooterPart|",
"object",
"containing",
"content",
"of",
"this",
"footer",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/section.py#L376-L379 | train | Return |FooterPart| object containing content of this footer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/section.py | _Footer._drop_definition | def _drop_definition(self):
"""Remove footer definition (footer part) associated with this section."""
rId = self._sectPr.remove_footerReference(self._hdrftr_index)
self._document_part.drop_rel(rId) | python | def _drop_definition(self):
"""Remove footer definition (footer part) associated with this section."""
rId = self._sectPr.remove_footerReference(self._hdrftr_index)
self._document_part.drop_rel(rId) | [
"def",
"_drop_definition",
"(",
"self",
")",
":",
"rId",
"=",
"self",
".",
"_sectPr",
".",
"remove_footerReference",
"(",
"self",
".",
"_hdrftr_index",
")",
"self",
".",
"_document_part",
".",
"drop_rel",
"(",
"rId",
")"
] | Remove footer definition (footer part) associated with this section. | [
"Remove",
"footer",
"definition",
"(",
"footer",
"part",
")",
"associated",
"with",
"this",
"section",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/section.py#L381-L384 | train | Remove footer definition associated with this section. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/section.py | _Footer._has_definition | def _has_definition(self):
"""True if a footer is defined for this section."""
footerReference = self._sectPr.get_footerReference(self._hdrftr_index)
return False if footerReference is None else True | python | def _has_definition(self):
"""True if a footer is defined for this section."""
footerReference = self._sectPr.get_footerReference(self._hdrftr_index)
return False if footerReference is None else True | [
"def",
"_has_definition",
"(",
"self",
")",
":",
"footerReference",
"=",
"self",
".",
"_sectPr",
".",
"get_footerReference",
"(",
"self",
".",
"_hdrftr_index",
")",
"return",
"False",
"if",
"footerReference",
"is",
"None",
"else",
"True"
] | True if a footer is defined for this section. | [
"True",
"if",
"a",
"footer",
"is",
"defined",
"for",
"this",
"section",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/section.py#L387-L390 | train | True if a footer is defined for this section. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/section.py | _Footer._prior_headerfooter | def _prior_headerfooter(self):
"""|_Footer| proxy on prior sectPr element or None if this is first section."""
preceding_sectPr = self._sectPr.preceding_sectPr
return (
None if preceding_sectPr is None
else _Footer(preceding_sectPr, self._document_part, self._hdrftr_index... | python | def _prior_headerfooter(self):
"""|_Footer| proxy on prior sectPr element or None if this is first section."""
preceding_sectPr = self._sectPr.preceding_sectPr
return (
None if preceding_sectPr is None
else _Footer(preceding_sectPr, self._document_part, self._hdrftr_index... | [
"def",
"_prior_headerfooter",
"(",
"self",
")",
":",
"preceding_sectPr",
"=",
"self",
".",
"_sectPr",
".",
"preceding_sectPr",
"return",
"(",
"None",
"if",
"preceding_sectPr",
"is",
"None",
"else",
"_Footer",
"(",
"preceding_sectPr",
",",
"self",
".",
"_document... | |_Footer| proxy on prior sectPr element or None if this is first section. | [
"|_Footer|",
"proxy",
"on",
"prior",
"sectPr",
"element",
"or",
"None",
"if",
"this",
"is",
"first",
"section",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/section.py#L393-L399 | train | |_Footer| proxy on prior sectPr element or None. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/section.py | _Header._add_definition | def _add_definition(self):
"""Return newly-added header part."""
header_part, rId = self._document_part.add_header_part()
self._sectPr.add_headerReference(self._hdrftr_index, rId)
return header_part | python | def _add_definition(self):
"""Return newly-added header part."""
header_part, rId = self._document_part.add_header_part()
self._sectPr.add_headerReference(self._hdrftr_index, rId)
return header_part | [
"def",
"_add_definition",
"(",
"self",
")",
":",
"header_part",
",",
"rId",
"=",
"self",
".",
"_document_part",
".",
"add_header_part",
"(",
")",
"self",
".",
"_sectPr",
".",
"add_headerReference",
"(",
"self",
".",
"_hdrftr_index",
",",
"rId",
")",
"return"... | Return newly-added header part. | [
"Return",
"newly",
"-",
"added",
"header",
"part",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/section.py#L412-L416 | train | Add the definition of the section to the header part. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/section.py | _Header._definition | def _definition(self):
"""|HeaderPart| object containing content of this header."""
headerReference = self._sectPr.get_headerReference(self._hdrftr_index)
return self._document_part.header_part(headerReference.rId) | python | def _definition(self):
"""|HeaderPart| object containing content of this header."""
headerReference = self._sectPr.get_headerReference(self._hdrftr_index)
return self._document_part.header_part(headerReference.rId) | [
"def",
"_definition",
"(",
"self",
")",
":",
"headerReference",
"=",
"self",
".",
"_sectPr",
".",
"get_headerReference",
"(",
"self",
".",
"_hdrftr_index",
")",
"return",
"self",
".",
"_document_part",
".",
"header_part",
"(",
"headerReference",
".",
"rId",
")... | |HeaderPart| object containing content of this header. | [
"|HeaderPart|",
"object",
"containing",
"content",
"of",
"this",
"header",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/section.py#L419-L422 | train | Return the definition of the header. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/section.py | _Header._drop_definition | def _drop_definition(self):
"""Remove header definition associated with this section."""
rId = self._sectPr.remove_headerReference(self._hdrftr_index)
self._document_part.drop_header_part(rId) | python | def _drop_definition(self):
"""Remove header definition associated with this section."""
rId = self._sectPr.remove_headerReference(self._hdrftr_index)
self._document_part.drop_header_part(rId) | [
"def",
"_drop_definition",
"(",
"self",
")",
":",
"rId",
"=",
"self",
".",
"_sectPr",
".",
"remove_headerReference",
"(",
"self",
".",
"_hdrftr_index",
")",
"self",
".",
"_document_part",
".",
"drop_header_part",
"(",
"rId",
")"
] | Remove header definition associated with this section. | [
"Remove",
"header",
"definition",
"associated",
"with",
"this",
"section",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/section.py#L424-L427 | train | Remove header definition associated with this section. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/section.py | _Header._has_definition | def _has_definition(self):
"""True if a header is explicitly defined for this section."""
headerReference = self._sectPr.get_headerReference(self._hdrftr_index)
return False if headerReference is None else True | python | def _has_definition(self):
"""True if a header is explicitly defined for this section."""
headerReference = self._sectPr.get_headerReference(self._hdrftr_index)
return False if headerReference is None else True | [
"def",
"_has_definition",
"(",
"self",
")",
":",
"headerReference",
"=",
"self",
".",
"_sectPr",
".",
"get_headerReference",
"(",
"self",
".",
"_hdrftr_index",
")",
"return",
"False",
"if",
"headerReference",
"is",
"None",
"else",
"True"
] | True if a header is explicitly defined for this section. | [
"True",
"if",
"a",
"header",
"is",
"explicitly",
"defined",
"for",
"this",
"section",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/section.py#L430-L433 | train | True if a header is explicitly defined for this section. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/section.py | _Header._prior_headerfooter | def _prior_headerfooter(self):
"""|_Header| proxy on prior sectPr element or None if this is first section."""
preceding_sectPr = self._sectPr.preceding_sectPr
return (
None if preceding_sectPr is None
else _Header(preceding_sectPr, self._document_part, self._hdrftr_index... | python | def _prior_headerfooter(self):
"""|_Header| proxy on prior sectPr element or None if this is first section."""
preceding_sectPr = self._sectPr.preceding_sectPr
return (
None if preceding_sectPr is None
else _Header(preceding_sectPr, self._document_part, self._hdrftr_index... | [
"def",
"_prior_headerfooter",
"(",
"self",
")",
":",
"preceding_sectPr",
"=",
"self",
".",
"_sectPr",
".",
"preceding_sectPr",
"return",
"(",
"None",
"if",
"preceding_sectPr",
"is",
"None",
"else",
"_Header",
"(",
"preceding_sectPr",
",",
"self",
".",
"_document... | |_Header| proxy on prior sectPr element or None if this is first section. | [
"|_Header|",
"proxy",
"on",
"prior",
"sectPr",
"element",
"or",
"None",
"if",
"this",
"is",
"first",
"section",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/section.py#L436-L442 | train | |_Header| proxy on prior sectPr element or None. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/document.py | Document.add_heading | def add_heading(self, text="", level=1):
"""Return a heading paragraph newly added to the end of the document.
The heading paragraph will contain *text* and have its paragraph style
determined by *level*. If *level* is 0, the style is set to `Title`. If *level*
is 1 (or omitted), `Headi... | python | def add_heading(self, text="", level=1):
"""Return a heading paragraph newly added to the end of the document.
The heading paragraph will contain *text* and have its paragraph style
determined by *level*. If *level* is 0, the style is set to `Title`. If *level*
is 1 (or omitted), `Headi... | [
"def",
"add_heading",
"(",
"self",
",",
"text",
"=",
"\"\"",
",",
"level",
"=",
"1",
")",
":",
"if",
"not",
"0",
"<=",
"level",
"<=",
"9",
":",
"raise",
"ValueError",
"(",
"\"level must be in range 0-9, got %d\"",
"%",
"level",
")",
"style",
"=",
"\"Titl... | Return a heading paragraph newly added to the end of the document.
The heading paragraph will contain *text* and have its paragraph style
determined by *level*. If *level* is 0, the style is set to `Title`. If *level*
is 1 (or omitted), `Heading 1` is used. Otherwise the style is set to `Headin... | [
"Return",
"a",
"heading",
"paragraph",
"newly",
"added",
"to",
"the",
"end",
"of",
"the",
"document",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/document.py#L28-L39 | train | Return a heading paragraph newly added to the end of the document. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/document.py | Document.add_page_break | def add_page_break(self):
"""Return newly |Paragraph| object containing only a page break."""
paragraph = self.add_paragraph()
paragraph.add_run().add_break(WD_BREAK.PAGE)
return paragraph | python | def add_page_break(self):
"""Return newly |Paragraph| object containing only a page break."""
paragraph = self.add_paragraph()
paragraph.add_run().add_break(WD_BREAK.PAGE)
return paragraph | [
"def",
"add_page_break",
"(",
"self",
")",
":",
"paragraph",
"=",
"self",
".",
"add_paragraph",
"(",
")",
"paragraph",
".",
"add_run",
"(",
")",
".",
"add_break",
"(",
"WD_BREAK",
".",
"PAGE",
")",
"return",
"paragraph"
] | Return newly |Paragraph| object containing only a page break. | [
"Return",
"newly",
"|Paragraph|",
"object",
"containing",
"only",
"a",
"page",
"break",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/document.py#L41-L45 | train | Return newly |Paragraph| object containing only a page break. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/document.py | Document.add_picture | def add_picture(self, image_path_or_stream, width=None, height=None):
"""
Return a new picture shape added in its own paragraph at the end of
the document. The picture contains the image at
*image_path_or_stream*, scaled based on *width* and *height*. If
neither width nor height ... | python | def add_picture(self, image_path_or_stream, width=None, height=None):
"""
Return a new picture shape added in its own paragraph at the end of
the document. The picture contains the image at
*image_path_or_stream*, scaled based on *width* and *height*. If
neither width nor height ... | [
"def",
"add_picture",
"(",
"self",
",",
"image_path_or_stream",
",",
"width",
"=",
"None",
",",
"height",
"=",
"None",
")",
":",
"run",
"=",
"self",
".",
"add_paragraph",
"(",
")",
".",
"add_run",
"(",
")",
"return",
"run",
".",
"add_picture",
"(",
"im... | Return a new picture shape added in its own paragraph at the end of
the document. The picture contains the image at
*image_path_or_stream*, scaled based on *width* and *height*. If
neither width nor height is specified, the picture appears at its
native size. If only one is specified, it... | [
"Return",
"a",
"new",
"picture",
"shape",
"added",
"in",
"its",
"own",
"paragraph",
"at",
"the",
"end",
"of",
"the",
"document",
".",
"The",
"picture",
"contains",
"the",
"image",
"at",
"*",
"image_path_or_stream",
"*",
"scaled",
"based",
"on",
"*",
"width... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/document.py#L58-L72 | train | Add a picture shape to the document. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/document.py | Document.add_section | def add_section(self, start_type=WD_SECTION.NEW_PAGE):
"""
Return a |Section| object representing a new section added at the end
of the document. The optional *start_type* argument must be a member
of the :ref:`WdSectionStart` enumeration, and defaults to
``WD_SECTION.NEW_PAGE`` ... | python | def add_section(self, start_type=WD_SECTION.NEW_PAGE):
"""
Return a |Section| object representing a new section added at the end
of the document. The optional *start_type* argument must be a member
of the :ref:`WdSectionStart` enumeration, and defaults to
``WD_SECTION.NEW_PAGE`` ... | [
"def",
"add_section",
"(",
"self",
",",
"start_type",
"=",
"WD_SECTION",
".",
"NEW_PAGE",
")",
":",
"new_sectPr",
"=",
"self",
".",
"_element",
".",
"body",
".",
"add_section_break",
"(",
")",
"new_sectPr",
".",
"start_type",
"=",
"start_type",
"return",
"Se... | Return a |Section| object representing a new section added at the end
of the document. The optional *start_type* argument must be a member
of the :ref:`WdSectionStart` enumeration, and defaults to
``WD_SECTION.NEW_PAGE`` if not provided. | [
"Return",
"a",
"|Section|",
"object",
"representing",
"a",
"new",
"section",
"added",
"at",
"the",
"end",
"of",
"the",
"document",
".",
"The",
"optional",
"*",
"start_type",
"*",
"argument",
"must",
"be",
"a",
"member",
"of",
"the",
":",
"ref",
":",
"WdS... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/document.py#L74-L83 | train | Add a new section to the end of the document. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/document.py | Document.add_table | def add_table(self, rows, cols, style=None):
"""
Add a table having row and column counts of *rows* and *cols*
respectively and table style of *style*. *style* may be a paragraph
style object or a paragraph style name. If *style* is |None|, the
table inherits the default table st... | python | def add_table(self, rows, cols, style=None):
"""
Add a table having row and column counts of *rows* and *cols*
respectively and table style of *style*. *style* may be a paragraph
style object or a paragraph style name. If *style* is |None|, the
table inherits the default table st... | [
"def",
"add_table",
"(",
"self",
",",
"rows",
",",
"cols",
",",
"style",
"=",
"None",
")",
":",
"table",
"=",
"self",
".",
"_body",
".",
"add_table",
"(",
"rows",
",",
"cols",
",",
"self",
".",
"_block_width",
")",
"table",
".",
"style",
"=",
"styl... | Add a table having row and column counts of *rows* and *cols*
respectively and table style of *style*. *style* may be a paragraph
style object or a paragraph style name. If *style* is |None|, the
table inherits the default table style of the document. | [
"Add",
"a",
"table",
"having",
"row",
"and",
"column",
"counts",
"of",
"*",
"rows",
"*",
"and",
"*",
"cols",
"*",
"respectively",
"and",
"table",
"style",
"of",
"*",
"style",
"*",
".",
"*",
"style",
"*",
"may",
"be",
"a",
"paragraph",
"style",
"objec... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/document.py#L85-L94 | train | Add a new table to the document. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/document.py | Document._block_width | def _block_width(self):
"""
Return a |Length| object specifying the width of available "writing"
space between the margins of the last section of this document.
"""
section = self.sections[-1]
return Emu(
section.page_width - section.left_margin - section.righ... | python | def _block_width(self):
"""
Return a |Length| object specifying the width of available "writing"
space between the margins of the last section of this document.
"""
section = self.sections[-1]
return Emu(
section.page_width - section.left_margin - section.righ... | [
"def",
"_block_width",
"(",
"self",
")",
":",
"section",
"=",
"self",
".",
"sections",
"[",
"-",
"1",
"]",
"return",
"Emu",
"(",
"section",
".",
"page_width",
"-",
"section",
".",
"left_margin",
"-",
"section",
".",
"right_margin",
")"
] | Return a |Length| object specifying the width of available "writing"
space between the margins of the last section of this document. | [
"Return",
"a",
"|Length|",
"object",
"specifying",
"the",
"width",
"of",
"available",
"writing",
"space",
"between",
"the",
"margins",
"of",
"the",
"last",
"section",
"of",
"this",
"document",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/document.py#L169-L177 | train | Return a |Length| object specifying the width of available writing space between the margins of the last section of this document. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/document.py | Document._body | def _body(self):
"""
The |_Body| instance containing the content for this document.
"""
if self.__body is None:
self.__body = _Body(self._element.body, self)
return self.__body | python | def _body(self):
"""
The |_Body| instance containing the content for this document.
"""
if self.__body is None:
self.__body = _Body(self._element.body, self)
return self.__body | [
"def",
"_body",
"(",
"self",
")",
":",
"if",
"self",
".",
"__body",
"is",
"None",
":",
"self",
".",
"__body",
"=",
"_Body",
"(",
"self",
".",
"_element",
".",
"body",
",",
"self",
")",
"return",
"self",
".",
"__body"
] | The |_Body| instance containing the content for this document. | [
"The",
"|_Body|",
"instance",
"containing",
"the",
"content",
"for",
"this",
"document",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/document.py#L180-L186 | train | Return |_Body| instance containing the content for this document. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/__init__.py | register_element_cls | def register_element_cls(tag, cls):
"""
Register *cls* to be constructed when the oxml parser encounters an
element with matching *tag*. *tag* is a string of the form
``nspfx:tagroot``, e.g. ``'w:document'``.
"""
nspfx, tagroot = tag.split(':')
namespace = element_class_lookup.get_namespace(... | python | def register_element_cls(tag, cls):
"""
Register *cls* to be constructed when the oxml parser encounters an
element with matching *tag*. *tag* is a string of the form
``nspfx:tagroot``, e.g. ``'w:document'``.
"""
nspfx, tagroot = tag.split(':')
namespace = element_class_lookup.get_namespace(... | [
"def",
"register_element_cls",
"(",
"tag",
",",
"cls",
")",
":",
"nspfx",
",",
"tagroot",
"=",
"tag",
".",
"split",
"(",
"':'",
")",
"namespace",
"=",
"element_class_lookup",
".",
"get_namespace",
"(",
"nsmap",
"[",
"nspfx",
"]",
")",
"namespace",
"[",
"... | Register *cls* to be constructed when the oxml parser encounters an
element with matching *tag*. *tag* is a string of the form
``nspfx:tagroot``, e.g. ``'w:document'``. | [
"Register",
"*",
"cls",
"*",
"to",
"be",
"constructed",
"when",
"the",
"oxml",
"parser",
"encounters",
"an",
"element",
"with",
"matching",
"*",
"tag",
"*",
".",
"*",
"tag",
"*",
"is",
"a",
"string",
"of",
"the",
"form",
"nspfx",
":",
"tagroot",
"e",
... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/__init__.py#L32-L40 | train | Register cls to be constructed when the oxml parser encounters an analyzed element with matching tag. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/__init__.py | OxmlElement | def OxmlElement(nsptag_str, attrs=None, nsdecls=None):
"""
Return a 'loose' lxml element having the tag specified by *nsptag_str*.
*nsptag_str* must contain the standard namespace prefix, e.g. 'a:tbl'.
The resulting element is an instance of the custom element class for this
tag name if one is defin... | python | def OxmlElement(nsptag_str, attrs=None, nsdecls=None):
"""
Return a 'loose' lxml element having the tag specified by *nsptag_str*.
*nsptag_str* must contain the standard namespace prefix, e.g. 'a:tbl'.
The resulting element is an instance of the custom element class for this
tag name if one is defin... | [
"def",
"OxmlElement",
"(",
"nsptag_str",
",",
"attrs",
"=",
"None",
",",
"nsdecls",
"=",
"None",
")",
":",
"nsptag",
"=",
"NamespacePrefixedTag",
"(",
"nsptag_str",
")",
"if",
"nsdecls",
"is",
"None",
":",
"nsdecls",
"=",
"nsptag",
".",
"nsmap",
"return",
... | Return a 'loose' lxml element having the tag specified by *nsptag_str*.
*nsptag_str* must contain the standard namespace prefix, e.g. 'a:tbl'.
The resulting element is an instance of the custom element class for this
tag name if one is defined. A dictionary of attribute values may be
provided as *attrs*... | [
"Return",
"a",
"loose",
"lxml",
"element",
"having",
"the",
"tag",
"specified",
"by",
"*",
"nsptag_str",
"*",
".",
"*",
"nsptag_str",
"*",
"must",
"contain",
"the",
"standard",
"namespace",
"prefix",
"e",
".",
"g",
".",
"a",
":",
"tbl",
".",
"The",
"re... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/__init__.py#L43-L60 | train | Return a loose lxml element with the specified tag specified by nsptag_str. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/tiff.py | _IfdEntryFactory | def _IfdEntryFactory(stream_rdr, offset):
"""
Return an |_IfdEntry| subclass instance containing the value of the
directory entry at *offset* in *stream_rdr*.
"""
ifd_entry_classes = {
TIFF_FLD.ASCII: _AsciiIfdEntry,
TIFF_FLD.SHORT: _ShortIfdEntry,
TIFF_FLD.LONG: _L... | python | def _IfdEntryFactory(stream_rdr, offset):
"""
Return an |_IfdEntry| subclass instance containing the value of the
directory entry at *offset* in *stream_rdr*.
"""
ifd_entry_classes = {
TIFF_FLD.ASCII: _AsciiIfdEntry,
TIFF_FLD.SHORT: _ShortIfdEntry,
TIFF_FLD.LONG: _L... | [
"def",
"_IfdEntryFactory",
"(",
"stream_rdr",
",",
"offset",
")",
":",
"ifd_entry_classes",
"=",
"{",
"TIFF_FLD",
".",
"ASCII",
":",
"_AsciiIfdEntry",
",",
"TIFF_FLD",
".",
"SHORT",
":",
"_ShortIfdEntry",
",",
"TIFF_FLD",
".",
"LONG",
":",
"_LongIfdEntry",
","... | Return an |_IfdEntry| subclass instance containing the value of the
directory entry at *offset* in *stream_rdr*. | [
"Return",
"an",
"|_IfdEntry|",
"subclass",
"instance",
"containing",
"the",
"value",
"of",
"the",
"directory",
"entry",
"at",
"*",
"offset",
"*",
"in",
"*",
"stream_rdr",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/tiff.py#L215-L231 | train | Return an |_IfdEntry| subclass instance containing the value of the
directory entry at offset in stream_rdr. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/tiff.py | Tiff.from_stream | def from_stream(cls, stream):
"""
Return a |Tiff| instance containing the properties of the TIFF image
in *stream*.
"""
parser = _TiffParser.parse(stream)
px_width = parser.px_width
px_height = parser.px_height
horz_dpi = parser.horz_dpi
vert_dpi ... | python | def from_stream(cls, stream):
"""
Return a |Tiff| instance containing the properties of the TIFF image
in *stream*.
"""
parser = _TiffParser.parse(stream)
px_width = parser.px_width
px_height = parser.px_height
horz_dpi = parser.horz_dpi
vert_dpi ... | [
"def",
"from_stream",
"(",
"cls",
",",
"stream",
")",
":",
"parser",
"=",
"_TiffParser",
".",
"parse",
"(",
"stream",
")",
"px_width",
"=",
"parser",
".",
"px_width",
"px_height",
"=",
"parser",
".",
"px_height",
"horz_dpi",
"=",
"parser",
".",
"horz_dpi",... | Return a |Tiff| instance containing the properties of the TIFF image
in *stream*. | [
"Return",
"a",
"|Tiff|",
"instance",
"containing",
"the",
"properties",
"of",
"the",
"TIFF",
"image",
"in",
"*",
"stream",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/tiff.py#L31-L43 | train | Create a |Tiff| instance from a file - like object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/tiff.py | _TiffParser.parse | def parse(cls, stream):
"""
Return an instance of |_TiffParser| containing the properties parsed
from the TIFF image in *stream*.
"""
stream_rdr = cls._make_stream_reader(stream)
ifd0_offset = stream_rdr.read_long(4)
ifd_entries = _IfdEntries.from_stream(stream_rd... | python | def parse(cls, stream):
"""
Return an instance of |_TiffParser| containing the properties parsed
from the TIFF image in *stream*.
"""
stream_rdr = cls._make_stream_reader(stream)
ifd0_offset = stream_rdr.read_long(4)
ifd_entries = _IfdEntries.from_stream(stream_rd... | [
"def",
"parse",
"(",
"cls",
",",
"stream",
")",
":",
"stream_rdr",
"=",
"cls",
".",
"_make_stream_reader",
"(",
"stream",
")",
"ifd0_offset",
"=",
"stream_rdr",
".",
"read_long",
"(",
"4",
")",
"ifd_entries",
"=",
"_IfdEntries",
".",
"from_stream",
"(",
"s... | Return an instance of |_TiffParser| containing the properties parsed
from the TIFF image in *stream*. | [
"Return",
"an",
"instance",
"of",
"|_TiffParser|",
"containing",
"the",
"properties",
"parsed",
"from",
"the",
"TIFF",
"image",
"in",
"*",
"stream",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/tiff.py#L56-L64 | train | Parse the TIFF image in the given stream. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/tiff.py | _TiffParser._detect_endian | def _detect_endian(cls, stream):
"""
Return either BIG_ENDIAN or LITTLE_ENDIAN depending on the endian
indicator found in the TIFF *stream* header, either 'MM' or 'II'.
"""
stream.seek(0)
endian_str = stream.read(2)
return BIG_ENDIAN if endian_str == b'MM' else LI... | python | def _detect_endian(cls, stream):
"""
Return either BIG_ENDIAN or LITTLE_ENDIAN depending on the endian
indicator found in the TIFF *stream* header, either 'MM' or 'II'.
"""
stream.seek(0)
endian_str = stream.read(2)
return BIG_ENDIAN if endian_str == b'MM' else LI... | [
"def",
"_detect_endian",
"(",
"cls",
",",
"stream",
")",
":",
"stream",
".",
"seek",
"(",
"0",
")",
"endian_str",
"=",
"stream",
".",
"read",
"(",
"2",
")",
"return",
"BIG_ENDIAN",
"if",
"endian_str",
"==",
"b'MM'",
"else",
"LITTLE_ENDIAN"
] | Return either BIG_ENDIAN or LITTLE_ENDIAN depending on the endian
indicator found in the TIFF *stream* header, either 'MM' or 'II'. | [
"Return",
"either",
"BIG_ENDIAN",
"or",
"LITTLE_ENDIAN",
"depending",
"on",
"the",
"endian",
"indicator",
"found",
"in",
"the",
"TIFF",
"*",
"stream",
"*",
"header",
"either",
"MM",
"or",
"II",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/tiff.py#L103-L110 | train | Detect the endian of the TIFF header. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/tiff.py | _TiffParser._dpi | def _dpi(self, resolution_tag):
"""
Return the dpi value calculated for *resolution_tag*, which can be
either TIFF_TAG.X_RESOLUTION or TIFF_TAG.Y_RESOLUTION. The
calculation is based on the values of both that tag and the
TIFF_TAG.RESOLUTION_UNIT tag in this parser's |_IfdEntries... | python | def _dpi(self, resolution_tag):
"""
Return the dpi value calculated for *resolution_tag*, which can be
either TIFF_TAG.X_RESOLUTION or TIFF_TAG.Y_RESOLUTION. The
calculation is based on the values of both that tag and the
TIFF_TAG.RESOLUTION_UNIT tag in this parser's |_IfdEntries... | [
"def",
"_dpi",
"(",
"self",
",",
"resolution_tag",
")",
":",
"ifd_entries",
"=",
"self",
".",
"_ifd_entries",
"if",
"resolution_tag",
"not",
"in",
"ifd_entries",
":",
"return",
"72",
"# resolution unit defaults to inches (2)",
"resolution_unit",
"=",
"(",
"ifd_entri... | Return the dpi value calculated for *resolution_tag*, which can be
either TIFF_TAG.X_RESOLUTION or TIFF_TAG.Y_RESOLUTION. The
calculation is based on the values of both that tag and the
TIFF_TAG.RESOLUTION_UNIT tag in this parser's |_IfdEntries| instance. | [
"Return",
"the",
"dpi",
"value",
"calculated",
"for",
"*",
"resolution_tag",
"*",
"which",
"can",
"be",
"either",
"TIFF_TAG",
".",
"X_RESOLUTION",
"or",
"TIFF_TAG",
".",
"Y_RESOLUTION",
".",
"The",
"calculation",
"is",
"based",
"on",
"the",
"values",
"of",
"... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/tiff.py#L112-L135 | train | Return the dpi value for the given resolution tag. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/tiff.py | _TiffParser._make_stream_reader | def _make_stream_reader(cls, stream):
"""
Return a |StreamReader| instance with wrapping *stream* and having
"endian-ness" determined by the 'MM' or 'II' indicator in the TIFF
stream header.
"""
endian = cls._detect_endian(stream)
return StreamReader(stream, endia... | python | def _make_stream_reader(cls, stream):
"""
Return a |StreamReader| instance with wrapping *stream* and having
"endian-ness" determined by the 'MM' or 'II' indicator in the TIFF
stream header.
"""
endian = cls._detect_endian(stream)
return StreamReader(stream, endia... | [
"def",
"_make_stream_reader",
"(",
"cls",
",",
"stream",
")",
":",
"endian",
"=",
"cls",
".",
"_detect_endian",
"(",
"stream",
")",
"return",
"StreamReader",
"(",
"stream",
",",
"endian",
")"
] | Return a |StreamReader| instance with wrapping *stream* and having
"endian-ness" determined by the 'MM' or 'II' indicator in the TIFF
stream header. | [
"Return",
"a",
"|StreamReader|",
"instance",
"with",
"wrapping",
"*",
"stream",
"*",
"and",
"having",
"endian",
"-",
"ness",
"determined",
"by",
"the",
"MM",
"or",
"II",
"indicator",
"in",
"the",
"TIFF",
"stream",
"header",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/tiff.py#L138-L145 | train | Return a |StreamReader| instance with wrapping stream and having
"endian -ness determined by the MM or II indicator in the TIFF
stream header. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/tiff.py | _IfdEntries.from_stream | def from_stream(cls, stream, offset):
"""
Return a new |_IfdEntries| instance parsed from *stream* starting at
*offset*.
"""
ifd_parser = _IfdParser(stream, offset)
entries = dict((e.tag, e.value) for e in ifd_parser.iter_entries())
return cls(entries) | python | def from_stream(cls, stream, offset):
"""
Return a new |_IfdEntries| instance parsed from *stream* starting at
*offset*.
"""
ifd_parser = _IfdParser(stream, offset)
entries = dict((e.tag, e.value) for e in ifd_parser.iter_entries())
return cls(entries) | [
"def",
"from_stream",
"(",
"cls",
",",
"stream",
",",
"offset",
")",
":",
"ifd_parser",
"=",
"_IfdParser",
"(",
"stream",
",",
"offset",
")",
"entries",
"=",
"dict",
"(",
"(",
"e",
".",
"tag",
",",
"e",
".",
"value",
")",
"for",
"e",
"in",
"ifd_par... | Return a new |_IfdEntries| instance parsed from *stream* starting at
*offset*. | [
"Return",
"a",
"new",
"|_IfdEntries|",
"instance",
"parsed",
"from",
"*",
"stream",
"*",
"starting",
"at",
"*",
"offset",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/tiff.py#L170-L177 | train | Parse an IfdEntries object from a stream starting at the given offset. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/tiff.py | _IfdParser.iter_entries | def iter_entries(self):
"""
Generate an |_IfdEntry| instance corresponding to each entry in the
directory.
"""
for idx in range(self._entry_count):
dir_entry_offset = self._offset + 2 + (idx*12)
ifd_entry = _IfdEntryFactory(self._stream_rdr, dir_entry_offs... | python | def iter_entries(self):
"""
Generate an |_IfdEntry| instance corresponding to each entry in the
directory.
"""
for idx in range(self._entry_count):
dir_entry_offset = self._offset + 2 + (idx*12)
ifd_entry = _IfdEntryFactory(self._stream_rdr, dir_entry_offs... | [
"def",
"iter_entries",
"(",
"self",
")",
":",
"for",
"idx",
"in",
"range",
"(",
"self",
".",
"_entry_count",
")",
":",
"dir_entry_offset",
"=",
"self",
".",
"_offset",
"+",
"2",
"+",
"(",
"idx",
"*",
"12",
")",
"ifd_entry",
"=",
"_IfdEntryFactory",
"("... | Generate an |_IfdEntry| instance corresponding to each entry in the
directory. | [
"Generate",
"an",
"|_IfdEntry|",
"instance",
"corresponding",
"to",
"each",
"entry",
"in",
"the",
"directory",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/tiff.py#L197-L205 | train | Iterates over the entries in the ISO. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/tiff.py | _IfdEntry.from_stream | def from_stream(cls, stream_rdr, offset):
"""
Return an |_IfdEntry| subclass instance containing the tag and value
of the tag parsed from *stream_rdr* at *offset*. Note this method is
common to all subclasses. Override the ``_parse_value()`` method to
provide distinctive behavior... | python | def from_stream(cls, stream_rdr, offset):
"""
Return an |_IfdEntry| subclass instance containing the tag and value
of the tag parsed from *stream_rdr* at *offset*. Note this method is
common to all subclasses. Override the ``_parse_value()`` method to
provide distinctive behavior... | [
"def",
"from_stream",
"(",
"cls",
",",
"stream_rdr",
",",
"offset",
")",
":",
"tag_code",
"=",
"stream_rdr",
".",
"read_short",
"(",
"offset",
",",
"0",
")",
"value_count",
"=",
"stream_rdr",
".",
"read_long",
"(",
"offset",
",",
"4",
")",
"value_offset",
... | Return an |_IfdEntry| subclass instance containing the tag and value
of the tag parsed from *stream_rdr* at *offset*. Note this method is
common to all subclasses. Override the ``_parse_value()`` method to
provide distinctive behavior based on field type. | [
"Return",
"an",
"|_IfdEntry|",
"subclass",
"instance",
"containing",
"the",
"tag",
"and",
"value",
"of",
"the",
"tag",
"parsed",
"from",
"*",
"stream_rdr",
"*",
"at",
"*",
"offset",
"*",
".",
"Note",
"this",
"method",
"is",
"common",
"to",
"all",
"subclass... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/tiff.py#L245-L258 | train | Parse an entry from a stream. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/tiff.py | _AsciiIfdEntry._parse_value | def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
"""
Return the ASCII string parsed from *stream_rdr* at *value_offset*.
The length of the string, including a terminating '\x00' (NUL)
character, is in *value_count*.
"""
return stream_rdr.read_str(valu... | python | def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
"""
Return the ASCII string parsed from *stream_rdr* at *value_offset*.
The length of the string, including a terminating '\x00' (NUL)
character, is in *value_count*.
"""
return stream_rdr.read_str(valu... | [
"def",
"_parse_value",
"(",
"cls",
",",
"stream_rdr",
",",
"offset",
",",
"value_count",
",",
"value_offset",
")",
":",
"return",
"stream_rdr",
".",
"read_str",
"(",
"value_count",
"-",
"1",
",",
"value_offset",
")"
] | Return the ASCII string parsed from *stream_rdr* at *value_offset*.
The length of the string, including a terminating '\x00' (NUL)
character, is in *value_count*. | [
"Return",
"the",
"ASCII",
"string",
"parsed",
"from",
"*",
"stream_rdr",
"*",
"at",
"*",
"value_offset",
"*",
".",
"The",
"length",
"of",
"the",
"string",
"including",
"a",
"terminating",
"\\",
"x00",
"(",
"NUL",
")",
"character",
"is",
"in",
"*",
"value... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/tiff.py#L288-L294 | train | Parse a value from the stream_rdr at the given offset. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/tiff.py | _ShortIfdEntry._parse_value | def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
"""
Return the short int value contained in the *value_offset* field of
this entry. Only supports single values at present.
"""
if value_count == 1:
return stream_rdr.read_short(offset, 8)
e... | python | def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
"""
Return the short int value contained in the *value_offset* field of
this entry. Only supports single values at present.
"""
if value_count == 1:
return stream_rdr.read_short(offset, 8)
e... | [
"def",
"_parse_value",
"(",
"cls",
",",
"stream_rdr",
",",
"offset",
",",
"value_count",
",",
"value_offset",
")",
":",
"if",
"value_count",
"==",
"1",
":",
"return",
"stream_rdr",
".",
"read_short",
"(",
"offset",
",",
"8",
")",
"else",
":",
"# pragma: no... | Return the short int value contained in the *value_offset* field of
this entry. Only supports single values at present. | [
"Return",
"the",
"short",
"int",
"value",
"contained",
"in",
"the",
"*",
"value_offset",
"*",
"field",
"of",
"this",
"entry",
".",
"Only",
"supports",
"single",
"values",
"at",
"present",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/tiff.py#L302-L310 | train | Parse the value of the entry. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/tiff.py | _LongIfdEntry._parse_value | def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
"""
Return the long int value contained in the *value_offset* field of
this entry. Only supports single values at present.
"""
if value_count == 1:
return stream_rdr.read_long(offset, 8)
els... | python | def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
"""
Return the long int value contained in the *value_offset* field of
this entry. Only supports single values at present.
"""
if value_count == 1:
return stream_rdr.read_long(offset, 8)
els... | [
"def",
"_parse_value",
"(",
"cls",
",",
"stream_rdr",
",",
"offset",
",",
"value_count",
",",
"value_offset",
")",
":",
"if",
"value_count",
"==",
"1",
":",
"return",
"stream_rdr",
".",
"read_long",
"(",
"offset",
",",
"8",
")",
"else",
":",
"# pragma: no ... | Return the long int value contained in the *value_offset* field of
this entry. Only supports single values at present. | [
"Return",
"the",
"long",
"int",
"value",
"contained",
"in",
"the",
"*",
"value_offset",
"*",
"field",
"of",
"this",
"entry",
".",
"Only",
"supports",
"single",
"values",
"at",
"present",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/tiff.py#L318-L326 | train | Parse the value of the entry. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/tiff.py | _RationalIfdEntry._parse_value | def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
"""
Return the rational (numerator / denominator) value at *value_offset*
in *stream_rdr* as a floating-point number. Only supports single
values at present.
"""
if value_count == 1:
numerat... | python | def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
"""
Return the rational (numerator / denominator) value at *value_offset*
in *stream_rdr* as a floating-point number. Only supports single
values at present.
"""
if value_count == 1:
numerat... | [
"def",
"_parse_value",
"(",
"cls",
",",
"stream_rdr",
",",
"offset",
",",
"value_count",
",",
"value_offset",
")",
":",
"if",
"value_count",
"==",
"1",
":",
"numerator",
"=",
"stream_rdr",
".",
"read_long",
"(",
"value_offset",
")",
"denominator",
"=",
"stre... | Return the rational (numerator / denominator) value at *value_offset*
in *stream_rdr* as a floating-point number. Only supports single
values at present. | [
"Return",
"the",
"rational",
"(",
"numerator",
"/",
"denominator",
")",
"value",
"at",
"*",
"value_offset",
"*",
"in",
"*",
"stream_rdr",
"*",
"as",
"a",
"floating",
"-",
"point",
"number",
".",
"Only",
"supports",
"single",
"values",
"at",
"present",
"."
... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/tiff.py#L334-L345 | train | Parse a value from the stream. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/parts/document.py | DocumentPart.add_footer_part | def add_footer_part(self):
"""Return (footer_part, rId) pair for newly-created footer part."""
footer_part = FooterPart.new(self.package)
rId = self.relate_to(footer_part, RT.FOOTER)
return footer_part, rId | python | def add_footer_part(self):
"""Return (footer_part, rId) pair for newly-created footer part."""
footer_part = FooterPart.new(self.package)
rId = self.relate_to(footer_part, RT.FOOTER)
return footer_part, rId | [
"def",
"add_footer_part",
"(",
"self",
")",
":",
"footer_part",
"=",
"FooterPart",
".",
"new",
"(",
"self",
".",
"package",
")",
"rId",
"=",
"self",
".",
"relate_to",
"(",
"footer_part",
",",
"RT",
".",
"FOOTER",
")",
"return",
"footer_part",
",",
"rId"
... | Return (footer_part, rId) pair for newly-created footer part. | [
"Return",
"(",
"footer_part",
"rId",
")",
"pair",
"for",
"newly",
"-",
"created",
"footer",
"part",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/document.py#L27-L31 | train | Return ( footer_part rId ) pair for newly - created footer part. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/parts/document.py | DocumentPart.add_header_part | def add_header_part(self):
"""Return (header_part, rId) pair for newly-created header part."""
header_part = HeaderPart.new(self.package)
rId = self.relate_to(header_part, RT.HEADER)
return header_part, rId | python | def add_header_part(self):
"""Return (header_part, rId) pair for newly-created header part."""
header_part = HeaderPart.new(self.package)
rId = self.relate_to(header_part, RT.HEADER)
return header_part, rId | [
"def",
"add_header_part",
"(",
"self",
")",
":",
"header_part",
"=",
"HeaderPart",
".",
"new",
"(",
"self",
".",
"package",
")",
"rId",
"=",
"self",
".",
"relate_to",
"(",
"header_part",
",",
"RT",
".",
"HEADER",
")",
"return",
"header_part",
",",
"rId"
... | Return (header_part, rId) pair for newly-created header part. | [
"Return",
"(",
"header_part",
"rId",
")",
"pair",
"for",
"newly",
"-",
"created",
"header",
"part",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/document.py#L33-L37 | train | Return ( header_part rId ) pair for newly - created header part. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/parts/document.py | DocumentPart.numbering_part | def numbering_part(self):
"""
A |NumberingPart| object providing access to the numbering
definitions for this document. Creates an empty numbering part if one
is not present.
"""
try:
return self.part_related_by(RT.NUMBERING)
except KeyError:
... | python | def numbering_part(self):
"""
A |NumberingPart| object providing access to the numbering
definitions for this document. Creates an empty numbering part if one
is not present.
"""
try:
return self.part_related_by(RT.NUMBERING)
except KeyError:
... | [
"def",
"numbering_part",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"part_related_by",
"(",
"RT",
".",
"NUMBERING",
")",
"except",
"KeyError",
":",
"numbering_part",
"=",
"NumberingPart",
".",
"new",
"(",
")",
"self",
".",
"relate_to",
"(",
... | A |NumberingPart| object providing access to the numbering
definitions for this document. Creates an empty numbering part if one
is not present. | [
"A",
"|NumberingPart|",
"object",
"providing",
"access",
"to",
"the",
"numbering",
"definitions",
"for",
"this",
"document",
".",
"Creates",
"an",
"empty",
"numbering",
"part",
"if",
"one",
"is",
"not",
"present",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/document.py#L93-L104 | train | A |NumberingPart| object providing access to the numbering part definitions for this document. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/parts/document.py | DocumentPart._settings_part | def _settings_part(self):
"""
A |SettingsPart| object providing access to the document-level
settings for this document. Creates a default settings part if one is
not present.
"""
try:
return self.part_related_by(RT.SETTINGS)
except KeyError:
... | python | def _settings_part(self):
"""
A |SettingsPart| object providing access to the document-level
settings for this document. Creates a default settings part if one is
not present.
"""
try:
return self.part_related_by(RT.SETTINGS)
except KeyError:
... | [
"def",
"_settings_part",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"part_related_by",
"(",
"RT",
".",
"SETTINGS",
")",
"except",
"KeyError",
":",
"settings_part",
"=",
"SettingsPart",
".",
"default",
"(",
"self",
".",
"package",
")",
"self"... | A |SettingsPart| object providing access to the document-level
settings for this document. Creates a default settings part if one is
not present. | [
"A",
"|SettingsPart|",
"object",
"providing",
"access",
"to",
"the",
"document",
"-",
"level",
"settings",
"for",
"this",
"document",
".",
"Creates",
"a",
"default",
"settings",
"part",
"if",
"one",
"is",
"not",
"present",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/document.py#L130-L141 | train | A |SettingsPart| object providing access to the document - level
settings for this document. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/parts/document.py | DocumentPart._styles_part | def _styles_part(self):
"""
Instance of |StylesPart| for this document. Creates an empty styles
part if one is not present.
"""
try:
return self.part_related_by(RT.STYLES)
except KeyError:
styles_part = StylesPart.default(self.package)
... | python | def _styles_part(self):
"""
Instance of |StylesPart| for this document. Creates an empty styles
part if one is not present.
"""
try:
return self.part_related_by(RT.STYLES)
except KeyError:
styles_part = StylesPart.default(self.package)
... | [
"def",
"_styles_part",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"part_related_by",
"(",
"RT",
".",
"STYLES",
")",
"except",
"KeyError",
":",
"styles_part",
"=",
"StylesPart",
".",
"default",
"(",
"self",
".",
"package",
")",
"self",
".",... | Instance of |StylesPart| for this document. Creates an empty styles
part if one is not present. | [
"Instance",
"of",
"|StylesPart|",
"for",
"this",
"document",
".",
"Creates",
"an",
"empty",
"styles",
"part",
"if",
"one",
"is",
"not",
"present",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/document.py#L144-L154 | train | Returns |StylesPart| instance for this document. Creates an empty stylesPart part if one is not present. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | setup.py | text_of | def text_of(relpath):
"""
Return string containing the contents of the file at *relpath* relative to
this file.
"""
thisdir = os.path.dirname(__file__)
file_path = os.path.join(thisdir, os.path.normpath(relpath))
with open(file_path) as f:
text = f.read()
return text | python | def text_of(relpath):
"""
Return string containing the contents of the file at *relpath* relative to
this file.
"""
thisdir = os.path.dirname(__file__)
file_path = os.path.join(thisdir, os.path.normpath(relpath))
with open(file_path) as f:
text = f.read()
return text | [
"def",
"text_of",
"(",
"relpath",
")",
":",
"thisdir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
"file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"thisdir",
",",
"os",
".",
"path",
".",
"normpath",
"(",
"relpath",
")",
")"... | Return string containing the contents of the file at *relpath* relative to
this file. | [
"Return",
"string",
"containing",
"the",
"contents",
"of",
"the",
"file",
"at",
"*",
"relpath",
"*",
"relative",
"to",
"this",
"file",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/setup.py#L9-L18 | train | Return the contents of the file at relpath relative to
this file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/opc/pkgwriter.py | PackageWriter.write | def write(pkg_file, pkg_rels, parts):
"""
Write a physical package (.pptx file) to *pkg_file* containing
*pkg_rels* and *parts* and a content types stream based on the
content types of the parts.
"""
phys_writer = PhysPkgWriter(pkg_file)
PackageWriter._write_conte... | python | def write(pkg_file, pkg_rels, parts):
"""
Write a physical package (.pptx file) to *pkg_file* containing
*pkg_rels* and *parts* and a content types stream based on the
content types of the parts.
"""
phys_writer = PhysPkgWriter(pkg_file)
PackageWriter._write_conte... | [
"def",
"write",
"(",
"pkg_file",
",",
"pkg_rels",
",",
"parts",
")",
":",
"phys_writer",
"=",
"PhysPkgWriter",
"(",
"pkg_file",
")",
"PackageWriter",
".",
"_write_content_types_stream",
"(",
"phys_writer",
",",
"parts",
")",
"PackageWriter",
".",
"_write_pkg_rels"... | Write a physical package (.pptx file) to *pkg_file* containing
*pkg_rels* and *parts* and a content types stream based on the
content types of the parts. | [
"Write",
"a",
"physical",
"package",
"(",
".",
"pptx",
"file",
")",
"to",
"*",
"pkg_file",
"*",
"containing",
"*",
"pkg_rels",
"*",
"and",
"*",
"parts",
"*",
"and",
"a",
"content",
"types",
"stream",
"based",
"on",
"the",
"content",
"types",
"of",
"the... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/pkgwriter.py#L26-L36 | train | Write a physical package file containing the current naccesstoken entries to the given file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/opc/pkgwriter.py | PackageWriter._write_content_types_stream | def _write_content_types_stream(phys_writer, parts):
"""
Write ``[Content_Types].xml`` part to the physical package with an
appropriate content type lookup target for each part in *parts*.
"""
cti = _ContentTypesItem.from_parts(parts)
phys_writer.write(CONTENT_TYPES_URI, ... | python | def _write_content_types_stream(phys_writer, parts):
"""
Write ``[Content_Types].xml`` part to the physical package with an
appropriate content type lookup target for each part in *parts*.
"""
cti = _ContentTypesItem.from_parts(parts)
phys_writer.write(CONTENT_TYPES_URI, ... | [
"def",
"_write_content_types_stream",
"(",
"phys_writer",
",",
"parts",
")",
":",
"cti",
"=",
"_ContentTypesItem",
".",
"from_parts",
"(",
"parts",
")",
"phys_writer",
".",
"write",
"(",
"CONTENT_TYPES_URI",
",",
"cti",
".",
"blob",
")"
] | Write ``[Content_Types].xml`` part to the physical package with an
appropriate content type lookup target for each part in *parts*. | [
"Write",
"[",
"Content_Types",
"]",
".",
"xml",
"part",
"to",
"the",
"physical",
"package",
"with",
"an",
"appropriate",
"content",
"type",
"lookup",
"target",
"for",
"each",
"part",
"in",
"*",
"parts",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/pkgwriter.py#L39-L45 | train | Write the content types. xml part to the physical package with anonymization target for each part in parts. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/opc/pkgwriter.py | PackageWriter._write_parts | def _write_parts(phys_writer, parts):
"""
Write the blob of each part in *parts* to the package, along with a
rels item for its relationships if and only if it has any.
"""
for part in parts:
phys_writer.write(part.partname, part.blob)
if len(part._rels):
... | python | def _write_parts(phys_writer, parts):
"""
Write the blob of each part in *parts* to the package, along with a
rels item for its relationships if and only if it has any.
"""
for part in parts:
phys_writer.write(part.partname, part.blob)
if len(part._rels):
... | [
"def",
"_write_parts",
"(",
"phys_writer",
",",
"parts",
")",
":",
"for",
"part",
"in",
"parts",
":",
"phys_writer",
".",
"write",
"(",
"part",
".",
"partname",
",",
"part",
".",
"blob",
")",
"if",
"len",
"(",
"part",
".",
"_rels",
")",
":",
"phys_wr... | Write the blob of each part in *parts* to the package, along with a
rels item for its relationships if and only if it has any. | [
"Write",
"the",
"blob",
"of",
"each",
"part",
"in",
"*",
"parts",
"*",
"to",
"the",
"package",
"along",
"with",
"a",
"rels",
"item",
"for",
"its",
"relationships",
"if",
"and",
"only",
"if",
"it",
"has",
"any",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/pkgwriter.py#L48-L56 | train | Write the blob of each part in parts to the package. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/opc/pkgwriter.py | _ContentTypesItem.from_parts | def from_parts(cls, parts):
"""
Return content types XML mapping each part in *parts* to the
appropriate content type and suitable for storage as
``[Content_Types].xml`` in an OPC package.
"""
cti = cls()
cti._defaults['rels'] = CT.OPC_RELATIONSHIPS
cti._d... | python | def from_parts(cls, parts):
"""
Return content types XML mapping each part in *parts* to the
appropriate content type and suitable for storage as
``[Content_Types].xml`` in an OPC package.
"""
cti = cls()
cti._defaults['rels'] = CT.OPC_RELATIONSHIPS
cti._d... | [
"def",
"from_parts",
"(",
"cls",
",",
"parts",
")",
":",
"cti",
"=",
"cls",
"(",
")",
"cti",
".",
"_defaults",
"[",
"'rels'",
"]",
"=",
"CT",
".",
"OPC_RELATIONSHIPS",
"cti",
".",
"_defaults",
"[",
"'xml'",
"]",
"=",
"CT",
".",
"XML",
"for",
"part"... | Return content types XML mapping each part in *parts* to the
appropriate content type and suitable for storage as
``[Content_Types].xml`` in an OPC package. | [
"Return",
"content",
"types",
"XML",
"mapping",
"each",
"part",
"in",
"*",
"parts",
"*",
"to",
"the",
"appropriate",
"content",
"type",
"and",
"suitable",
"for",
"storage",
"as",
"[",
"Content_Types",
"]",
".",
"xml",
"in",
"an",
"OPC",
"package",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/pkgwriter.py#L87-L98 | train | Create a new object from a list of parts. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/opc/pkgwriter.py | _ContentTypesItem._add_content_type | def _add_content_type(self, partname, content_type):
"""
Add a content type for the part with *partname* and *content_type*,
using a default or override as appropriate.
"""
ext = partname.ext
if (ext.lower(), content_type) in default_content_types:
self._defau... | python | def _add_content_type(self, partname, content_type):
"""
Add a content type for the part with *partname* and *content_type*,
using a default or override as appropriate.
"""
ext = partname.ext
if (ext.lower(), content_type) in default_content_types:
self._defau... | [
"def",
"_add_content_type",
"(",
"self",
",",
"partname",
",",
"content_type",
")",
":",
"ext",
"=",
"partname",
".",
"ext",
"if",
"(",
"ext",
".",
"lower",
"(",
")",
",",
"content_type",
")",
"in",
"default_content_types",
":",
"self",
".",
"_defaults",
... | Add a content type for the part with *partname* and *content_type*,
using a default or override as appropriate. | [
"Add",
"a",
"content",
"type",
"for",
"the",
"part",
"with",
"*",
"partname",
"*",
"and",
"*",
"content_type",
"*",
"using",
"a",
"default",
"or",
"override",
"as",
"appropriate",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/pkgwriter.py#L100-L109 | train | Add a content type for the given partname and content_type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/opc/pkgwriter.py | _ContentTypesItem._element | def _element(self):
"""
Return XML form of this content types item, suitable for storage as
``[Content_Types].xml`` in an OPC package. Although the sequence of
elements is not strictly significant, as an aid to testing and
readability Default elements are sorted by extension and ... | python | def _element(self):
"""
Return XML form of this content types item, suitable for storage as
``[Content_Types].xml`` in an OPC package. Although the sequence of
elements is not strictly significant, as an aid to testing and
readability Default elements are sorted by extension and ... | [
"def",
"_element",
"(",
"self",
")",
":",
"_types_elm",
"=",
"CT_Types",
".",
"new",
"(",
")",
"for",
"ext",
"in",
"sorted",
"(",
"self",
".",
"_defaults",
".",
"keys",
"(",
")",
")",
":",
"_types_elm",
".",
"add_default",
"(",
"ext",
",",
"self",
... | Return XML form of this content types item, suitable for storage as
``[Content_Types].xml`` in an OPC package. Although the sequence of
elements is not strictly significant, as an aid to testing and
readability Default elements are sorted by extension and Override
elements are sorted by ... | [
"Return",
"XML",
"form",
"of",
"this",
"content",
"types",
"item",
"suitable",
"for",
"storage",
"as",
"[",
"Content_Types",
"]",
".",
"xml",
"in",
"an",
"OPC",
"package",
".",
"Although",
"the",
"sequence",
"of",
"elements",
"is",
"not",
"strictly",
"sign... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/pkgwriter.py#L112-L125 | train | Return the XML representation of this content types item suitable for storage as
. xml in an OPC package. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | features/steps/text.py | given_a_run_having_mixed_text_content | def given_a_run_having_mixed_text_content(context):
"""
Mixed here meaning it contains ``<w:tab/>``, ``<w:cr/>``, etc. elements.
"""
r_xml = """\
<w:r %s>
<w:t>abc</w:t>
<w:tab/>
<w:t>def</w:t>
<w:cr/>
<w:t>ghi</w:t>
<w:drawing/>
... | python | def given_a_run_having_mixed_text_content(context):
"""
Mixed here meaning it contains ``<w:tab/>``, ``<w:cr/>``, etc. elements.
"""
r_xml = """\
<w:r %s>
<w:t>abc</w:t>
<w:tab/>
<w:t>def</w:t>
<w:cr/>
<w:t>ghi</w:t>
<w:drawing/>
... | [
"def",
"given_a_run_having_mixed_text_content",
"(",
"context",
")",
":",
"r_xml",
"=",
"\"\"\"\\\n <w:r %s>\n <w:t>abc</w:t>\n <w:tab/>\n <w:t>def</w:t>\n <w:cr/>\n <w:t>ghi</w:t>\n <w:drawing/>\n <w:br/>\n <w:t>jkl</w:t... | Mixed here meaning it contains ``<w:tab/>``, ``<w:cr/>``, etc. elements. | [
"Mixed",
"here",
"meaning",
"it",
"contains",
"<w",
":",
"tab",
"/",
">",
"<w",
":",
"cr",
"/",
">",
"etc",
".",
"elements",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/features/steps/text.py#L49-L65 | train | A run with mixed text content. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/document.py | CT_Body.add_section_break | def add_section_break(self):
"""Return `w:sectPr` element for new section added at end of document.
The last `w:sectPr` becomes the second-to-last, with the new `w:sectPr` being an
exact clone of the previous one, except that all header and footer references
are removed (and are therefo... | python | def add_section_break(self):
"""Return `w:sectPr` element for new section added at end of document.
The last `w:sectPr` becomes the second-to-last, with the new `w:sectPr` being an
exact clone of the previous one, except that all header and footer references
are removed (and are therefo... | [
"def",
"add_section_break",
"(",
"self",
")",
":",
"# ---get the sectPr at file-end, which controls last section (sections[-1])---",
"sentinel_sectPr",
"=",
"self",
".",
"get_or_add_sectPr",
"(",
")",
"# ---add exact copy to new `w:p` element; that is now second-to last section---",
"s... | Return `w:sectPr` element for new section added at end of document.
The last `w:sectPr` becomes the second-to-last, with the new `w:sectPr` being an
exact clone of the previous one, except that all header and footer references
are removed (and are therefore now "inherited" from the prior sectio... | [
"Return",
"w",
":",
"sectPr",
"element",
"for",
"new",
"section",
"added",
"at",
"end",
"of",
"document",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/document.py#L35-L55 | train | Return the sentinel element for new section added at end of document. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/document.py | CT_Body.clear_content | def clear_content(self):
"""
Remove all content child elements from this <w:body> element. Leave
the <w:sectPr> element if it is present.
"""
if self.sectPr is not None:
content_elms = self[:-1]
else:
content_elms = self[:]
for content_elm ... | python | def clear_content(self):
"""
Remove all content child elements from this <w:body> element. Leave
the <w:sectPr> element if it is present.
"""
if self.sectPr is not None:
content_elms = self[:-1]
else:
content_elms = self[:]
for content_elm ... | [
"def",
"clear_content",
"(",
"self",
")",
":",
"if",
"self",
".",
"sectPr",
"is",
"not",
"None",
":",
"content_elms",
"=",
"self",
"[",
":",
"-",
"1",
"]",
"else",
":",
"content_elms",
"=",
"self",
"[",
":",
"]",
"for",
"content_elm",
"in",
"content_... | Remove all content child elements from this <w:body> element. Leave
the <w:sectPr> element if it is present. | [
"Remove",
"all",
"content",
"child",
"elements",
"from",
"this",
"<w",
":",
"body",
">",
"element",
".",
"Leave",
"the",
"<w",
":",
"sectPr",
">",
"element",
"if",
"it",
"is",
"present",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/document.py#L57-L67 | train | Remove all content child elements from this element. Leave
the last element. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/image.py | _ImageHeaderFactory | def _ImageHeaderFactory(stream):
"""
Return a |BaseImageHeader| subclass instance that knows how to parse the
headers of the image in *stream*.
"""
from docx.image import SIGNATURES
def read_32(stream):
stream.seek(0)
return stream.read(32)
header = read_32(stream)
for ... | python | def _ImageHeaderFactory(stream):
"""
Return a |BaseImageHeader| subclass instance that knows how to parse the
headers of the image in *stream*.
"""
from docx.image import SIGNATURES
def read_32(stream):
stream.seek(0)
return stream.read(32)
header = read_32(stream)
for ... | [
"def",
"_ImageHeaderFactory",
"(",
"stream",
")",
":",
"from",
"docx",
".",
"image",
"import",
"SIGNATURES",
"def",
"read_32",
"(",
"stream",
")",
":",
"stream",
".",
"seek",
"(",
"0",
")",
"return",
"stream",
".",
"read",
"(",
"32",
")",
"header",
"="... | Return a |BaseImageHeader| subclass instance that knows how to parse the
headers of the image in *stream*. | [
"Return",
"a",
"|BaseImageHeader|",
"subclass",
"instance",
"that",
"knows",
"how",
"to",
"parse",
"the",
"headers",
"of",
"the",
"image",
"in",
"*",
"stream",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/image.py#L182-L199 | train | Return a |BaseImageHeader| subclass that knows how to parse the image in *stream*. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/image.py | Image.from_blob | def from_blob(cls, blob):
"""
Return a new |Image| subclass instance parsed from the image binary
contained in *blob*.
"""
stream = BytesIO(blob)
return cls._from_stream(stream, blob) | python | def from_blob(cls, blob):
"""
Return a new |Image| subclass instance parsed from the image binary
contained in *blob*.
"""
stream = BytesIO(blob)
return cls._from_stream(stream, blob) | [
"def",
"from_blob",
"(",
"cls",
",",
"blob",
")",
":",
"stream",
"=",
"BytesIO",
"(",
"blob",
")",
"return",
"cls",
".",
"_from_stream",
"(",
"stream",
",",
"blob",
")"
] | Return a new |Image| subclass instance parsed from the image binary
contained in *blob*. | [
"Return",
"a",
"new",
"|Image|",
"subclass",
"instance",
"parsed",
"from",
"the",
"image",
"binary",
"contained",
"in",
"*",
"blob",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/image.py#L30-L36 | train | Parse an image from a binary blob. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/image.py | Image.from_file | def from_file(cls, image_descriptor):
"""
Return a new |Image| subclass instance loaded from the image file
identified by *image_descriptor*, a path or file-like object.
"""
if is_string(image_descriptor):
path = image_descriptor
with open(path, 'rb') as f... | python | def from_file(cls, image_descriptor):
"""
Return a new |Image| subclass instance loaded from the image file
identified by *image_descriptor*, a path or file-like object.
"""
if is_string(image_descriptor):
path = image_descriptor
with open(path, 'rb') as f... | [
"def",
"from_file",
"(",
"cls",
",",
"image_descriptor",
")",
":",
"if",
"is_string",
"(",
"image_descriptor",
")",
":",
"path",
"=",
"image_descriptor",
"with",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"f",
":",
"blob",
"=",
"f",
".",
"read",
"(",... | Return a new |Image| subclass instance loaded from the image file
identified by *image_descriptor*, a path or file-like object. | [
"Return",
"a",
"new",
"|Image|",
"subclass",
"instance",
"loaded",
"from",
"the",
"image",
"file",
"identified",
"by",
"*",
"image_descriptor",
"*",
"a",
"path",
"or",
"file",
"-",
"like",
"object",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/image.py#L39-L55 | train | Return a |Image| subclass instance loaded from the image file identified by image_descriptor. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/image.py | Image.scaled_dimensions | def scaled_dimensions(self, width=None, height=None):
"""
Return a (cx, cy) 2-tuple representing the native dimensions of this
image scaled by applying the following rules to *width* and *height*.
If both *width* and *height* are specified, the return value is
(*width*, *height*)... | python | def scaled_dimensions(self, width=None, height=None):
"""
Return a (cx, cy) 2-tuple representing the native dimensions of this
image scaled by applying the following rules to *width* and *height*.
If both *width* and *height* are specified, the return value is
(*width*, *height*)... | [
"def",
"scaled_dimensions",
"(",
"self",
",",
"width",
"=",
"None",
",",
"height",
"=",
"None",
")",
":",
"if",
"width",
"is",
"None",
"and",
"height",
"is",
"None",
":",
"return",
"self",
".",
"width",
",",
"self",
".",
"height",
"if",
"width",
"is"... | Return a (cx, cy) 2-tuple representing the native dimensions of this
image scaled by applying the following rules to *width* and *height*.
If both *width* and *height* are specified, the return value is
(*width*, *height*); no scaling is performed. If only one is
specified, it is used to... | [
"Return",
"a",
"(",
"cx",
"cy",
")",
"2",
"-",
"tuple",
"representing",
"the",
"native",
"dimensions",
"of",
"this",
"image",
"scaled",
"by",
"applying",
"the",
"following",
"rules",
"to",
"*",
"width",
"*",
"and",
"*",
"height",
"*",
".",
"If",
"both"... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/image.py#L136-L161 | train | Return a tuple representing the width and height of the image. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/image/image.py | Image._from_stream | def _from_stream(cls, stream, blob, filename=None):
"""
Return an instance of the |Image| subclass corresponding to the
format of the image in *stream*.
"""
image_header = _ImageHeaderFactory(stream)
if filename is None:
filename = 'image.%s' % image_header.de... | python | def _from_stream(cls, stream, blob, filename=None):
"""
Return an instance of the |Image| subclass corresponding to the
format of the image in *stream*.
"""
image_header = _ImageHeaderFactory(stream)
if filename is None:
filename = 'image.%s' % image_header.de... | [
"def",
"_from_stream",
"(",
"cls",
",",
"stream",
",",
"blob",
",",
"filename",
"=",
"None",
")",
":",
"image_header",
"=",
"_ImageHeaderFactory",
"(",
"stream",
")",
"if",
"filename",
"is",
"None",
":",
"filename",
"=",
"'image.%s'",
"%",
"image_header",
... | Return an instance of the |Image| subclass corresponding to the
format of the image in *stream*. | [
"Return",
"an",
"instance",
"of",
"the",
"|Image|",
"subclass",
"corresponding",
"to",
"the",
"format",
"of",
"the",
"image",
"in",
"*",
"stream",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/image.py#L171-L179 | train | Create an |Image| instance from the given |Stream| object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/text/paragraph.py | Paragraph.add_run | def add_run(self, text=None, style=None):
"""
Append a run to this paragraph containing *text* and having character
style identified by style ID *style*. *text* can contain tab
(``\\t``) characters, which are converted to the appropriate XML form
for a tab. *text* can also includ... | python | def add_run(self, text=None, style=None):
"""
Append a run to this paragraph containing *text* and having character
style identified by style ID *style*. *text* can contain tab
(``\\t``) characters, which are converted to the appropriate XML form
for a tab. *text* can also includ... | [
"def",
"add_run",
"(",
"self",
",",
"text",
"=",
"None",
",",
"style",
"=",
"None",
")",
":",
"r",
"=",
"self",
".",
"_p",
".",
"add_r",
"(",
")",
"run",
"=",
"Run",
"(",
"r",
",",
"self",
")",
"if",
"text",
":",
"run",
".",
"text",
"=",
"t... | Append a run to this paragraph containing *text* and having character
style identified by style ID *style*. *text* can contain tab
(``\\t``) characters, which are converted to the appropriate XML form
for a tab. *text* can also include newline (``\\n``) or carriage
return (``\\r``) chara... | [
"Append",
"a",
"run",
"to",
"this",
"paragraph",
"containing",
"*",
"text",
"*",
"and",
"having",
"character",
"style",
"identified",
"by",
"style",
"ID",
"*",
"style",
"*",
".",
"*",
"text",
"*",
"can",
"contain",
"tab",
"(",
"\\\\",
"t",
")",
"charac... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/paragraph.py#L25-L40 | train | Append a run to this paragraph containing text and having character
style identified by style ID. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/text/paragraph.py | Paragraph.insert_paragraph_before | def insert_paragraph_before(self, text=None, style=None):
"""
Return a newly created paragraph, inserted directly before this
paragraph. If *text* is supplied, the new paragraph contains that
text in a single run. If *style* is provided, that style is assigned
to the new paragrap... | python | def insert_paragraph_before(self, text=None, style=None):
"""
Return a newly created paragraph, inserted directly before this
paragraph. If *text* is supplied, the new paragraph contains that
text in a single run. If *style* is provided, that style is assigned
to the new paragrap... | [
"def",
"insert_paragraph_before",
"(",
"self",
",",
"text",
"=",
"None",
",",
"style",
"=",
"None",
")",
":",
"paragraph",
"=",
"self",
".",
"_insert_paragraph_before",
"(",
")",
"if",
"text",
":",
"paragraph",
".",
"add_run",
"(",
"text",
")",
"if",
"st... | Return a newly created paragraph, inserted directly before this
paragraph. If *text* is supplied, the new paragraph contains that
text in a single run. If *style* is provided, that style is assigned
to the new paragraph. | [
"Return",
"a",
"newly",
"created",
"paragraph",
"inserted",
"directly",
"before",
"this",
"paragraph",
".",
"If",
"*",
"text",
"*",
"is",
"supplied",
"the",
"new",
"paragraph",
"contains",
"that",
"text",
"in",
"a",
"single",
"run",
".",
"If",
"*",
"style"... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/paragraph.py#L65-L77 | train | Insert a new paragraph before this one. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/text/paragraph.py | Paragraph.style | def style(self):
"""
Read/Write. |_ParagraphStyle| object representing the style assigned
to this paragraph. If no explicit style is assigned to this
paragraph, its value is the default paragraph style for the document.
A paragraph style name can be assigned in lieu of a paragrap... | python | def style(self):
"""
Read/Write. |_ParagraphStyle| object representing the style assigned
to this paragraph. If no explicit style is assigned to this
paragraph, its value is the default paragraph style for the document.
A paragraph style name can be assigned in lieu of a paragrap... | [
"def",
"style",
"(",
"self",
")",
":",
"style_id",
"=",
"self",
".",
"_p",
".",
"style",
"return",
"self",
".",
"part",
".",
"get_style",
"(",
"style_id",
",",
"WD_STYLE_TYPE",
".",
"PARAGRAPH",
")"
] | Read/Write. |_ParagraphStyle| object representing the style assigned
to this paragraph. If no explicit style is assigned to this
paragraph, its value is the default paragraph style for the document.
A paragraph style name can be assigned in lieu of a paragraph style
object. Assigning |No... | [
"Read",
"/",
"Write",
".",
"|_ParagraphStyle|",
"object",
"representing",
"the",
"style",
"assigned",
"to",
"this",
"paragraph",
".",
"If",
"no",
"explicit",
"style",
"is",
"assigned",
"to",
"this",
"paragraph",
"its",
"value",
"is",
"the",
"default",
"paragra... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/paragraph.py#L96-L106 | train | Return |_ParagraphStyle| object representing the style assigned to this paragraph. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/text/paragraph.py | Paragraph.text | def text(self):
"""
String formed by concatenating the text of each run in the paragraph.
Tabs and line breaks in the XML are mapped to ``\\t`` and ``\\n``
characters respectively.
Assigning text to this property causes all existing paragraph content
to be replaced with ... | python | def text(self):
"""
String formed by concatenating the text of each run in the paragraph.
Tabs and line breaks in the XML are mapped to ``\\t`` and ``\\n``
characters respectively.
Assigning text to this property causes all existing paragraph content
to be replaced with ... | [
"def",
"text",
"(",
"self",
")",
":",
"text",
"=",
"''",
"for",
"run",
"in",
"self",
".",
"runs",
":",
"text",
"+=",
"run",
".",
"text",
"return",
"text"
] | String formed by concatenating the text of each run in the paragraph.
Tabs and line breaks in the XML are mapped to ``\\t`` and ``\\n``
characters respectively.
Assigning text to this property causes all existing paragraph content
to be replaced with a single run containing the assigned... | [
"String",
"formed",
"by",
"concatenating",
"the",
"text",
"of",
"each",
"run",
"in",
"the",
"paragraph",
".",
"Tabs",
"and",
"line",
"breaks",
"in",
"the",
"XML",
"are",
"mapped",
"to",
"\\\\",
"t",
"and",
"\\\\",
"n",
"characters",
"respectively",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/paragraph.py#L116-L132 | train | Return the text of the content of this paragraph. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/text/paragraph.py | Paragraph._insert_paragraph_before | def _insert_paragraph_before(self):
"""
Return a newly created paragraph, inserted directly before this
paragraph.
"""
p = self._p.add_p_before()
return Paragraph(p, self._parent) | python | def _insert_paragraph_before(self):
"""
Return a newly created paragraph, inserted directly before this
paragraph.
"""
p = self._p.add_p_before()
return Paragraph(p, self._parent) | [
"def",
"_insert_paragraph_before",
"(",
"self",
")",
":",
"p",
"=",
"self",
".",
"_p",
".",
"add_p_before",
"(",
")",
"return",
"Paragraph",
"(",
"p",
",",
"self",
".",
"_parent",
")"
] | Return a newly created paragraph, inserted directly before this
paragraph. | [
"Return",
"a",
"newly",
"created",
"paragraph",
"inserted",
"directly",
"before",
"this",
"paragraph",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/paragraph.py#L139-L145 | train | Insert a new paragraph before this one. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/xmlchemy.py | serialize_for_reading | def serialize_for_reading(element):
"""
Serialize *element* to human-readable XML suitable for tests. No XML
declaration.
"""
xml = etree.tostring(element, encoding='unicode', pretty_print=True)
return XmlString(xml) | python | def serialize_for_reading(element):
"""
Serialize *element* to human-readable XML suitable for tests. No XML
declaration.
"""
xml = etree.tostring(element, encoding='unicode', pretty_print=True)
return XmlString(xml) | [
"def",
"serialize_for_reading",
"(",
"element",
")",
":",
"xml",
"=",
"etree",
".",
"tostring",
"(",
"element",
",",
"encoding",
"=",
"'unicode'",
",",
"pretty_print",
"=",
"True",
")",
"return",
"XmlString",
"(",
"xml",
")"
] | Serialize *element* to human-readable XML suitable for tests. No XML
declaration. | [
"Serialize",
"*",
"element",
"*",
"to",
"human",
"-",
"readable",
"XML",
"suitable",
"for",
"tests",
".",
"No",
"XML",
"declaration",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/xmlchemy.py#L21-L27 | train | Serialize element to human - readable XML suitable for tests. No XML
declaration. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/xmlchemy.py | XmlString._attr_seq | def _attr_seq(self, attrs):
"""
Return a sequence of attribute strings parsed from *attrs*. Each
attribute string is stripped of whitespace on both ends.
"""
attrs = attrs.strip()
attr_lst = attrs.split()
return sorted(attr_lst) | python | def _attr_seq(self, attrs):
"""
Return a sequence of attribute strings parsed from *attrs*. Each
attribute string is stripped of whitespace on both ends.
"""
attrs = attrs.strip()
attr_lst = attrs.split()
return sorted(attr_lst) | [
"def",
"_attr_seq",
"(",
"self",
",",
"attrs",
")",
":",
"attrs",
"=",
"attrs",
".",
"strip",
"(",
")",
"attr_lst",
"=",
"attrs",
".",
"split",
"(",
")",
"return",
"sorted",
"(",
"attr_lst",
")"
] | Return a sequence of attribute strings parsed from *attrs*. Each
attribute string is stripped of whitespace on both ends. | [
"Return",
"a",
"sequence",
"of",
"attribute",
"strings",
"parsed",
"from",
"*",
"attrs",
"*",
".",
"Each",
"attribute",
"string",
"is",
"stripped",
"of",
"whitespace",
"on",
"both",
"ends",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/xmlchemy.py#L57-L64 | train | Return a sequence of attribute strings parsed from attrs. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/xmlchemy.py | XmlString._eq_elm_strs | def _eq_elm_strs(self, line, line_2):
"""
Return True if the element in *line_2* is XML equivalent to the
element in *line*.
"""
front, attrs, close, text = self._parse_line(line)
front_2, attrs_2, close_2, text_2 = self._parse_line(line_2)
if front != front_2:
... | python | def _eq_elm_strs(self, line, line_2):
"""
Return True if the element in *line_2* is XML equivalent to the
element in *line*.
"""
front, attrs, close, text = self._parse_line(line)
front_2, attrs_2, close_2, text_2 = self._parse_line(line_2)
if front != front_2:
... | [
"def",
"_eq_elm_strs",
"(",
"self",
",",
"line",
",",
"line_2",
")",
":",
"front",
",",
"attrs",
",",
"close",
",",
"text",
"=",
"self",
".",
"_parse_line",
"(",
"line",
")",
"front_2",
",",
"attrs_2",
",",
"close_2",
",",
"text_2",
"=",
"self",
".",... | Return True if the element in *line_2* is XML equivalent to the
element in *line*. | [
"Return",
"True",
"if",
"the",
"element",
"in",
"*",
"line_2",
"*",
"is",
"XML",
"equivalent",
"to",
"the",
"element",
"in",
"*",
"line",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/xmlchemy.py#L66-L81 | train | Return True if the element in line_2 is XML equivalent to the
element in line. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/xmlchemy.py | XmlString._parse_line | def _parse_line(cls, line):
"""
Return front, attrs, close, text 4-tuple result of parsing XML element
string *line*.
"""
match = cls._xml_elm_line_patt.match(line)
front, attrs, close, text = [match.group(n) for n in range(1, 5)]
return front, attrs, close, text | python | def _parse_line(cls, line):
"""
Return front, attrs, close, text 4-tuple result of parsing XML element
string *line*.
"""
match = cls._xml_elm_line_patt.match(line)
front, attrs, close, text = [match.group(n) for n in range(1, 5)]
return front, attrs, close, text | [
"def",
"_parse_line",
"(",
"cls",
",",
"line",
")",
":",
"match",
"=",
"cls",
".",
"_xml_elm_line_patt",
".",
"match",
"(",
"line",
")",
"front",
",",
"attrs",
",",
"close",
",",
"text",
"=",
"[",
"match",
".",
"group",
"(",
"n",
")",
"for",
"n",
... | Return front, attrs, close, text 4-tuple result of parsing XML element
string *line*. | [
"Return",
"front",
"attrs",
"close",
"text",
"4",
"-",
"tuple",
"result",
"of",
"parsing",
"XML",
"element",
"string",
"*",
"line",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/xmlchemy.py#L84-L91 | train | Parse a line of XML element - level attributes and text. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/xmlchemy.py | BaseAttribute.populate_class_members | def populate_class_members(self, element_cls, prop_name):
"""
Add the appropriate methods to *element_cls*.
"""
self._element_cls = element_cls
self._prop_name = prop_name
self._add_attr_property() | python | def populate_class_members(self, element_cls, prop_name):
"""
Add the appropriate methods to *element_cls*.
"""
self._element_cls = element_cls
self._prop_name = prop_name
self._add_attr_property() | [
"def",
"populate_class_members",
"(",
"self",
",",
"element_cls",
",",
"prop_name",
")",
":",
"self",
".",
"_element_cls",
"=",
"element_cls",
"self",
".",
"_prop_name",
"=",
"prop_name",
"self",
".",
"_add_attr_property",
"(",
")"
] | Add the appropriate methods to *element_cls*. | [
"Add",
"the",
"appropriate",
"methods",
"to",
"*",
"element_cls",
"*",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/xmlchemy.py#L118-L125 | train | Populates the internal state of the class members. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/xmlchemy.py | BaseAttribute._add_attr_property | def _add_attr_property(self):
"""
Add a read/write ``{prop_name}`` property to the element class that
returns the interpreted value of this attribute on access and changes
the attribute value to its ST_* counterpart on assignment.
"""
property_ = property(self._getter, se... | python | def _add_attr_property(self):
"""
Add a read/write ``{prop_name}`` property to the element class that
returns the interpreted value of this attribute on access and changes
the attribute value to its ST_* counterpart on assignment.
"""
property_ = property(self._getter, se... | [
"def",
"_add_attr_property",
"(",
"self",
")",
":",
"property_",
"=",
"property",
"(",
"self",
".",
"_getter",
",",
"self",
".",
"_setter",
",",
"None",
")",
"# assign unconditionally to overwrite element name definition",
"setattr",
"(",
"self",
".",
"_element_cls"... | Add a read/write ``{prop_name}`` property to the element class that
returns the interpreted value of this attribute on access and changes
the attribute value to its ST_* counterpart on assignment. | [
"Add",
"a",
"read",
"/",
"write",
"{",
"prop_name",
"}",
"property",
"to",
"the",
"element",
"class",
"that",
"returns",
"the",
"interpreted",
"value",
"of",
"this",
"attribute",
"on",
"access",
"and",
"changes",
"the",
"attribute",
"value",
"to",
"its",
"... | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/xmlchemy.py#L127-L135 | train | Add a read or write property to the element class that contains this attribute. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/xmlchemy.py | OptionalAttribute._getter | def _getter(self):
"""
Return a function object suitable for the "get" side of the attribute
property descriptor.
"""
def get_attr_value(obj):
attr_str_value = obj.get(self._clark_name)
if attr_str_value is None:
return self._default
... | python | def _getter(self):
"""
Return a function object suitable for the "get" side of the attribute
property descriptor.
"""
def get_attr_value(obj):
attr_str_value = obj.get(self._clark_name)
if attr_str_value is None:
return self._default
... | [
"def",
"_getter",
"(",
"self",
")",
":",
"def",
"get_attr_value",
"(",
"obj",
")",
":",
"attr_str_value",
"=",
"obj",
".",
"get",
"(",
"self",
".",
"_clark_name",
")",
"if",
"attr_str_value",
"is",
"None",
":",
"return",
"self",
".",
"_default",
"return"... | Return a function object suitable for the "get" side of the attribute
property descriptor. | [
"Return",
"a",
"function",
"object",
"suitable",
"for",
"the",
"get",
"side",
"of",
"the",
"attribute",
"property",
"descriptor",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/xmlchemy.py#L155-L166 | train | Return a function object suitable for the get side of the attribute
property descriptor. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/xmlchemy.py | OptionalAttribute._setter | def _setter(self):
"""
Return a function object suitable for the "set" side of the attribute
property descriptor.
"""
def set_attr_value(obj, value):
if value is None or value == self._default:
if self._clark_name in obj.attrib:
del... | python | def _setter(self):
"""
Return a function object suitable for the "set" side of the attribute
property descriptor.
"""
def set_attr_value(obj, value):
if value is None or value == self._default:
if self._clark_name in obj.attrib:
del... | [
"def",
"_setter",
"(",
"self",
")",
":",
"def",
"set_attr_value",
"(",
"obj",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
"or",
"value",
"==",
"self",
".",
"_default",
":",
"if",
"self",
".",
"_clark_name",
"in",
"obj",
".",
"attrib",
":",
... | Return a function object suitable for the "set" side of the attribute
property descriptor. | [
"Return",
"a",
"function",
"object",
"suitable",
"for",
"the",
"set",
"side",
"of",
"the",
"attribute",
"property",
"descriptor",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/xmlchemy.py#L182-L194 | train | Returns a function object suitable for the set side of the attribute
property descriptor. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/xmlchemy.py | RequiredAttribute._getter | def _getter(self):
"""
Return a function object suitable for the "get" side of the attribute
property descriptor.
"""
def get_attr_value(obj):
attr_str_value = obj.get(self._clark_name)
if attr_str_value is None:
raise InvalidXmlError(
... | python | def _getter(self):
"""
Return a function object suitable for the "get" side of the attribute
property descriptor.
"""
def get_attr_value(obj):
attr_str_value = obj.get(self._clark_name)
if attr_str_value is None:
raise InvalidXmlError(
... | [
"def",
"_getter",
"(",
"self",
")",
":",
"def",
"get_attr_value",
"(",
"obj",
")",
":",
"attr_str_value",
"=",
"obj",
".",
"get",
"(",
"self",
".",
"_clark_name",
")",
"if",
"attr_str_value",
"is",
"None",
":",
"raise",
"InvalidXmlError",
"(",
"\"required ... | Return a function object suitable for the "get" side of the attribute
property descriptor. | [
"Return",
"a",
"function",
"object",
"suitable",
"for",
"the",
"get",
"side",
"of",
"the",
"attribute",
"property",
"descriptor",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/xmlchemy.py#L207-L221 | train | Return a function object suitable for the get side of the attribute
property descriptor. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/xmlchemy.py | RequiredAttribute._setter | def _setter(self):
"""
Return a function object suitable for the "set" side of the attribute
property descriptor.
"""
def set_attr_value(obj, value):
str_value = self._simple_type.to_xml(value)
obj.set(self._clark_name, str_value)
return set_attr_v... | python | def _setter(self):
"""
Return a function object suitable for the "set" side of the attribute
property descriptor.
"""
def set_attr_value(obj, value):
str_value = self._simple_type.to_xml(value)
obj.set(self._clark_name, str_value)
return set_attr_v... | [
"def",
"_setter",
"(",
"self",
")",
":",
"def",
"set_attr_value",
"(",
"obj",
",",
"value",
")",
":",
"str_value",
"=",
"self",
".",
"_simple_type",
".",
"to_xml",
"(",
"value",
")",
"obj",
".",
"set",
"(",
"self",
".",
"_clark_name",
",",
"str_value",... | Return a function object suitable for the "set" side of the attribute
property descriptor. | [
"Return",
"a",
"function",
"object",
"suitable",
"for",
"the",
"set",
"side",
"of",
"the",
"attribute",
"property",
"descriptor",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/xmlchemy.py#L235-L243 | train | Returns a function object suitable for the set side of the attribute
property descriptor. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/xmlchemy.py | _BaseChildElement._add_adder | def _add_adder(self):
"""
Add an ``_add_x()`` method to the element class for this child
element.
"""
def _add_child(obj, **attrs):
new_method = getattr(obj, self._new_method_name)
child = new_method()
for key, value in attrs.items():
... | python | def _add_adder(self):
"""
Add an ``_add_x()`` method to the element class for this child
element.
"""
def _add_child(obj, **attrs):
new_method = getattr(obj, self._new_method_name)
child = new_method()
for key, value in attrs.items():
... | [
"def",
"_add_adder",
"(",
"self",
")",
":",
"def",
"_add_child",
"(",
"obj",
",",
"*",
"*",
"attrs",
")",
":",
"new_method",
"=",
"getattr",
"(",
"obj",
",",
"self",
".",
"_new_method_name",
")",
"child",
"=",
"new_method",
"(",
")",
"for",
"key",
",... | Add an ``_add_x()`` method to the element class for this child
element. | [
"Add",
"an",
"_add_x",
"()",
"method",
"to",
"the",
"element",
"class",
"for",
"this",
"child",
"element",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/xmlchemy.py#L264-L282 | train | Add an _add_x method to the element class for this childCOOKIE. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/xmlchemy.py | _BaseChildElement._add_creator | def _add_creator(self):
"""
Add a ``_new_{prop_name}()`` method to the element class that creates
a new, empty element of the correct type, having no attributes.
"""
creator = self._creator
creator.__doc__ = (
'Return a "loose", newly created ``<%s>`` element ... | python | def _add_creator(self):
"""
Add a ``_new_{prop_name}()`` method to the element class that creates
a new, empty element of the correct type, having no attributes.
"""
creator = self._creator
creator.__doc__ = (
'Return a "loose", newly created ``<%s>`` element ... | [
"def",
"_add_creator",
"(",
"self",
")",
":",
"creator",
"=",
"self",
".",
"_creator",
"creator",
".",
"__doc__",
"=",
"(",
"'Return a \"loose\", newly created ``<%s>`` element having no attri'",
"'butes, text, or children.'",
"%",
"self",
".",
"_nsptagname",
")",
"self... | Add a ``_new_{prop_name}()`` method to the element class that creates
a new, empty element of the correct type, having no attributes. | [
"Add",
"a",
"_new_",
"{",
"prop_name",
"}",
"()",
"method",
"to",
"the",
"element",
"class",
"that",
"creates",
"a",
"new",
"empty",
"element",
"of",
"the",
"correct",
"type",
"having",
"no",
"attributes",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/xmlchemy.py#L284-L294 | train | Add a creator method to the element class that creates
a new empty element of the correct type and no attributes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/xmlchemy.py | _BaseChildElement._add_getter | def _add_getter(self):
"""
Add a read-only ``{prop_name}`` property to the element class for
this child element.
"""
property_ = property(self._getter, None, None)
# assign unconditionally to overwrite element name definition
setattr(self._element_cls, self._prop_... | python | def _add_getter(self):
"""
Add a read-only ``{prop_name}`` property to the element class for
this child element.
"""
property_ = property(self._getter, None, None)
# assign unconditionally to overwrite element name definition
setattr(self._element_cls, self._prop_... | [
"def",
"_add_getter",
"(",
"self",
")",
":",
"property_",
"=",
"property",
"(",
"self",
".",
"_getter",
",",
"None",
",",
"None",
")",
"# assign unconditionally to overwrite element name definition",
"setattr",
"(",
"self",
".",
"_element_cls",
",",
"self",
".",
... | Add a read-only ``{prop_name}`` property to the element class for
this child element. | [
"Add",
"a",
"read",
"-",
"only",
"{",
"prop_name",
"}",
"property",
"to",
"the",
"element",
"class",
"for",
"this",
"child",
"element",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/xmlchemy.py#L296-L303 | train | Add a read - only property to the element class for
this child element. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
python-openxml/python-docx | docx/oxml/xmlchemy.py | _BaseChildElement._add_inserter | def _add_inserter(self):
"""
Add an ``_insert_x()`` method to the element class for this child
element.
"""
def _insert_child(obj, child):
obj.insert_element_before(child, *self._successors)
return child
_insert_child.__doc__ = (
'Retu... | python | def _add_inserter(self):
"""
Add an ``_insert_x()`` method to the element class for this child
element.
"""
def _insert_child(obj, child):
obj.insert_element_before(child, *self._successors)
return child
_insert_child.__doc__ = (
'Retu... | [
"def",
"_add_inserter",
"(",
"self",
")",
":",
"def",
"_insert_child",
"(",
"obj",
",",
"child",
")",
":",
"obj",
".",
"insert_element_before",
"(",
"child",
",",
"*",
"self",
".",
"_successors",
")",
"return",
"child",
"_insert_child",
".",
"__doc__",
"="... | Add an ``_insert_x()`` method to the element class for this child
element. | [
"Add",
"an",
"_insert_x",
"()",
"method",
"to",
"the",
"element",
"class",
"for",
"this",
"child",
"element",
"."
] | 6756f6cd145511d3eb6d1d188beea391b1ddfd53 | https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/xmlchemy.py#L305-L318 | train | Add an insert_x method to the element class for this childCOOKIE. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.