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/image/jpeg.py
_MarkerFactory
def _MarkerFactory(marker_code, stream, offset): """ Return |_Marker| or subclass instance appropriate for marker at *offset* in *stream* having *marker_code*. """ if marker_code == JPEG_MARKER_CODE.APP0: marker_cls = _App0Marker elif marker_code == JPEG_MARKER_CODE.APP1: marker_...
python
def _MarkerFactory(marker_code, stream, offset): """ Return |_Marker| or subclass instance appropriate for marker at *offset* in *stream* having *marker_code*. """ if marker_code == JPEG_MARKER_CODE.APP0: marker_cls = _App0Marker elif marker_code == JPEG_MARKER_CODE.APP1: marker_...
[ "def", "_MarkerFactory", "(", "marker_code", ",", "stream", ",", "offset", ")", ":", "if", "marker_code", "==", "JPEG_MARKER_CODE", ".", "APP0", ":", "marker_cls", "=", "_App0Marker", "elif", "marker_code", "==", "JPEG_MARKER_CODE", ".", "APP1", ":", "marker_cls...
Return |_Marker| or subclass instance appropriate for marker at *offset* in *stream* having *marker_code*.
[ "Return", "|_Marker|", "or", "subclass", "instance", "appropriate", "for", "marker", "at", "*", "offset", "*", "in", "*", "stream", "*", "having", "*", "marker_code", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L258-L271
train
Returns |_Marker| or subclass instance appropriate for marker 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/jpeg.py
Exif.from_stream
def from_stream(cls, stream): """ Return |Exif| instance having header properties parsed from Exif image in *stream*. """ markers = _JfifMarkers.from_stream(stream) # print('\n%s' % markers) px_width = markers.sof.px_width px_height = markers.sof.px_heigh...
python
def from_stream(cls, stream): """ Return |Exif| instance having header properties parsed from Exif image in *stream*. """ markers = _JfifMarkers.from_stream(stream) # print('\n%s' % markers) px_width = markers.sof.px_width px_height = markers.sof.px_heigh...
[ "def", "from_stream", "(", "cls", ",", "stream", ")", ":", "markers", "=", "_JfifMarkers", ".", "from_stream", "(", "stream", ")", "# print('\\n%s' % markers)", "px_width", "=", "markers", ".", "sof", ".", "px_width", "px_height", "=", "markers", ".", "sof", ...
Return |Exif| instance having header properties parsed from Exif image in *stream*.
[ "Return", "|Exif|", "instance", "having", "header", "properties", "parsed", "from", "Exif", "image", "in", "*", "stream", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L42-L55
train
Create an exif instance from an 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/jpeg.py
_JfifMarkers.from_stream
def from_stream(cls, stream): """ Return a |_JfifMarkers| instance containing a |_JfifMarker| subclass instance for each marker in *stream*. """ marker_parser = _MarkerParser.from_stream(stream) markers = [] for marker in marker_parser.iter_markers(): ...
python
def from_stream(cls, stream): """ Return a |_JfifMarkers| instance containing a |_JfifMarker| subclass instance for each marker in *stream*. """ marker_parser = _MarkerParser.from_stream(stream) markers = [] for marker in marker_parser.iter_markers(): ...
[ "def", "from_stream", "(", "cls", ",", "stream", ")", ":", "marker_parser", "=", "_MarkerParser", ".", "from_stream", "(", "stream", ")", "markers", "=", "[", "]", "for", "marker", "in", "marker_parser", ".", "iter_markers", "(", ")", ":", "markers", ".", ...
Return a |_JfifMarkers| instance containing a |_JfifMarker| subclass instance for each marker in *stream*.
[ "Return", "a", "|_JfifMarkers|", "instance", "containing", "a", "|_JfifMarker|", "subclass", "instance", "for", "each", "marker", "in", "*", "stream", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L104-L115
train
Create a new |_JfifMarkers| instance 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/jpeg.py
_JfifMarkers.app0
def app0(self): """ First APP0 marker in image markers. """ for m in self._markers: if m.marker_code == JPEG_MARKER_CODE.APP0: return m raise KeyError('no APP0 marker in image')
python
def app0(self): """ First APP0 marker in image markers. """ for m in self._markers: if m.marker_code == JPEG_MARKER_CODE.APP0: return m raise KeyError('no APP0 marker in image')
[ "def", "app0", "(", "self", ")", ":", "for", "m", "in", "self", ".", "_markers", ":", "if", "m", ".", "marker_code", "==", "JPEG_MARKER_CODE", ".", "APP0", ":", "return", "m", "raise", "KeyError", "(", "'no APP0 marker in image'", ")" ]
First APP0 marker in image markers.
[ "First", "APP0", "marker", "in", "image", "markers", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L118-L125
train
Return the first APP0 marker in image markers.
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/jpeg.py
_JfifMarkers.app1
def app1(self): """ First APP1 marker in image markers. """ for m in self._markers: if m.marker_code == JPEG_MARKER_CODE.APP1: return m raise KeyError('no APP1 marker in image')
python
def app1(self): """ First APP1 marker in image markers. """ for m in self._markers: if m.marker_code == JPEG_MARKER_CODE.APP1: return m raise KeyError('no APP1 marker in image')
[ "def", "app1", "(", "self", ")", ":", "for", "m", "in", "self", ".", "_markers", ":", "if", "m", ".", "marker_code", "==", "JPEG_MARKER_CODE", ".", "APP1", ":", "return", "m", "raise", "KeyError", "(", "'no APP1 marker in image'", ")" ]
First APP1 marker in image markers.
[ "First", "APP1", "marker", "in", "image", "markers", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L128-L135
train
Return the first APP1 marker in image markers.
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/jpeg.py
_JfifMarkers.sof
def sof(self): """ First start of frame (SOFn) marker in this sequence. """ for m in self._markers: if m.marker_code in JPEG_MARKER_CODE.SOF_MARKER_CODES: return m raise KeyError('no start of frame (SOFn) marker in image')
python
def sof(self): """ First start of frame (SOFn) marker in this sequence. """ for m in self._markers: if m.marker_code in JPEG_MARKER_CODE.SOF_MARKER_CODES: return m raise KeyError('no start of frame (SOFn) marker in image')
[ "def", "sof", "(", "self", ")", ":", "for", "m", "in", "self", ".", "_markers", ":", "if", "m", ".", "marker_code", "in", "JPEG_MARKER_CODE", ".", "SOF_MARKER_CODES", ":", "return", "m", "raise", "KeyError", "(", "'no start of frame (SOFn) marker in image'", "...
First start of frame (SOFn) marker in this sequence.
[ "First", "start", "of", "frame", "(", "SOFn", ")", "marker", "in", "this", "sequence", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L138-L145
train
Return the first start of frame in this sequence.
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/jpeg.py
_MarkerParser.iter_markers
def iter_markers(self): """ Generate a (marker_code, segment_offset) 2-tuple for each marker in the JPEG *stream*, in the order they occur in the stream. """ marker_finder = _MarkerFinder.from_stream(self._stream) start = 0 marker_code = None while marker_...
python
def iter_markers(self): """ Generate a (marker_code, segment_offset) 2-tuple for each marker in the JPEG *stream*, in the order they occur in the stream. """ marker_finder = _MarkerFinder.from_stream(self._stream) start = 0 marker_code = None while marker_...
[ "def", "iter_markers", "(", "self", ")", ":", "marker_finder", "=", "_MarkerFinder", ".", "from_stream", "(", "self", ".", "_stream", ")", "start", "=", "0", "marker_code", "=", "None", "while", "marker_code", "!=", "JPEG_MARKER_CODE", ".", "EOI", ":", "mark...
Generate a (marker_code, segment_offset) 2-tuple for each marker in the JPEG *stream*, in the order they occur in the stream.
[ "Generate", "a", "(", "marker_code", "segment_offset", ")", "2", "-", "tuple", "for", "each", "marker", "in", "the", "JPEG", "*", "stream", "*", "in", "the", "order", "they", "occur", "in", "the", "stream", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L166-L180
train
Iterate over the ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440 ISO - 1440.
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/jpeg.py
_MarkerFinder.next
def next(self, start): """ Return a (marker_code, segment_offset) 2-tuple identifying and locating the first marker in *stream* occuring after offset *start*. The returned *segment_offset* points to the position immediately following the 2-byte marker code, the start of the marke...
python
def next(self, start): """ Return a (marker_code, segment_offset) 2-tuple identifying and locating the first marker in *stream* occuring after offset *start*. The returned *segment_offset* points to the position immediately following the 2-byte marker code, the start of the marke...
[ "def", "next", "(", "self", ",", "start", ")", ":", "position", "=", "start", "while", "True", ":", "# skip over any non-\\xFF bytes", "position", "=", "self", ".", "_offset_of_next_ff_byte", "(", "start", "=", "position", ")", "# skip over any \\xFF padding bytes",...
Return a (marker_code, segment_offset) 2-tuple identifying and locating the first marker in *stream* occuring after offset *start*. The returned *segment_offset* points to the position immediately following the 2-byte marker code, the start of the marker segment, for those markers that h...
[ "Return", "a", "(", "marker_code", "segment_offset", ")", "2", "-", "tuple", "identifying", "and", "locating", "the", "first", "marker", "in", "*", "stream", "*", "occuring", "after", "offset", "*", "start", "*", ".", "The", "returned", "*", "segment_offset"...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L198-L218
train
Return the next available and available ISO - 8601 marker code and segment 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/jpeg.py
_MarkerFinder._next_non_ff_byte
def _next_non_ff_byte(self, start): """ Return an offset, byte 2-tuple for the next byte in *stream* that is not '\xFF', starting with the byte at offset *start*. If the byte at offset *start* is not '\xFF', *start* and the returned *offset* will be the same. """ ...
python
def _next_non_ff_byte(self, start): """ Return an offset, byte 2-tuple for the next byte in *stream* that is not '\xFF', starting with the byte at offset *start*. If the byte at offset *start* is not '\xFF', *start* and the returned *offset* will be the same. """ ...
[ "def", "_next_non_ff_byte", "(", "self", ",", "start", ")", ":", "self", ".", "_stream", ".", "seek", "(", "start", ")", "byte_", "=", "self", ".", "_read_byte", "(", ")", "while", "byte_", "==", "b'\\xFF'", ":", "byte_", "=", "self", ".", "_read_byte"...
Return an offset, byte 2-tuple for the next byte in *stream* that is not '\xFF', starting with the byte at offset *start*. If the byte at offset *start* is not '\xFF', *start* and the returned *offset* will be the same.
[ "Return", "an", "offset", "byte", "2", "-", "tuple", "for", "the", "next", "byte", "in", "*", "stream", "*", "that", "is", "not", "\\", "xFF", "starting", "with", "the", "byte", "at", "offset", "*", "start", "*", ".", "If", "the", "byte", "at", "of...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L220-L232
train
Return an offset byte 2 - tuple for the next non - FF byte in the stream starting with the offset start.
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/jpeg.py
_MarkerFinder._offset_of_next_ff_byte
def _offset_of_next_ff_byte(self, start): """ Return the offset of the next '\xFF' byte in *stream* starting with the byte at offset *start*. Returns *start* if the byte at that offset is a hex 255; it does not necessarily advance in the stream. """ self._stream.seek(star...
python
def _offset_of_next_ff_byte(self, start): """ Return the offset of the next '\xFF' byte in *stream* starting with the byte at offset *start*. Returns *start* if the byte at that offset is a hex 255; it does not necessarily advance in the stream. """ self._stream.seek(star...
[ "def", "_offset_of_next_ff_byte", "(", "self", ",", "start", ")", ":", "self", ".", "_stream", ".", "seek", "(", "start", ")", "byte_", "=", "self", ".", "_read_byte", "(", ")", "while", "byte_", "!=", "b'\\xFF'", ":", "byte_", "=", "self", ".", "_read...
Return the offset of the next '\xFF' byte in *stream* starting with the byte at offset *start*. Returns *start* if the byte at that offset is a hex 255; it does not necessarily advance in the stream.
[ "Return", "the", "offset", "of", "the", "next", "\\", "xFF", "byte", "in", "*", "stream", "*", "starting", "with", "the", "byte", "at", "offset", "*", "start", "*", ".", "Returns", "*", "start", "*", "if", "the", "byte", "at", "that", "offset", "is",...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L234-L245
train
Return the offset of the next '\xFF' byte in the stream starting with start.
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/jpeg.py
_Marker.from_stream
def from_stream(cls, stream, marker_code, offset): """ Return a generic |_Marker| instance for the marker at *offset* in *stream* having *marker_code*. """ if JPEG_MARKER_CODE.is_standalone(marker_code): segment_length = 0 else: segment_length = st...
python
def from_stream(cls, stream, marker_code, offset): """ Return a generic |_Marker| instance for the marker at *offset* in *stream* having *marker_code*. """ if JPEG_MARKER_CODE.is_standalone(marker_code): segment_length = 0 else: segment_length = st...
[ "def", "from_stream", "(", "cls", ",", "stream", ",", "marker_code", ",", "offset", ")", ":", "if", "JPEG_MARKER_CODE", ".", "is_standalone", "(", "marker_code", ")", ":", "segment_length", "=", "0", "else", ":", "segment_length", "=", "stream", ".", "read_s...
Return a generic |_Marker| instance for the marker at *offset* in *stream* having *marker_code*.
[ "Return", "a", "generic", "|_Marker|", "instance", "for", "the", "marker", "at", "*", "offset", "*", "in", "*", "stream", "*", "having", "*", "marker_code", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L286-L295
train
Create a |_Marker| instance 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/jpeg.py
_App0Marker._dpi
def _dpi(self, density): """ Return dots per inch corresponding to *density* value. """ if self._density_units == 1: dpi = density elif self._density_units == 2: dpi = int(round(density * 2.54)) else: dpi = 72 return dpi
python
def _dpi(self, density): """ Return dots per inch corresponding to *density* value. """ if self._density_units == 1: dpi = density elif self._density_units == 2: dpi = int(round(density * 2.54)) else: dpi = 72 return dpi
[ "def", "_dpi", "(", "self", ",", "density", ")", ":", "if", "self", ".", "_density_units", "==", "1", ":", "dpi", "=", "density", "elif", "self", ".", "_density_units", "==", "2", ":", "dpi", "=", "int", "(", "round", "(", "density", "*", "2.54", "...
Return dots per inch corresponding to *density* value.
[ "Return", "dots", "per", "inch", "corresponding", "to", "*", "density", "*", "value", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L349-L359
train
Return dots per inch corresponding to density value.
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/jpeg.py
_App0Marker.from_stream
def from_stream(cls, stream, marker_code, offset): """ Return an |_App0Marker| instance for the APP0 marker at *offset* in *stream*. """ # field off type notes # ------------------ --- ----- ------------------- # segment length 0 short ...
python
def from_stream(cls, stream, marker_code, offset): """ Return an |_App0Marker| instance for the APP0 marker at *offset* in *stream*. """ # field off type notes # ------------------ --- ----- ------------------- # segment length 0 short ...
[ "def", "from_stream", "(", "cls", ",", "stream", ",", "marker_code", ",", "offset", ")", ":", "# field off type notes", "# ------------------ --- ----- -------------------", "# segment length 0 short", "# JFIF identifier 2 5 chr 'JFIF\\x00'", "# ma...
Return an |_App0Marker| instance for the APP0 marker at *offset* in *stream*.
[ "Return", "an", "|_App0Marker|", "instance", "for", "the", "APP0", "marker", "at", "*", "offset", "*", "in", "*", "stream", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L362-L384
train
Read an APP0 marker from the given stream and return a |_App0Marker| instance.
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/jpeg.py
_App1Marker.from_stream
def from_stream(cls, stream, marker_code, offset): """ Extract the horizontal and vertical dots-per-inch value from the APP1 header at *offset* in *stream*. """ # field off len type notes # -------------------- --- --- ----- -----------------------...
python
def from_stream(cls, stream, marker_code, offset): """ Extract the horizontal and vertical dots-per-inch value from the APP1 header at *offset* in *stream*. """ # field off len type notes # -------------------- --- --- ----- -----------------------...
[ "def", "from_stream", "(", "cls", ",", "stream", ",", "marker_code", ",", "offset", ")", ":", "# field off len type notes", "# -------------------- --- --- ----- ----------------------------", "# segment length 0 2 short", "# Exif identifier ...
Extract the horizontal and vertical dots-per-inch value from the APP1 header at *offset* in *stream*.
[ "Extract", "the", "horizontal", "and", "vertical", "dots", "-", "per", "-", "inch", "value", "from", "the", "APP1", "header", "at", "*", "offset", "*", "in", "*", "stream", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L397-L416
train
Extract the horizontal and vertical dots - per - inch values from the APP1 header 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/jpeg.py
_App1Marker._is_non_Exif_APP1_segment
def _is_non_Exif_APP1_segment(cls, stream, offset): """ Return True if the APP1 segment at *offset* in *stream* is NOT an Exif segment, as determined by the ``'Exif\x00\x00'`` signature at offset 2 in the segment. """ stream.seek(offset+2) exif_signature = stream....
python
def _is_non_Exif_APP1_segment(cls, stream, offset): """ Return True if the APP1 segment at *offset* in *stream* is NOT an Exif segment, as determined by the ``'Exif\x00\x00'`` signature at offset 2 in the segment. """ stream.seek(offset+2) exif_signature = stream....
[ "def", "_is_non_Exif_APP1_segment", "(", "cls", ",", "stream", ",", "offset", ")", ":", "stream", ".", "seek", "(", "offset", "+", "2", ")", "exif_signature", "=", "stream", ".", "read", "(", "6", ")", "return", "exif_signature", "!=", "b'Exif\\x00\\x00'" ]
Return True if the APP1 segment at *offset* in *stream* is NOT an Exif segment, as determined by the ``'Exif\x00\x00'`` signature at offset 2 in the segment.
[ "Return", "True", "if", "the", "APP1", "segment", "at", "*", "offset", "*", "in", "*", "stream", "*", "is", "NOT", "an", "Exif", "segment", "as", "determined", "by", "the", "Exif", "\\", "x00", "\\", "x00", "signature", "at", "offset", "2", "in", "th...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L435-L443
train
Return True if the APP1 segment at offset is NOT an EXIF segment.
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/jpeg.py
_App1Marker._tiff_from_exif_segment
def _tiff_from_exif_segment(cls, stream, offset, segment_length): """ Return a |Tiff| instance parsed from the Exif APP1 segment of *segment_length* at *offset* in *stream*. """ # wrap full segment in its own stream and feed to Tiff() stream.seek(offset+8) segment...
python
def _tiff_from_exif_segment(cls, stream, offset, segment_length): """ Return a |Tiff| instance parsed from the Exif APP1 segment of *segment_length* at *offset* in *stream*. """ # wrap full segment in its own stream and feed to Tiff() stream.seek(offset+8) segment...
[ "def", "_tiff_from_exif_segment", "(", "cls", ",", "stream", ",", "offset", ",", "segment_length", ")", ":", "# wrap full segment in its own stream and feed to Tiff()", "stream", ".", "seek", "(", "offset", "+", "8", ")", "segment_bytes", "=", "stream", ".", "read",...
Return a |Tiff| instance parsed from the Exif APP1 segment of *segment_length* at *offset* in *stream*.
[ "Return", "a", "|Tiff|", "instance", "parsed", "from", "the", "Exif", "APP1", "segment", "of", "*", "segment_length", "*", "at", "*", "offset", "*", "in", "*", "stream", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L446-L455
train
Parse an EXIF segment into a |Tiff| instance.
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/jpeg.py
_SofMarker.from_stream
def from_stream(cls, stream, marker_code, offset): """ Return an |_SofMarker| instance for the SOFn marker at *offset* in stream. """ # field off type notes # ------------------ --- ----- ---------------------------- # segment length 0 ...
python
def from_stream(cls, stream, marker_code, offset): """ Return an |_SofMarker| instance for the SOFn marker at *offset* in stream. """ # field off type notes # ------------------ --- ----- ---------------------------- # segment length 0 ...
[ "def", "from_stream", "(", "cls", ",", "stream", ",", "marker_code", ",", "offset", ")", ":", "# field off type notes", "# ------------------ --- ----- ----------------------------", "# segment length 0 short", "# Data precision 2 byte", "# Verti...
Return an |_SofMarker| instance for the SOFn marker at *offset* in stream.
[ "Return", "an", "|_SofMarker|", "instance", "for", "the", "SOFn", "marker", "at", "*", "offset", "*", "in", "stream", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/jpeg.py#L469-L484
train
Read a SOFn marker from the given stream and return a |_SofMarker| instance.
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/table.py
CT_Row.tc_at_grid_col
def tc_at_grid_col(self, idx): """ The ``<w:tc>`` element appearing at grid column *idx*. Raises |ValueError| if no ``w:tc`` element begins at that grid column. """ grid_col = 0 for tc in self.tc_lst: if grid_col == idx: return tc g...
python
def tc_at_grid_col(self, idx): """ The ``<w:tc>`` element appearing at grid column *idx*. Raises |ValueError| if no ``w:tc`` element begins at that grid column. """ grid_col = 0 for tc in self.tc_lst: if grid_col == idx: return tc g...
[ "def", "tc_at_grid_col", "(", "self", ",", "idx", ")", ":", "grid_col", "=", "0", "for", "tc", "in", "self", ".", "tc_lst", ":", "if", "grid_col", "==", "idx", ":", "return", "tc", "grid_col", "+=", "tc", ".", "grid_span", "if", "grid_col", ">", "idx...
The ``<w:tc>`` element appearing at grid column *idx*. Raises |ValueError| if no ``w:tc`` element begins at that grid column.
[ "The", "<w", ":", "tc", ">", "element", "appearing", "at", "grid", "column", "*", "idx", "*", ".", "Raises", "|ValueError|", "if", "no", "w", ":", "tc", "element", "begins", "at", "that", "grid", "column", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L39-L51
train
Returns the tc element appearing at a given index. Raises |ValueError| if no tc element appearing at that grid column. Raises |ValueError| if no tc element appearing at that grid column.
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/table.py
CT_Tbl.new_tbl
def new_tbl(cls, rows, cols, width): """ Return a new `w:tbl` element having *rows* rows and *cols* columns with *width* distributed evenly between the columns. """ return parse_xml(cls._tbl_xml(rows, cols, width))
python
def new_tbl(cls, rows, cols, width): """ Return a new `w:tbl` element having *rows* rows and *cols* columns with *width* distributed evenly between the columns. """ return parse_xml(cls._tbl_xml(rows, cols, width))
[ "def", "new_tbl", "(", "cls", ",", "rows", ",", "cols", ",", "width", ")", ":", "return", "parse_xml", "(", "cls", ".", "_tbl_xml", "(", "rows", ",", "cols", ",", "width", ")", ")" ]
Return a new `w:tbl` element having *rows* rows and *cols* columns with *width* distributed evenly between the columns.
[ "Return", "a", "new", "w", ":", "tbl", "element", "having", "*", "rows", "*", "rows", "and", "*", "cols", "*", "columns", "with", "*", "width", "*", "distributed", "evenly", "between", "the", "columns", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L153-L158
train
Return a new w : tbl element having rows cols and width distributed evenly between the columns.
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/table.py
CT_Tbl.tblStyle_val
def tblStyle_val(self, styleId): """ Set the value of `w:tblPr/w:tblStyle/@w:val` (a table style id) to *styleId*. If *styleId* is None, remove the `w:tblStyle` element. """ tblPr = self.tblPr tblPr._remove_tblStyle() if styleId is None: return ...
python
def tblStyle_val(self, styleId): """ Set the value of `w:tblPr/w:tblStyle/@w:val` (a table style id) to *styleId*. If *styleId* is None, remove the `w:tblStyle` element. """ tblPr = self.tblPr tblPr._remove_tblStyle() if styleId is None: return ...
[ "def", "tblStyle_val", "(", "self", ",", "styleId", ")", ":", "tblPr", "=", "self", ".", "tblPr", "tblPr", ".", "_remove_tblStyle", "(", ")", "if", "styleId", "is", "None", ":", "return", "tblPr", ".", "_add_tblStyle", "(", ")", ".", "val", "=", "style...
Set the value of `w:tblPr/w:tblStyle/@w:val` (a table style id) to *styleId*. If *styleId* is None, remove the `w:tblStyle` element.
[ "Set", "the", "value", "of", "w", ":", "tblPr", "/", "w", ":", "tblStyle", "/" ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L172-L181
train
Set the value of w : tblPr. tblStyle. val to * styleId*.
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/table.py
CT_TblPr.autofit
def autofit(self): """ Return |False| if there is a ``<w:tblLayout>`` child with ``w:type`` attribute set to ``'fixed'``. Otherwise return |True|. """ tblLayout = self.tblLayout if tblLayout is None: return True return False if tblLayout.type == 'fixed...
python
def autofit(self): """ Return |False| if there is a ``<w:tblLayout>`` child with ``w:type`` attribute set to ``'fixed'``. Otherwise return |True|. """ tblLayout = self.tblLayout if tblLayout is None: return True return False if tblLayout.type == 'fixed...
[ "def", "autofit", "(", "self", ")", ":", "tblLayout", "=", "self", ".", "tblLayout", "if", "tblLayout", "is", "None", ":", "return", "True", "return", "False", "if", "tblLayout", ".", "type", "==", "'fixed'", "else", "True" ]
Return |False| if there is a ``<w:tblLayout>`` child with ``w:type`` attribute set to ``'fixed'``. Otherwise return |True|.
[ "Return", "|False|", "if", "there", "is", "a", "<w", ":", "tblLayout", ">", "child", "with", "w", ":", "type", "attribute", "set", "to", "fixed", ".", "Otherwise", "return", "|True|", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L308-L316
train
Return |True| if there is a child with the type set to fixed. Otherwise return |False|.
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/table.py
CT_Tc.bottom
def bottom(self): """ The row index that marks the bottom extent of the vertical span of this cell. This is one greater than the index of the bottom-most row of the span, similar to how a slice of the cell's rows would be specified. """ if self.vMerge is not None:...
python
def bottom(self): """ The row index that marks the bottom extent of the vertical span of this cell. This is one greater than the index of the bottom-most row of the span, similar to how a slice of the cell's rows would be specified. """ if self.vMerge is not None:...
[ "def", "bottom", "(", "self", ")", ":", "if", "self", ".", "vMerge", "is", "not", "None", ":", "tc_below", "=", "self", ".", "_tc_below", "if", "tc_below", "is", "not", "None", "and", "tc_below", ".", "vMerge", "==", "ST_Merge", ".", "CONTINUE", ":", ...
The row index that marks the bottom extent of the vertical span of this cell. This is one greater than the index of the bottom-most row of the span, similar to how a slice of the cell's rows would be specified.
[ "The", "row", "index", "that", "marks", "the", "bottom", "extent", "of", "the", "vertical", "span", "of", "this", "cell", ".", "This", "is", "one", "greater", "than", "the", "index", "of", "the", "bottom", "-", "most", "row", "of", "the", "span", "simi...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L377-L388
train
Returns the index of the bottom extent of the cell.
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/table.py
CT_Tc.clear_content
def clear_content(self): """ Remove all content child elements, preserving the ``<w:tcPr>`` element if present. Note that this leaves the ``<w:tc>`` element in an invalid state because it doesn't contain at least one block-level element. It's up to the caller to add a ``<w:p>``ch...
python
def clear_content(self): """ Remove all content child elements, preserving the ``<w:tcPr>`` element if present. Note that this leaves the ``<w:tc>`` element in an invalid state because it doesn't contain at least one block-level element. It's up to the caller to add a ``<w:p>``ch...
[ "def", "clear_content", "(", "self", ")", ":", "new_children", "=", "[", "]", "tcPr", "=", "self", ".", "tcPr", "if", "tcPr", "is", "not", "None", ":", "new_children", ".", "append", "(", "tcPr", ")", "self", "[", ":", "]", "=", "new_children" ]
Remove all content child elements, preserving the ``<w:tcPr>`` element if present. Note that this leaves the ``<w:tc>`` element in an invalid state because it doesn't contain at least one block-level element. It's up to the caller to add a ``<w:p>``child element as the last content eleme...
[ "Remove", "all", "content", "child", "elements", "preserving", "the", "<w", ":", "tcPr", ">", "element", "if", "present", ".", "Note", "that", "this", "leaves", "the", "<w", ":", "tc", ">", "element", "in", "an", "invalid", "state", "because", "it", "doe...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L390-L402
train
Removes all content child elements preserving the block - level 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/table.py
CT_Tc.iter_block_items
def iter_block_items(self): """ Generate a reference to each of the block-level content elements in this cell, in the order they appear. """ block_item_tags = (qn('w:p'), qn('w:tbl'), qn('w:sdt')) for child in self: if child.tag in block_item_tags: ...
python
def iter_block_items(self): """ Generate a reference to each of the block-level content elements in this cell, in the order they appear. """ block_item_tags = (qn('w:p'), qn('w:tbl'), qn('w:sdt')) for child in self: if child.tag in block_item_tags: ...
[ "def", "iter_block_items", "(", "self", ")", ":", "block_item_tags", "=", "(", "qn", "(", "'w:p'", ")", ",", "qn", "(", "'w:tbl'", ")", ",", "qn", "(", "'w:sdt'", ")", ")", "for", "child", "in", "self", ":", "if", "child", ".", "tag", "in", "block_...
Generate a reference to each of the block-level content elements in this cell, in the order they appear.
[ "Generate", "a", "reference", "to", "each", "of", "the", "block", "-", "level", "content", "elements", "in", "this", "cell", "in", "the", "order", "they", "appear", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L420-L428
train
Iterate over the block - level content elements in this cell.
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/table.py
CT_Tc.merge
def merge(self, other_tc): """ Return the top-left ``<w:tc>`` element of a new span formed by merging the rectangular region defined by using this tc element and *other_tc* as diagonal corners. """ top, left, height, width = self._span_dimensions(other_tc) top_tc ...
python
def merge(self, other_tc): """ Return the top-left ``<w:tc>`` element of a new span formed by merging the rectangular region defined by using this tc element and *other_tc* as diagonal corners. """ top, left, height, width = self._span_dimensions(other_tc) top_tc ...
[ "def", "merge", "(", "self", ",", "other_tc", ")", ":", "top", ",", "left", ",", "height", ",", "width", "=", "self", ".", "_span_dimensions", "(", "other_tc", ")", "top_tc", "=", "self", ".", "_tbl", ".", "tr_lst", "[", "top", "]", ".", "tc_at_grid_...
Return the top-left ``<w:tc>`` element of a new span formed by merging the rectangular region defined by using this tc element and *other_tc* as diagonal corners.
[ "Return", "the", "top", "-", "left", "<w", ":", "tc", ">", "element", "of", "a", "new", "span", "formed", "by", "merging", "the", "rectangular", "region", "defined", "by", "using", "this", "tc", "element", "and", "*", "other_tc", "*", "as", "diagonal", ...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L437-L446
train
Return the top - left element of a new span formed by this tc element and other_tc as diagonal corners.
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/table.py
CT_Tc.top
def top(self): """ The top-most row index in the vertical span of this cell. """ if self.vMerge is None or self.vMerge == ST_Merge.RESTART: return self._tr_idx return self._tc_above.top
python
def top(self): """ The top-most row index in the vertical span of this cell. """ if self.vMerge is None or self.vMerge == ST_Merge.RESTART: return self._tr_idx return self._tc_above.top
[ "def", "top", "(", "self", ")", ":", "if", "self", ".", "vMerge", "is", "None", "or", "self", ".", "vMerge", "==", "ST_Merge", ".", "RESTART", ":", "return", "self", ".", "_tr_idx", "return", "self", ".", "_tc_above", ".", "top" ]
The top-most row index in the vertical span of this cell.
[ "The", "top", "-", "most", "row", "index", "in", "the", "vertical", "span", "of", "this", "cell", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L471-L477
train
Returns the top - most row index in the vertical span of this cell.
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/table.py
CT_Tc._add_width_of
def _add_width_of(self, other_tc): """ Add the width of *other_tc* to this cell. Does nothing if either this tc or *other_tc* does not have a specified width. """ if self.width and other_tc.width: self.width += other_tc.width
python
def _add_width_of(self, other_tc): """ Add the width of *other_tc* to this cell. Does nothing if either this tc or *other_tc* does not have a specified width. """ if self.width and other_tc.width: self.width += other_tc.width
[ "def", "_add_width_of", "(", "self", ",", "other_tc", ")", ":", "if", "self", ".", "width", "and", "other_tc", ".", "width", ":", "self", ".", "width", "+=", "other_tc", ".", "width" ]
Add the width of *other_tc* to this cell. Does nothing if either this tc or *other_tc* does not have a specified width.
[ "Add", "the", "width", "of", "*", "other_tc", "*", "to", "this", "cell", ".", "Does", "nothing", "if", "either", "this", "tc", "or", "*", "other_tc", "*", "does", "not", "have", "a", "specified", "width", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L511-L517
train
Add the width of other_tc to this cell. Does nothing if self. width is not equal to other_tc.
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/table.py
CT_Tc._grid_col
def _grid_col(self): """ The grid column at which this cell begins. """ tr = self._tr idx = tr.tc_lst.index(self) preceding_tcs = tr.tc_lst[:idx] return sum(tc.grid_span for tc in preceding_tcs)
python
def _grid_col(self): """ The grid column at which this cell begins. """ tr = self._tr idx = tr.tc_lst.index(self) preceding_tcs = tr.tc_lst[:idx] return sum(tc.grid_span for tc in preceding_tcs)
[ "def", "_grid_col", "(", "self", ")", ":", "tr", "=", "self", ".", "_tr", "idx", "=", "tr", ".", "tc_lst", ".", "index", "(", "self", ")", "preceding_tcs", "=", "tr", ".", "tc_lst", "[", ":", "idx", "]", "return", "sum", "(", "tc", ".", "grid_spa...
The grid column at which this cell begins.
[ "The", "grid", "column", "at", "which", "this", "cell", "begins", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L520-L527
train
The number of grid columns before this cell.
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/table.py
CT_Tc._grow_to
def _grow_to(self, width, height, top_tc=None): """ Grow this cell to *width* grid columns and *height* rows by expanding horizontal spans and creating continuation cells to form vertical spans. """ def vMerge_val(top_tc): if top_tc is not self: ...
python
def _grow_to(self, width, height, top_tc=None): """ Grow this cell to *width* grid columns and *height* rows by expanding horizontal spans and creating continuation cells to form vertical spans. """ def vMerge_val(top_tc): if top_tc is not self: ...
[ "def", "_grow_to", "(", "self", ",", "width", ",", "height", ",", "top_tc", "=", "None", ")", ":", "def", "vMerge_val", "(", "top_tc", ")", ":", "if", "top_tc", "is", "not", "self", ":", "return", "ST_Merge", ".", "CONTINUE", "if", "height", "==", "1...
Grow this cell to *width* grid columns and *height* rows by expanding horizontal spans and creating continuation cells to form vertical spans.
[ "Grow", "this", "cell", "to", "*", "width", "*", "grid", "columns", "and", "*", "height", "*", "rows", "by", "expanding", "horizontal", "spans", "and", "creating", "continuation", "cells", "to", "form", "vertical", "spans", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L529-L545
train
Grow this cell to width height by expanding horizontal spans and creating continuation cells for vertical ones.
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/table.py
CT_Tc._is_empty
def _is_empty(self): """ True if this cell contains only a single empty ``<w:p>`` element. """ block_items = list(self.iter_block_items()) if len(block_items) > 1: return False p = block_items[0] # cell must include at least one <w:p> element if len(p...
python
def _is_empty(self): """ True if this cell contains only a single empty ``<w:p>`` element. """ block_items = list(self.iter_block_items()) if len(block_items) > 1: return False p = block_items[0] # cell must include at least one <w:p> element if len(p...
[ "def", "_is_empty", "(", "self", ")", ":", "block_items", "=", "list", "(", "self", ".", "iter_block_items", "(", ")", ")", "if", "len", "(", "block_items", ")", ">", "1", ":", "return", "False", "p", "=", "block_items", "[", "0", "]", "# cell must inc...
True if this cell contains only a single empty ``<w:p>`` element.
[ "True", "if", "this", "cell", "contains", "only", "a", "single", "empty", "<w", ":", "p", ">", "element", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L557-L567
train
Returns True if this cell contains only a single empty 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/table.py
CT_Tc._move_content_to
def _move_content_to(self, other_tc): """ Append the content of this cell to *other_tc*, leaving this cell with a single empty ``<w:p>`` element. """ if other_tc is self: return if self._is_empty: return other_tc._remove_trailing_empty_p() ...
python
def _move_content_to(self, other_tc): """ Append the content of this cell to *other_tc*, leaving this cell with a single empty ``<w:p>`` element. """ if other_tc is self: return if self._is_empty: return other_tc._remove_trailing_empty_p() ...
[ "def", "_move_content_to", "(", "self", ",", "other_tc", ")", ":", "if", "other_tc", "is", "self", ":", "return", "if", "self", ".", "_is_empty", ":", "return", "other_tc", ".", "_remove_trailing_empty_p", "(", ")", "# appending moves each element from self to other...
Append the content of this cell to *other_tc*, leaving this cell with a single empty ``<w:p>`` element.
[ "Append", "the", "content", "of", "this", "cell", "to", "*", "other_tc", "*", "leaving", "this", "cell", "with", "a", "single", "empty", "<w", ":", "p", ">", "element", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L569-L583
train
Moves the content of this cell to other_tc.
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/table.py
CT_Tc._remove_trailing_empty_p
def _remove_trailing_empty_p(self): """ Remove the last content element from this cell if it is an empty ``<w:p>`` element. """ block_items = list(self.iter_block_items()) last_content_elm = block_items[-1] if last_content_elm.tag != qn('w:p'): return ...
python
def _remove_trailing_empty_p(self): """ Remove the last content element from this cell if it is an empty ``<w:p>`` element. """ block_items = list(self.iter_block_items()) last_content_elm = block_items[-1] if last_content_elm.tag != qn('w:p'): return ...
[ "def", "_remove_trailing_empty_p", "(", "self", ")", ":", "block_items", "=", "list", "(", "self", ".", "iter_block_items", "(", ")", ")", "last_content_elm", "=", "block_items", "[", "-", "1", "]", "if", "last_content_elm", ".", "tag", "!=", "qn", "(", "'...
Remove the last content element from this cell if it is an empty ``<w:p>`` element.
[ "Remove", "the", "last", "content", "element", "from", "this", "cell", "if", "it", "is", "an", "empty", "<w", ":", "p", ">", "element", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L603-L615
train
Remove the last empty content element from this cell if it is an empty 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/table.py
CT_Tc._span_dimensions
def _span_dimensions(self, other_tc): """ Return a (top, left, height, width) 4-tuple specifying the extents of the merged cell formed by using this tc and *other_tc* as opposite corner extents. """ def raise_on_inverted_L(a, b): if a.top == b.top and a.bottom...
python
def _span_dimensions(self, other_tc): """ Return a (top, left, height, width) 4-tuple specifying the extents of the merged cell formed by using this tc and *other_tc* as opposite corner extents. """ def raise_on_inverted_L(a, b): if a.top == b.top and a.bottom...
[ "def", "_span_dimensions", "(", "self", ",", "other_tc", ")", ":", "def", "raise_on_inverted_L", "(", "a", ",", "b", ")", ":", "if", "a", ".", "top", "==", "b", ".", "top", "and", "a", ".", "bottom", "!=", "b", ".", "bottom", ":", "raise", "Invalid...
Return a (top, left, height, width) 4-tuple specifying the extents of the merged cell formed by using this tc and *other_tc* as opposite corner extents.
[ "Return", "a", "(", "top", "left", "height", "width", ")", "4", "-", "tuple", "specifying", "the", "extents", "of", "the", "merged", "cell", "formed", "by", "using", "this", "tc", "and", "*", "other_tc", "*", "as", "opposite", "corner", "extents", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L617-L646
train
Return the top left height and width of the merged cell formed by using this tc and other_tc as opposite ArcGIS corner extents.
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/table.py
CT_Tc._span_to_width
def _span_to_width(self, grid_width, top_tc, vMerge): """ Incorporate and then remove `w:tc` elements to the right of this one until this cell spans *grid_width*. Raises |ValueError| if *grid_width* cannot be exactly achieved, such as when a merged cell would drive the span width...
python
def _span_to_width(self, grid_width, top_tc, vMerge): """ Incorporate and then remove `w:tc` elements to the right of this one until this cell spans *grid_width*. Raises |ValueError| if *grid_width* cannot be exactly achieved, such as when a merged cell would drive the span width...
[ "def", "_span_to_width", "(", "self", ",", "grid_width", ",", "top_tc", ",", "vMerge", ")", ":", "self", ".", "_move_content_to", "(", "top_tc", ")", "while", "self", ".", "grid_span", "<", "grid_width", ":", "self", ".", "_swallow_next_tc", "(", "grid_width...
Incorporate and then remove `w:tc` elements to the right of this one until this cell spans *grid_width*. Raises |ValueError| if *grid_width* cannot be exactly achieved, such as when a merged cell would drive the span width greater than *grid_width* or if not enough grid columns are avail...
[ "Incorporate", "and", "then", "remove", "w", ":", "tc", "elements", "to", "the", "right", "of", "this", "one", "until", "this", "cell", "spans", "*", "grid_width", "*", ".", "Raises", "|ValueError|", "if", "*", "grid_width", "*", "cannot", "be", "exactly",...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L648-L662
train
Incorporate and then remove w : tc elements from the right of this oneCOOKIE.
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/table.py
CT_Tc._swallow_next_tc
def _swallow_next_tc(self, grid_width, top_tc): """ Extend the horizontal span of this `w:tc` element to incorporate the following `w:tc` element in the row and then delete that following `w:tc` element. Any content in the following `w:tc` element is appended to the content of *t...
python
def _swallow_next_tc(self, grid_width, top_tc): """ Extend the horizontal span of this `w:tc` element to incorporate the following `w:tc` element in the row and then delete that following `w:tc` element. Any content in the following `w:tc` element is appended to the content of *t...
[ "def", "_swallow_next_tc", "(", "self", ",", "grid_width", ",", "top_tc", ")", ":", "def", "raise_on_invalid_swallow", "(", "next_tc", ")", ":", "if", "next_tc", "is", "None", ":", "raise", "InvalidSpanError", "(", "'not enough grid columns'", ")", "if", "self",...
Extend the horizontal span of this `w:tc` element to incorporate the following `w:tc` element in the row and then delete that following `w:tc` element. Any content in the following `w:tc` element is appended to the content of *top_tc*. The width of the following `w:tc` element is added t...
[ "Extend", "the", "horizontal", "span", "of", "this", "w", ":", "tc", "element", "to", "incorporate", "the", "following", "w", ":", "tc", "element", "in", "the", "row", "and", "then", "delete", "that", "following", "w", ":", "tc", "element", ".", "Any", ...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L664-L685
train
Swallows the next <w : tc element in the row.
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/table.py
CT_Tc._tc_below
def _tc_below(self): """ The tc element immediately below this one in its grid column. """ tr_below = self._tr_below if tr_below is None: return None return tr_below.tc_at_grid_col(self._grid_col)
python
def _tc_below(self): """ The tc element immediately below this one in its grid column. """ tr_below = self._tr_below if tr_below is None: return None return tr_below.tc_at_grid_col(self._grid_col)
[ "def", "_tc_below", "(", "self", ")", ":", "tr_below", "=", "self", ".", "_tr_below", "if", "tr_below", "is", "None", ":", "return", "None", "return", "tr_below", ".", "tc_at_grid_col", "(", "self", ".", "_grid_col", ")" ]
The tc element immediately below this one in its grid column.
[ "The", "tc", "element", "immediately", "below", "this", "one", "in", "its", "grid", "column", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L702-L709
train
The tc element immediately below this one in its grid column.
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/table.py
CT_Tc._tr_above
def _tr_above(self): """ The tr element prior in sequence to the tr this cell appears in. Raises |ValueError| if called on a cell in the top-most row. """ tr_lst = self._tbl.tr_lst tr_idx = tr_lst.index(self._tr) if tr_idx == 0: raise ValueError('no tr...
python
def _tr_above(self): """ The tr element prior in sequence to the tr this cell appears in. Raises |ValueError| if called on a cell in the top-most row. """ tr_lst = self._tbl.tr_lst tr_idx = tr_lst.index(self._tr) if tr_idx == 0: raise ValueError('no tr...
[ "def", "_tr_above", "(", "self", ")", ":", "tr_lst", "=", "self", ".", "_tbl", ".", "tr_lst", "tr_idx", "=", "tr_lst", ".", "index", "(", "self", ".", "_tr", ")", "if", "tr_idx", "==", "0", ":", "raise", "ValueError", "(", "'no tr above topmost tr'", "...
The tr element prior in sequence to the tr this cell appears in. Raises |ValueError| if called on a cell in the top-most row.
[ "The", "tr", "element", "prior", "in", "sequence", "to", "the", "tr", "this", "cell", "appears", "in", ".", "Raises", "|ValueError|", "if", "called", "on", "a", "cell", "in", "the", "top", "-", "most", "row", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L719-L728
train
The tr element prior in sequence to the tr this cell appears in. Raises |ValueError| if called on a top - most cell.
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/table.py
CT_Tc._tr_below
def _tr_below(self): """ The tr element next in sequence after the tr this cell appears in, or |None| if this cell appears in the last row. """ tr_lst = self._tbl.tr_lst tr_idx = tr_lst.index(self._tr) try: return tr_lst[tr_idx+1] except IndexE...
python
def _tr_below(self): """ The tr element next in sequence after the tr this cell appears in, or |None| if this cell appears in the last row. """ tr_lst = self._tbl.tr_lst tr_idx = tr_lst.index(self._tr) try: return tr_lst[tr_idx+1] except IndexE...
[ "def", "_tr_below", "(", "self", ")", ":", "tr_lst", "=", "self", ".", "_tbl", ".", "tr_lst", "tr_idx", "=", "tr_lst", ".", "index", "(", "self", ".", "_tr", ")", "try", ":", "return", "tr_lst", "[", "tr_idx", "+", "1", "]", "except", "IndexError", ...
The tr element next in sequence after the tr this cell appears in, or |None| if this cell appears in the last row.
[ "The", "tr", "element", "next", "in", "sequence", "after", "the", "tr", "this", "cell", "appears", "in", "or", "|None|", "if", "this", "cell", "appears", "in", "the", "last", "row", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/table.py#L731-L741
train
The tr element next in sequence after the tr this cell appears in or |None| if this cell appears in the last row.
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/enum/base.py
alias
def alias(*aliases): """ Decorating a class with @alias('FOO', 'BAR', ..) allows the class to be referenced by each of the names provided as arguments. """ def decorator(cls): # alias must be set in globals from caller's frame caller = sys._getframe(1) globals_dict = caller.f...
python
def alias(*aliases): """ Decorating a class with @alias('FOO', 'BAR', ..) allows the class to be referenced by each of the names provided as arguments. """ def decorator(cls): # alias must be set in globals from caller's frame caller = sys._getframe(1) globals_dict = caller.f...
[ "def", "alias", "(", "*", "aliases", ")", ":", "def", "decorator", "(", "cls", ")", ":", "# alias must be set in globals from caller's frame", "caller", "=", "sys", ".", "_getframe", "(", "1", ")", "globals_dict", "=", "caller", ".", "f_globals", "for", "alias...
Decorating a class with @alias('FOO', 'BAR', ..) allows the class to be referenced by each of the names provided as arguments.
[ "Decorating", "a", "class", "with" ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/enum/base.py#L15-L27
train
A class decorator that adds an alias to the class to be referenced by each of the names provided as arguments.
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/enum/base.py
_DocsPageFormatter.page_str
def page_str(self): """ The RestructuredText documentation page for the enumeration. This is the only API member for the class. """ tmpl = '.. _%s:\n\n%s\n\n%s\n\n----\n\n%s' components = ( self._ms_name, self._page_title, self._intro_text, self._m...
python
def page_str(self): """ The RestructuredText documentation page for the enumeration. This is the only API member for the class. """ tmpl = '.. _%s:\n\n%s\n\n%s\n\n----\n\n%s' components = ( self._ms_name, self._page_title, self._intro_text, self._m...
[ "def", "page_str", "(", "self", ")", ":", "tmpl", "=", "'.. _%s:\\n\\n%s\\n\\n%s\\n\\n----\\n\\n%s'", "components", "=", "(", "self", ".", "_ms_name", ",", "self", ".", "_page_title", ",", "self", ".", "_intro_text", ",", "self", ".", "_member_defs", ")", "ret...
The RestructuredText documentation page for the enumeration. This is the only API member for the class.
[ "The", "RestructuredText", "documentation", "page", "for", "the", "enumeration", ".", "This", "is", "the", "only", "API", "member", "for", "the", "class", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/enum/base.py#L43-L53
train
Return a string representation of the enumeration page.
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/enum/base.py
_DocsPageFormatter._intro_text
def _intro_text(self): """Docstring of the enumeration, formatted for documentation page.""" try: cls_docstring = self._clsdict['__doc__'] except KeyError: cls_docstring = '' if cls_docstring is None: return '' return textwrap.dedent(cls_docs...
python
def _intro_text(self): """Docstring of the enumeration, formatted for documentation page.""" try: cls_docstring = self._clsdict['__doc__'] except KeyError: cls_docstring = '' if cls_docstring is None: return '' return textwrap.dedent(cls_docs...
[ "def", "_intro_text", "(", "self", ")", ":", "try", ":", "cls_docstring", "=", "self", ".", "_clsdict", "[", "'__doc__'", "]", "except", "KeyError", ":", "cls_docstring", "=", "''", "if", "cls_docstring", "is", "None", ":", "return", "''", "return", "textw...
Docstring of the enumeration, formatted for documentation page.
[ "Docstring", "of", "the", "enumeration", "formatted", "for", "documentation", "page", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/enum/base.py#L56-L66
train
Return the enumeration docstring formatted for documentation page.
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/enum/base.py
_DocsPageFormatter._member_def
def _member_def(self, member): """ Return an individual member definition formatted as an RST glossary entry, wrapped to fit within 78 columns. """ member_docstring = textwrap.dedent(member.docstring).strip() member_docstring = textwrap.fill( member_docstring,...
python
def _member_def(self, member): """ Return an individual member definition formatted as an RST glossary entry, wrapped to fit within 78 columns. """ member_docstring = textwrap.dedent(member.docstring).strip() member_docstring = textwrap.fill( member_docstring,...
[ "def", "_member_def", "(", "self", ",", "member", ")", ":", "member_docstring", "=", "textwrap", ".", "dedent", "(", "member", ".", "docstring", ")", ".", "strip", "(", ")", "member_docstring", "=", "textwrap", ".", "fill", "(", "member_docstring", ",", "w...
Return an individual member definition formatted as an RST glossary entry, wrapped to fit within 78 columns.
[ "Return", "an", "individual", "member", "definition", "formatted", "as", "an", "RST", "glossary", "entry", "wrapped", "to", "fit", "within", "78", "columns", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/enum/base.py#L68-L78
train
Return an individual member definition formatted as an RST glossary 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/enum/base.py
_DocsPageFormatter._member_defs
def _member_defs(self): """ A single string containing the aggregated member definitions section of the documentation page """ members = self._clsdict['__members__'] member_defs = [ self._member_def(member) for member in members if member.name is n...
python
def _member_defs(self): """ A single string containing the aggregated member definitions section of the documentation page """ members = self._clsdict['__members__'] member_defs = [ self._member_def(member) for member in members if member.name is n...
[ "def", "_member_defs", "(", "self", ")", ":", "members", "=", "self", ".", "_clsdict", "[", "'__members__'", "]", "member_defs", "=", "[", "self", ".", "_member_def", "(", "member", ")", "for", "member", "in", "members", "if", "member", ".", "name", "is"...
A single string containing the aggregated member definitions section of the documentation page
[ "A", "single", "string", "containing", "the", "aggregated", "member", "definitions", "section", "of", "the", "documentation", "page" ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/enum/base.py#L81-L91
train
A single string containing the aggregated member definitions section of the documentation page
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/enum/base.py
MetaEnumeration._add_enum_members
def _add_enum_members(meta, clsdict): """ Dispatch ``.add_to_enum()`` call to each member so it can do its thing to properly add itself to the enumeration class. This delegation allows member sub-classes to add specialized behaviors. """ enum_members = clsdict['__members_...
python
def _add_enum_members(meta, clsdict): """ Dispatch ``.add_to_enum()`` call to each member so it can do its thing to properly add itself to the enumeration class. This delegation allows member sub-classes to add specialized behaviors. """ enum_members = clsdict['__members_...
[ "def", "_add_enum_members", "(", "meta", ",", "clsdict", ")", ":", "enum_members", "=", "clsdict", "[", "'__members__'", "]", "for", "member", "in", "enum_members", ":", "member", ".", "add_to_enum", "(", "clsdict", ")" ]
Dispatch ``.add_to_enum()`` call to each member so it can do its thing to properly add itself to the enumeration class. This delegation allows member sub-classes to add specialized behaviors.
[ "Dispatch", ".", "add_to_enum", "()", "call", "to", "each", "member", "so", "it", "can", "do", "its", "thing", "to", "properly", "add", "itself", "to", "the", "enumeration", "class", ".", "This", "delegation", "allows", "member", "sub", "-", "classes", "to...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/enum/base.py#L123-L131
train
Dispatches each member of the enumeration class to each member of the enumeration class.
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/enum/base.py
MetaEnumeration._collect_valid_settings
def _collect_valid_settings(meta, clsdict): """ Return a sequence containing the enumeration values that are valid assignment values. Return-only values are excluded. """ enum_members = clsdict['__members__'] valid_settings = [] for member in enum_members: ...
python
def _collect_valid_settings(meta, clsdict): """ Return a sequence containing the enumeration values that are valid assignment values. Return-only values are excluded. """ enum_members = clsdict['__members__'] valid_settings = [] for member in enum_members: ...
[ "def", "_collect_valid_settings", "(", "meta", ",", "clsdict", ")", ":", "enum_members", "=", "clsdict", "[", "'__members__'", "]", "valid_settings", "=", "[", "]", "for", "member", "in", "enum_members", ":", "valid_settings", ".", "extend", "(", "member", "."...
Return a sequence containing the enumeration values that are valid assignment values. Return-only values are excluded.
[ "Return", "a", "sequence", "containing", "the", "enumeration", "values", "that", "are", "valid", "assignment", "values", ".", "Return", "-", "only", "values", "are", "excluded", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/enum/base.py#L134-L143
train
Collect the valid_settings from the meta class and add them to the classdict.
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/enum/base.py
EnumerationBase.validate
def validate(cls, value): """ Raise |ValueError| if *value* is not an assignable value. """ if value not in cls._valid_settings: raise ValueError( "%s not a member of %s enumeration" % (value, cls.__name__) )
python
def validate(cls, value): """ Raise |ValueError| if *value* is not an assignable value. """ if value not in cls._valid_settings: raise ValueError( "%s not a member of %s enumeration" % (value, cls.__name__) )
[ "def", "validate", "(", "cls", ",", "value", ")", ":", "if", "value", "not", "in", "cls", ".", "_valid_settings", ":", "raise", "ValueError", "(", "\"%s not a member of %s enumeration\"", "%", "(", "value", ",", "cls", ".", "__name__", ")", ")" ]
Raise |ValueError| if *value* is not an assignable value.
[ "Raise", "|ValueError|", "if", "*", "value", "*", "is", "not", "an", "assignable", "value", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/enum/base.py#L165-L172
train
Validate the value of the resource.
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/enum/base.py
XmlEnumeration.from_xml
def from_xml(cls, xml_val): """ Return the enumeration member corresponding to the XML value *xml_val*. """ if xml_val not in cls._xml_to_member: raise InvalidXmlError( "attribute value '%s' not valid for this type" % xml_val ) retu...
python
def from_xml(cls, xml_val): """ Return the enumeration member corresponding to the XML value *xml_val*. """ if xml_val not in cls._xml_to_member: raise InvalidXmlError( "attribute value '%s' not valid for this type" % xml_val ) retu...
[ "def", "from_xml", "(", "cls", ",", "xml_val", ")", ":", "if", "xml_val", "not", "in", "cls", ".", "_xml_to_member", ":", "raise", "InvalidXmlError", "(", "\"attribute value '%s' not valid for this type\"", "%", "xml_val", ")", "return", "cls", ".", "_xml_to_membe...
Return the enumeration member corresponding to the XML value *xml_val*.
[ "Return", "the", "enumeration", "member", "corresponding", "to", "the", "XML", "value", "*", "xml_val", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/enum/base.py#L189-L198
train
Return the enumeration member corresponding to the XML value xml_val.
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/enum/base.py
XmlEnumeration.to_xml
def to_xml(cls, enum_val): """ Return the XML value of the enumeration value *enum_val*. """ if enum_val not in cls._member_to_xml: raise ValueError( "value '%s' not in enumeration %s" % (enum_val, cls.__name__) ) return cls._member_to_xml[...
python
def to_xml(cls, enum_val): """ Return the XML value of the enumeration value *enum_val*. """ if enum_val not in cls._member_to_xml: raise ValueError( "value '%s' not in enumeration %s" % (enum_val, cls.__name__) ) return cls._member_to_xml[...
[ "def", "to_xml", "(", "cls", ",", "enum_val", ")", ":", "if", "enum_val", "not", "in", "cls", ".", "_member_to_xml", ":", "raise", "ValueError", "(", "\"value '%s' not in enumeration %s\"", "%", "(", "enum_val", ",", "cls", ".", "__name__", ")", ")", "return...
Return the XML value of the enumeration value *enum_val*.
[ "Return", "the", "XML", "value", "of", "the", "enumeration", "value", "*", "enum_val", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/enum/base.py#L201-L209
train
Return the XML value of the enumeration value enum_val.
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/enum/base.py
EnumMember.register_name
def register_name(self, clsdict): """ Add a member name to the class dict *clsdict* containing the value of this member object. Where the name of this object is None, do nothing; this allows out-of-band values to be defined without adding a name to the class dict. """ ...
python
def register_name(self, clsdict): """ Add a member name to the class dict *clsdict* containing the value of this member object. Where the name of this object is None, do nothing; this allows out-of-band values to be defined without adding a name to the class dict. """ ...
[ "def", "register_name", "(", "self", ",", "clsdict", ")", ":", "if", "self", ".", "name", "is", "None", ":", "return", "clsdict", "[", "self", ".", "name", "]", "=", "self", ".", "value" ]
Add a member name to the class dict *clsdict* containing the value of this member object. Where the name of this object is None, do nothing; this allows out-of-band values to be defined without adding a name to the class dict.
[ "Add", "a", "member", "name", "to", "the", "class", "dict", "*", "clsdict", "*", "containing", "the", "value", "of", "this", "member", "object", ".", "Where", "the", "name", "of", "this", "object", "is", "None", "do", "nothing", ";", "this", "allows", ...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/enum/base.py#L247-L256
train
Add a member name to the class dict clsdict containing the value of this member 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/enum/base.py
XmlMappedEnumMember.add_to_enum
def add_to_enum(self, clsdict): """ Compile XML mappings in addition to base add behavior. """ super(XmlMappedEnumMember, self).add_to_enum(clsdict) self.register_xml_mapping(clsdict)
python
def add_to_enum(self, clsdict): """ Compile XML mappings in addition to base add behavior. """ super(XmlMappedEnumMember, self).add_to_enum(clsdict) self.register_xml_mapping(clsdict)
[ "def", "add_to_enum", "(", "self", ",", "clsdict", ")", ":", "super", "(", "XmlMappedEnumMember", ",", "self", ")", ".", "add_to_enum", "(", "clsdict", ")", "self", ".", "register_xml_mapping", "(", "clsdict", ")" ]
Compile XML mappings in addition to base add behavior.
[ "Compile", "XML", "mappings", "in", "addition", "to", "base", "add", "behavior", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/enum/base.py#L324-L329
train
Add XML mappings to the enumeration.
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/enum/base.py
XmlMappedEnumMember.register_xml_mapping
def register_xml_mapping(self, clsdict): """ Add XML mappings to the enumeration class state for this member. """ member_to_xml = self._get_or_add_member_to_xml(clsdict) member_to_xml[self.value] = self.xml_value xml_to_member = self._get_or_add_xml_to_member(clsdict) ...
python
def register_xml_mapping(self, clsdict): """ Add XML mappings to the enumeration class state for this member. """ member_to_xml = self._get_or_add_member_to_xml(clsdict) member_to_xml[self.value] = self.xml_value xml_to_member = self._get_or_add_xml_to_member(clsdict) ...
[ "def", "register_xml_mapping", "(", "self", ",", "clsdict", ")", ":", "member_to_xml", "=", "self", ".", "_get_or_add_member_to_xml", "(", "clsdict", ")", "member_to_xml", "[", "self", ".", "value", "]", "=", "self", ".", "xml_value", "xml_to_member", "=", "se...
Add XML mappings to the enumeration class state for this member.
[ "Add", "XML", "mappings", "to", "the", "enumeration", "class", "state", "for", "this", "member", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/enum/base.py#L331-L338
train
Add XML mappings to the enumeration class state for this member.
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/api.py
Document
def Document(docx=None): """ Return a |Document| object loaded from *docx*, where *docx* can be either a path to a ``.docx`` file (a string) or a file-like object. If *docx* is missing or ``None``, the built-in default document "template" is loaded. """ docx = _default_docx_path() if docx is...
python
def Document(docx=None): """ Return a |Document| object loaded from *docx*, where *docx* can be either a path to a ``.docx`` file (a string) or a file-like object. If *docx* is missing or ``None``, the built-in default document "template" is loaded. """ docx = _default_docx_path() if docx is...
[ "def", "Document", "(", "docx", "=", "None", ")", ":", "docx", "=", "_default_docx_path", "(", ")", "if", "docx", "is", "None", "else", "docx", "document_part", "=", "Package", ".", "open", "(", "docx", ")", ".", "main_document_part", "if", "document_part"...
Return a |Document| object loaded from *docx*, where *docx* can be either a path to a ``.docx`` file (a string) or a file-like object. If *docx* is missing or ``None``, the built-in default document "template" is loaded.
[ "Return", "a", "|Document|", "object", "loaded", "from", "*", "docx", "*", "where", "*", "docx", "*", "can", "be", "either", "a", "path", "to", "a", ".", "docx", "file", "(", "a", "string", ")", "or", "a", "file", "-", "like", "object", ".", "If", ...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/api.py#L17-L29
train
Return a |Document| object loaded from a. docx file or 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/api.py
_default_docx_path
def _default_docx_path(): """ Return the path to the built-in default .docx package. """ _thisdir = os.path.split(__file__)[0] return os.path.join(_thisdir, 'templates', 'default-docx-template')
python
def _default_docx_path(): """ Return the path to the built-in default .docx package. """ _thisdir = os.path.split(__file__)[0] return os.path.join(_thisdir, 'templates', 'default-docx-template')
[ "def", "_default_docx_path", "(", ")", ":", "_thisdir", "=", "os", ".", "path", ".", "split", "(", "__file__", ")", "[", "0", "]", "return", "os", ".", "path", ".", "join", "(", "_thisdir", ",", "'templates'", ",", "'default-docx-template'", ")" ]
Return the path to the built-in default .docx package.
[ "Return", "the", "path", "to", "the", "built", "-", "in", "default", ".", "docx", "package", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/api.py#L32-L37
train
Return the path to the built - in default. docx 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/text/parfmt.py
ParagraphFormat.line_spacing
def line_spacing(self): """ |float| or |Length| value specifying the space between baselines in successive lines of the paragraph. A value of |None| indicates line spacing is inherited from the style hierarchy. A float value, e.g. ``2.0`` or ``1.75``, indicates spacing is applied...
python
def line_spacing(self): """ |float| or |Length| value specifying the space between baselines in successive lines of the paragraph. A value of |None| indicates line spacing is inherited from the style hierarchy. A float value, e.g. ``2.0`` or ``1.75``, indicates spacing is applied...
[ "def", "line_spacing", "(", "self", ")", ":", "pPr", "=", "self", ".", "_element", ".", "pPr", "if", "pPr", "is", "None", ":", "return", "None", "return", "self", ".", "_line_spacing", "(", "pPr", ".", "spacing_line", ",", "pPr", ".", "spacing_lineRule",...
|float| or |Length| value specifying the space between baselines in successive lines of the paragraph. A value of |None| indicates line spacing is inherited from the style hierarchy. A float value, e.g. ``2.0`` or ``1.75``, indicates spacing is applied in multiples of line heights. A |Le...
[ "|float|", "or", "|Length|", "value", "specifying", "the", "space", "between", "baselines", "in", "successive", "lines", "of", "the", "paragraph", ".", "A", "value", "of", "|None|", "indicates", "line", "spacing", "is", "inherited", "from", "the", "style", "hi...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/parfmt.py#L114-L128
train
Return |Pt| value representing the line spacing between baselines in successive lines of the 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/parfmt.py
ParagraphFormat.line_spacing_rule
def line_spacing_rule(self): """ A member of the :ref:`WdLineSpacing` enumeration indicating how the value of :attr:`line_spacing` should be interpreted. Assigning any of the :ref:`WdLineSpacing` members :attr:`SINGLE`, :attr:`DOUBLE`, or :attr:`ONE_POINT_FIVE` will cause the val...
python
def line_spacing_rule(self): """ A member of the :ref:`WdLineSpacing` enumeration indicating how the value of :attr:`line_spacing` should be interpreted. Assigning any of the :ref:`WdLineSpacing` members :attr:`SINGLE`, :attr:`DOUBLE`, or :attr:`ONE_POINT_FIVE` will cause the val...
[ "def", "line_spacing_rule", "(", "self", ")", ":", "pPr", "=", "self", ".", "_element", ".", "pPr", "if", "pPr", "is", "None", ":", "return", "None", "return", "self", ".", "_line_spacing_rule", "(", "pPr", ".", "spacing_line", ",", "pPr", ".", "spacing_...
A member of the :ref:`WdLineSpacing` enumeration indicating how the value of :attr:`line_spacing` should be interpreted. Assigning any of the :ref:`WdLineSpacing` members :attr:`SINGLE`, :attr:`DOUBLE`, or :attr:`ONE_POINT_FIVE` will cause the value of :attr:`line_spacing` to be updated ...
[ "A", "member", "of", "the", ":", "ref", ":", "WdLineSpacing", "enumeration", "indicating", "how", "the", "value", "of", ":", "attr", ":", "line_spacing", "should", "be", "interpreted", ".", "Assigning", "any", "of", "the", ":", "ref", ":", "WdLineSpacing", ...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/parfmt.py#L145-L158
train
Returns the line spacing rule for the current 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/text/parfmt.py
ParagraphFormat._line_spacing
def _line_spacing(spacing_line, spacing_lineRule): """ Return the line spacing value calculated from the combination of *spacing_line* and *spacing_lineRule*. Returns a |float| number of lines when *spacing_lineRule* is ``WD_LINE_SPACING.MULTIPLE``, otherwise a |Length| object of...
python
def _line_spacing(spacing_line, spacing_lineRule): """ Return the line spacing value calculated from the combination of *spacing_line* and *spacing_lineRule*. Returns a |float| number of lines when *spacing_lineRule* is ``WD_LINE_SPACING.MULTIPLE``, otherwise a |Length| object of...
[ "def", "_line_spacing", "(", "spacing_line", ",", "spacing_lineRule", ")", ":", "if", "spacing_line", "is", "None", ":", "return", "None", "if", "spacing_lineRule", "==", "WD_LINE_SPACING", ".", "MULTIPLE", ":", "return", "spacing_line", "/", "Pt", "(", "12", ...
Return the line spacing value calculated from the combination of *spacing_line* and *spacing_lineRule*. Returns a |float| number of lines when *spacing_lineRule* is ``WD_LINE_SPACING.MULTIPLE``, otherwise a |Length| object of absolute line height is returned. Returns |None| when *spacing...
[ "Return", "the", "line", "spacing", "value", "calculated", "from", "the", "combination", "of", "*", "spacing_line", "*", "and", "*", "spacing_lineRule", "*", ".", "Returns", "a", "|float|", "number", "of", "lines", "when", "*", "spacing_lineRule", "*", "is", ...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/parfmt.py#L274-L286
train
Return the line spacing value calculated from the combination of spacing_line and spacing_lineRule.
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/parfmt.py
ParagraphFormat._line_spacing_rule
def _line_spacing_rule(line, lineRule): """ Return the line spacing rule value calculated from the combination of *line* and *lineRule*. Returns special members of the :ref:`WdLineSpacing` enumeration when line spacing is single, double, or 1.5 lines. """ if lineR...
python
def _line_spacing_rule(line, lineRule): """ Return the line spacing rule value calculated from the combination of *line* and *lineRule*. Returns special members of the :ref:`WdLineSpacing` enumeration when line spacing is single, double, or 1.5 lines. """ if lineR...
[ "def", "_line_spacing_rule", "(", "line", ",", "lineRule", ")", ":", "if", "lineRule", "==", "WD_LINE_SPACING", ".", "MULTIPLE", ":", "if", "line", "==", "Twips", "(", "240", ")", ":", "return", "WD_LINE_SPACING", ".", "SINGLE", "if", "line", "==", "Twips"...
Return the line spacing rule value calculated from the combination of *line* and *lineRule*. Returns special members of the :ref:`WdLineSpacing` enumeration when line spacing is single, double, or 1.5 lines.
[ "Return", "the", "line", "spacing", "rule", "value", "calculated", "from", "the", "combination", "of", "*", "line", "*", "and", "*", "lineRule", "*", ".", "Returns", "special", "members", "of", "the", ":", "ref", ":", "WdLineSpacing", "enumeration", "when", ...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/parfmt.py#L289-L303
train
Return the line spacing rule value calculated from the combination of the line and lineRule.
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/numbering.py
CT_Num.new
def new(cls, num_id, abstractNum_id): """ Return a new ``<w:num>`` element having numId of *num_id* and having a ``<w:abstractNumId>`` child with val attribute set to *abstractNum_id*. """ num = OxmlElement('w:num') num.numId = num_id abstractNumId = CT_De...
python
def new(cls, num_id, abstractNum_id): """ Return a new ``<w:num>`` element having numId of *num_id* and having a ``<w:abstractNumId>`` child with val attribute set to *abstractNum_id*. """ num = OxmlElement('w:num') num.numId = num_id abstractNumId = CT_De...
[ "def", "new", "(", "cls", ",", "num_id", ",", "abstractNum_id", ")", ":", "num", "=", "OxmlElement", "(", "'w:num'", ")", "num", ".", "numId", "=", "num_id", "abstractNumId", "=", "CT_DecimalNumber", ".", "new", "(", "'w:abstractNumId'", ",", "abstractNum_id...
Return a new ``<w:num>`` element having numId of *num_id* and having a ``<w:abstractNumId>`` child with val attribute set to *abstractNum_id*.
[ "Return", "a", "new", "<w", ":", "num", ">", "element", "having", "numId", "of", "*", "num_id", "*", "and", "having", "a", "<w", ":", "abstractNumId", ">", "child", "with", "val", "attribute", "set", "to", "*", "abstractNum_id", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/numbering.py#L33-L45
train
Return a new num element with numId of num_id and abstractNumId of abstractNum_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/oxml/numbering.py
CT_Numbering.add_num
def add_num(self, abstractNum_id): """ Return a newly added CT_Num (<w:num>) element referencing the abstract numbering definition identified by *abstractNum_id*. """ next_num_id = self._next_numId num = CT_Num.new(next_num_id, abstractNum_id) return self._insert_...
python
def add_num(self, abstractNum_id): """ Return a newly added CT_Num (<w:num>) element referencing the abstract numbering definition identified by *abstractNum_id*. """ next_num_id = self._next_numId num = CT_Num.new(next_num_id, abstractNum_id) return self._insert_...
[ "def", "add_num", "(", "self", ",", "abstractNum_id", ")", ":", "next_num_id", "=", "self", ".", "_next_numId", "num", "=", "CT_Num", ".", "new", "(", "next_num_id", ",", "abstractNum_id", ")", "return", "self", ".", "_insert_num", "(", "num", ")" ]
Return a newly added CT_Num (<w:num>) element referencing the abstract numbering definition identified by *abstractNum_id*.
[ "Return", "a", "newly", "added", "CT_Num", "(", "<w", ":", "num", ">", ")", "element", "referencing", "the", "abstract", "numbering", "definition", "identified", "by", "*", "abstractNum_id", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/numbering.py#L99-L106
train
Return a newly added CT_Num element referencing the abstract numbering definition identified by abstractNum_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/oxml/numbering.py
CT_Numbering.num_having_numId
def num_having_numId(self, numId): """ Return the ``<w:num>`` child element having ``numId`` attribute matching *numId*. """ xpath = './w:num[@w:numId="%d"]' % numId try: return self.xpath(xpath)[0] except IndexError: raise KeyError('no <w:...
python
def num_having_numId(self, numId): """ Return the ``<w:num>`` child element having ``numId`` attribute matching *numId*. """ xpath = './w:num[@w:numId="%d"]' % numId try: return self.xpath(xpath)[0] except IndexError: raise KeyError('no <w:...
[ "def", "num_having_numId", "(", "self", ",", "numId", ")", ":", "xpath", "=", "'./w:num[@w:numId=\"%d\"]'", "%", "numId", "try", ":", "return", "self", ".", "xpath", "(", "xpath", ")", "[", "0", "]", "except", "IndexError", ":", "raise", "KeyError", "(", ...
Return the ``<w:num>`` child element having ``numId`` attribute matching *numId*.
[ "Return", "the", "<w", ":", "num", ">", "child", "element", "having", "numId", "attribute", "matching", "*", "numId", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/numbering.py#L108-L117
train
Return the first child element having numId attribute matching numId*.
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/numbering.py
CT_Numbering._next_numId
def _next_numId(self): """ The first ``numId`` unused by a ``<w:num>`` element, starting at 1 and filling any gaps in numbering between existing ``<w:num>`` elements. """ numId_strs = self.xpath('./w:num/@w:numId') num_ids = [int(numId_str) for numId_str in numId_...
python
def _next_numId(self): """ The first ``numId`` unused by a ``<w:num>`` element, starting at 1 and filling any gaps in numbering between existing ``<w:num>`` elements. """ numId_strs = self.xpath('./w:num/@w:numId') num_ids = [int(numId_str) for numId_str in numId_...
[ "def", "_next_numId", "(", "self", ")", ":", "numId_strs", "=", "self", ".", "xpath", "(", "'./w:num/@w:numId'", ")", "num_ids", "=", "[", "int", "(", "numId_str", ")", "for", "numId_str", "in", "numId_strs", "]", "for", "num", "in", "range", "(", "1", ...
The first ``numId`` unused by a ``<w:num>`` element, starting at 1 and filling any gaps in numbering between existing ``<w:num>`` elements.
[ "The", "first", "numId", "unused", "by", "a", "<w", ":", "num", ">", "element", "starting", "at", "1", "and", "filling", "any", "gaps", "in", "numbering", "between", "existing", "<w", ":", "num", ">", "elements", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/numbering.py#L120-L131
train
Returns the next unused numId in the list of available numId elements.
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/rel.py
Relationships.add_relationship
def add_relationship(self, reltype, target, rId, is_external=False): """ Return a newly added |_Relationship| instance. """ rel = _Relationship(rId, reltype, target, self._baseURI, is_external) self[rId] = rel if not is_external: self._target_parts_by_rId[rId]...
python
def add_relationship(self, reltype, target, rId, is_external=False): """ Return a newly added |_Relationship| instance. """ rel = _Relationship(rId, reltype, target, self._baseURI, is_external) self[rId] = rel if not is_external: self._target_parts_by_rId[rId]...
[ "def", "add_relationship", "(", "self", ",", "reltype", ",", "target", ",", "rId", ",", "is_external", "=", "False", ")", ":", "rel", "=", "_Relationship", "(", "rId", ",", "reltype", ",", "target", ",", "self", ".", "_baseURI", ",", "is_external", ")", ...
Return a newly added |_Relationship| instance.
[ "Return", "a", "newly", "added", "|_Relationship|", "instance", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/rel.py#L23-L31
train
Add a relationship to the set.
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/rel.py
Relationships.get_or_add
def get_or_add(self, reltype, target_part): """ Return relationship of *reltype* to *target_part*, newly added if not already present in collection. """ rel = self._get_matching(reltype, target_part) if rel is None: rId = self._next_rId rel = self....
python
def get_or_add(self, reltype, target_part): """ Return relationship of *reltype* to *target_part*, newly added if not already present in collection. """ rel = self._get_matching(reltype, target_part) if rel is None: rId = self._next_rId rel = self....
[ "def", "get_or_add", "(", "self", ",", "reltype", ",", "target_part", ")", ":", "rel", "=", "self", ".", "_get_matching", "(", "reltype", ",", "target_part", ")", "if", "rel", "is", "None", ":", "rId", "=", "self", ".", "_next_rId", "rel", "=", "self",...
Return relationship of *reltype* to *target_part*, newly added if not already present in collection.
[ "Return", "relationship", "of", "*", "reltype", "*", "to", "*", "target_part", "*", "newly", "added", "if", "not", "already", "present", "in", "collection", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/rel.py#L33-L42
train
Get or add a new not relationship.
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/rel.py
Relationships.get_or_add_ext_rel
def get_or_add_ext_rel(self, reltype, target_ref): """ Return rId of external relationship of *reltype* to *target_ref*, newly added if not already present in collection. """ rel = self._get_matching(reltype, target_ref, is_external=True) if rel is None: rId =...
python
def get_or_add_ext_rel(self, reltype, target_ref): """ Return rId of external relationship of *reltype* to *target_ref*, newly added if not already present in collection. """ rel = self._get_matching(reltype, target_ref, is_external=True) if rel is None: rId =...
[ "def", "get_or_add_ext_rel", "(", "self", ",", "reltype", ",", "target_ref", ")", ":", "rel", "=", "self", ".", "_get_matching", "(", "reltype", ",", "target_ref", ",", "is_external", "=", "True", ")", "if", "rel", "is", "None", ":", "rId", "=", "self", ...
Return rId of external relationship of *reltype* to *target_ref*, newly added if not already present in collection.
[ "Return", "rId", "of", "external", "relationship", "of", "*", "reltype", "*", "to", "*", "target_ref", "*", "newly", "added", "if", "not", "already", "present", "in", "collection", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/rel.py#L44-L55
train
Get or add an external relationship of the specified type to the collection.
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/rel.py
Relationships.xml
def xml(self): """ Serialize this relationship collection into XML suitable for storage as a .rels file in an OPC package. """ rels_elm = CT_Relationships.new() for rel in self.values(): rels_elm.add_rel( rel.rId, rel.reltype, rel.target_ref, r...
python
def xml(self): """ Serialize this relationship collection into XML suitable for storage as a .rels file in an OPC package. """ rels_elm = CT_Relationships.new() for rel in self.values(): rels_elm.add_rel( rel.rId, rel.reltype, rel.target_ref, r...
[ "def", "xml", "(", "self", ")", ":", "rels_elm", "=", "CT_Relationships", ".", "new", "(", ")", "for", "rel", "in", "self", ".", "values", "(", ")", ":", "rels_elm", ".", "add_rel", "(", "rel", ".", "rId", ",", "rel", ".", "reltype", ",", "rel", ...
Serialize this relationship collection into XML suitable for storage as a .rels file in an OPC package.
[ "Serialize", "this", "relationship", "collection", "into", "XML", "suitable", "for", "storage", "as", "a", ".", "rels", "file", "in", "an", "OPC", "package", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/rel.py#L75-L85
train
Serialize this relationship collection into XML suitable for storage as a. rels file 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
docx/opc/rel.py
Relationships._get_matching
def _get_matching(self, reltype, target, is_external=False): """ Return relationship of matching *reltype*, *target*, and *is_external* from collection, or None if not found. """ def matches(rel, reltype, target, is_external): if rel.reltype != reltype: ...
python
def _get_matching(self, reltype, target, is_external=False): """ Return relationship of matching *reltype*, *target*, and *is_external* from collection, or None if not found. """ def matches(rel, reltype, target, is_external): if rel.reltype != reltype: ...
[ "def", "_get_matching", "(", "self", ",", "reltype", ",", "target", ",", "is_external", "=", "False", ")", ":", "def", "matches", "(", "rel", ",", "reltype", ",", "target", ",", "is_external", ")", ":", "if", "rel", ".", "reltype", "!=", "reltype", ":"...
Return relationship of matching *reltype*, *target*, and *is_external* from collection, or None if not found.
[ "Return", "relationship", "of", "matching", "*", "reltype", "*", "*", "target", "*", "and", "*", "is_external", "*", "from", "collection", "or", "None", "if", "not", "found", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/rel.py#L87-L105
train
Return the relationship of matching reltype target and is_external
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/rel.py
Relationships._next_rId
def _next_rId(self): """ Next available rId in collection, starting from 'rId1' and making use of any gaps in numbering, e.g. 'rId2' for rIds ['rId1', 'rId3']. """ for n in range(1, len(self)+2): rId_candidate = 'rId%d' % n # like 'rId19' if rId_candidate...
python
def _next_rId(self): """ Next available rId in collection, starting from 'rId1' and making use of any gaps in numbering, e.g. 'rId2' for rIds ['rId1', 'rId3']. """ for n in range(1, len(self)+2): rId_candidate = 'rId%d' % n # like 'rId19' if rId_candidate...
[ "def", "_next_rId", "(", "self", ")", ":", "for", "n", "in", "range", "(", "1", ",", "len", "(", "self", ")", "+", "2", ")", ":", "rId_candidate", "=", "'rId%d'", "%", "n", "# like 'rId19'", "if", "rId_candidate", "not", "in", "self", ":", "return", ...
Next available rId in collection, starting from 'rId1' and making use of any gaps in numbering, e.g. 'rId2' for rIds ['rId1', 'rId3'].
[ "Next", "available", "rId", "in", "collection", "starting", "from", "rId1", "and", "making", "use", "of", "any", "gaps", "in", "numbering", "e", ".", "g", ".", "rId2", "for", "rIds", "[", "rId1", "rId3", "]", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/rel.py#L123-L131
train
Return the next available rId in the collection.
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/shared.py
CT_DecimalNumber.new
def new(cls, nsptagname, val): """ Return a new ``CT_DecimalNumber`` element having tagname *nsptagname* and ``val`` attribute set to *val*. """ return OxmlElement(nsptagname, attrs={qn('w:val'): str(val)})
python
def new(cls, nsptagname, val): """ Return a new ``CT_DecimalNumber`` element having tagname *nsptagname* and ``val`` attribute set to *val*. """ return OxmlElement(nsptagname, attrs={qn('w:val'): str(val)})
[ "def", "new", "(", "cls", ",", "nsptagname", ",", "val", ")", ":", "return", "OxmlElement", "(", "nsptagname", ",", "attrs", "=", "{", "qn", "(", "'w:val'", ")", ":", "str", "(", "val", ")", "}", ")" ]
Return a new ``CT_DecimalNumber`` element having tagname *nsptagname* and ``val`` attribute set to *val*.
[ "Return", "a", "new", "CT_DecimalNumber", "element", "having", "tagname", "*", "nsptagname", "*", "and", "val", "attribute", "set", "to", "*", "val", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/shared.py#L24-L29
train
Return a new OxmlElement having tagname nsptagname and val.
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/shared.py
CT_String.new
def new(cls, nsptagname, val): """ Return a new ``CT_String`` element with tagname *nsptagname* and ``val`` attribute set to *val*. """ elm = OxmlElement(nsptagname) elm.val = val return elm
python
def new(cls, nsptagname, val): """ Return a new ``CT_String`` element with tagname *nsptagname* and ``val`` attribute set to *val*. """ elm = OxmlElement(nsptagname) elm.val = val return elm
[ "def", "new", "(", "cls", ",", "nsptagname", ",", "val", ")", ":", "elm", "=", "OxmlElement", "(", "nsptagname", ")", "elm", ".", "val", "=", "val", "return", "elm" ]
Return a new ``CT_String`` element with tagname *nsptagname* and ``val`` attribute set to *val*.
[ "Return", "a", "new", "CT_String", "element", "with", "tagname", "*", "nsptagname", "*", "and", "val", "attribute", "set", "to", "*", "val", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/shared.py#L48-L55
train
Return a new OxmlElement with tagname nsptagname and val.
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/styles/style.py
StyleFactory
def StyleFactory(style_elm): """ Return a style object of the appropriate |BaseStyle| subclass, according to the type of *style_elm*. """ style_cls = { WD_STYLE_TYPE.PARAGRAPH: _ParagraphStyle, WD_STYLE_TYPE.CHARACTER: _CharacterStyle, WD_STYLE_TYPE.TABLE: _TableStyle, ...
python
def StyleFactory(style_elm): """ Return a style object of the appropriate |BaseStyle| subclass, according to the type of *style_elm*. """ style_cls = { WD_STYLE_TYPE.PARAGRAPH: _ParagraphStyle, WD_STYLE_TYPE.CHARACTER: _CharacterStyle, WD_STYLE_TYPE.TABLE: _TableStyle, ...
[ "def", "StyleFactory", "(", "style_elm", ")", ":", "style_cls", "=", "{", "WD_STYLE_TYPE", ".", "PARAGRAPH", ":", "_ParagraphStyle", ",", "WD_STYLE_TYPE", ".", "CHARACTER", ":", "_CharacterStyle", ",", "WD_STYLE_TYPE", ".", "TABLE", ":", "_TableStyle", ",", "WD_...
Return a style object of the appropriate |BaseStyle| subclass, according to the type of *style_elm*.
[ "Return", "a", "style", "object", "of", "the", "appropriate", "|BaseStyle|", "subclass", "according", "to", "the", "type", "of", "*", "style_elm", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/styles/style.py#L18-L30
train
Returns a |BaseStyle| subclass according to the type of style_elm.
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/styles/style.py
BaseStyle.name
def name(self): """ The UI name of this style. """ name = self._element.name_val if name is None: return None return BabelFish.internal2ui(name)
python
def name(self): """ The UI name of this style. """ name = self._element.name_val if name is None: return None return BabelFish.internal2ui(name)
[ "def", "name", "(", "self", ")", ":", "name", "=", "self", ".", "_element", ".", "name_val", "if", "name", "is", "None", ":", "return", "None", "return", "BabelFish", ".", "internal2ui", "(", "name", ")" ]
The UI name of this style.
[ "The", "UI", "name", "of", "this", "style", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/styles/style.py#L93-L100
train
The name of the current 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/styles/style.py
BaseStyle.type
def type(self): """ Member of :ref:`WdStyleType` corresponding to the type of this style, e.g. ``WD_STYLE_TYPE.PARAGRAPH``. """ type = self._element.type if type is None: return WD_STYLE_TYPE.PARAGRAPH return type
python
def type(self): """ Member of :ref:`WdStyleType` corresponding to the type of this style, e.g. ``WD_STYLE_TYPE.PARAGRAPH``. """ type = self._element.type if type is None: return WD_STYLE_TYPE.PARAGRAPH return type
[ "def", "type", "(", "self", ")", ":", "type", "=", "self", ".", "_element", ".", "type", "if", "type", "is", "None", ":", "return", "WD_STYLE_TYPE", ".", "PARAGRAPH", "return", "type" ]
Member of :ref:`WdStyleType` corresponding to the type of this style, e.g. ``WD_STYLE_TYPE.PARAGRAPH``.
[ "Member", "of", ":", "ref", ":", "WdStyleType", "corresponding", "to", "the", "type", "of", "this", "style", "e", ".", "g", ".", "WD_STYLE_TYPE", ".", "PARAGRAPH", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/styles/style.py#L146-L154
train
Returns the type of this style.
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/styles/style.py
_ParagraphStyle.next_paragraph_style
def next_paragraph_style(self): """ |_ParagraphStyle| object representing the style to be applied automatically to a new paragraph inserted after a paragraph of this style. Returns self if no next paragraph style is defined. Assigning |None| or *self* removes the setting such tha...
python
def next_paragraph_style(self): """ |_ParagraphStyle| object representing the style to be applied automatically to a new paragraph inserted after a paragraph of this style. Returns self if no next paragraph style is defined. Assigning |None| or *self* removes the setting such tha...
[ "def", "next_paragraph_style", "(", "self", ")", ":", "next_style_elm", "=", "self", ".", "_element", ".", "next_style", "if", "next_style_elm", "is", "None", ":", "return", "self", "if", "next_style_elm", ".", "type", "!=", "WD_STYLE_TYPE", ".", "PARAGRAPH", ...
|_ParagraphStyle| object representing the style to be applied automatically to a new paragraph inserted after a paragraph of this style. Returns self if no next paragraph style is defined. Assigning |None| or *self* removes the setting such that new paragraphs are created using this same...
[ "|_ParagraphStyle|", "object", "representing", "the", "style", "to", "be", "applied", "automatically", "to", "a", "new", "paragraph", "inserted", "after", "a", "paragraph", "of", "this", "style", ".", "Returns", "self", "if", "no", "next", "paragraph", "style", ...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/styles/style.py#L217-L230
train
Returns |_ParagraphStyle| object representing the next paragraph style.
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/coreprops.py
CT_CoreProperties.revision_number
def revision_number(self): """ Integer value of revision property. """ revision = self.revision if revision is None: return 0 revision_str = revision.text try: revision = int(revision_str) except ValueError: # non-intege...
python
def revision_number(self): """ Integer value of revision property. """ revision = self.revision if revision is None: return 0 revision_str = revision.text try: revision = int(revision_str) except ValueError: # non-intege...
[ "def", "revision_number", "(", "self", ")", ":", "revision", "=", "self", ".", "revision", "if", "revision", "is", "None", ":", "return", "0", "revision_str", "=", "revision", ".", "text", "try", ":", "revision", "=", "int", "(", "revision_str", ")", "ex...
Integer value of revision property.
[ "Integer", "value", "of", "revision", "property", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/coreprops.py#L148-L164
train
Return the revision number of the current locale.
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/coreprops.py
CT_CoreProperties.revision_number
def revision_number(self, value): """ Set revision property to string value of integer *value*. """ if not isinstance(value, int) or value < 1: tmpl = "revision property requires positive int, got '%s'" raise ValueError(tmpl % value) revision = self.get_or...
python
def revision_number(self, value): """ Set revision property to string value of integer *value*. """ if not isinstance(value, int) or value < 1: tmpl = "revision property requires positive int, got '%s'" raise ValueError(tmpl % value) revision = self.get_or...
[ "def", "revision_number", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "int", ")", "or", "value", "<", "1", ":", "tmpl", "=", "\"revision property requires positive int, got '%s'\"", "raise", "ValueError", "(", "tmpl", "%"...
Set revision property to string value of integer *value*.
[ "Set", "revision", "property", "to", "string", "value", "of", "integer", "*", "value", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/coreprops.py#L167-L175
train
Set revision property to string value of integer value.
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/coreprops.py
CT_CoreProperties._get_or_add
def _get_or_add(self, prop_name): """ Return element returned by 'get_or_add_' method for *prop_name*. """ get_or_add_method_name = 'get_or_add_%s' % prop_name get_or_add_method = getattr(self, get_or_add_method_name) element = get_or_add_method() return element
python
def _get_or_add(self, prop_name): """ Return element returned by 'get_or_add_' method for *prop_name*. """ get_or_add_method_name = 'get_or_add_%s' % prop_name get_or_add_method = getattr(self, get_or_add_method_name) element = get_or_add_method() return element
[ "def", "_get_or_add", "(", "self", ",", "prop_name", ")", ":", "get_or_add_method_name", "=", "'get_or_add_%s'", "%", "prop_name", "get_or_add_method", "=", "getattr", "(", "self", ",", "get_or_add_method_name", ")", "element", "=", "get_or_add_method", "(", ")", ...
Return element returned by 'get_or_add_' method for *prop_name*.
[ "Return", "element", "returned", "by", "get_or_add_", "method", "for", "*", "prop_name", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/coreprops.py#L212-L219
train
Get or add an entry from the 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/oxml/coreprops.py
CT_CoreProperties._offset_dt
def _offset_dt(cls, dt, offset_str): """ Return a |datetime| instance that is offset from datetime *dt* by the timezone offset specified in *offset_str*, a string like ``'-07:00'``. """ match = cls._offset_pattern.match(offset_str) if match is None: ra...
python
def _offset_dt(cls, dt, offset_str): """ Return a |datetime| instance that is offset from datetime *dt* by the timezone offset specified in *offset_str*, a string like ``'-07:00'``. """ match = cls._offset_pattern.match(offset_str) if match is None: ra...
[ "def", "_offset_dt", "(", "cls", ",", "dt", ",", "offset_str", ")", ":", "match", "=", "cls", ".", "_offset_pattern", ".", "match", "(", "offset_str", ")", "if", "match", "is", "None", ":", "raise", "ValueError", "(", "\"'%s' is not a valid offset string\"", ...
Return a |datetime| instance that is offset from datetime *dt* by the timezone offset specified in *offset_str*, a string like ``'-07:00'``.
[ "Return", "a", "|datetime|", "instance", "that", "is", "offset", "from", "datetime", "*", "dt", "*", "by", "the", "timezone", "offset", "specified", "in", "*", "offset_str", "*", "a", "string", "like", "-", "07", ":", "00", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/coreprops.py#L222-L238
train
Return a |datetime| instance that is offset from datetime dt by the timezone offset specified in offset_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/oxml/coreprops.py
CT_CoreProperties._set_element_datetime
def _set_element_datetime(self, prop_name, value): """ Set date/time value of child element having *prop_name* to *value*. """ if not isinstance(value, datetime): tmpl = ( "property requires <type 'datetime.datetime'> object, got %s" ) ...
python
def _set_element_datetime(self, prop_name, value): """ Set date/time value of child element having *prop_name* to *value*. """ if not isinstance(value, datetime): tmpl = ( "property requires <type 'datetime.datetime'> object, got %s" ) ...
[ "def", "_set_element_datetime", "(", "self", ",", "prop_name", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "datetime", ")", ":", "tmpl", "=", "(", "\"property requires <type 'datetime.datetime'> object, got %s\"", ")", "raise", "ValueError"...
Set date/time value of child element having *prop_name* to *value*.
[ "Set", "date", "/", "time", "value", "of", "child", "element", "having", "*", "prop_name", "*", "to", "*", "value", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/coreprops.py#L273-L292
train
Set the date or time value of the child element having prop_name to value.
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/coreprops.py
CT_CoreProperties._set_element_text
def _set_element_text(self, prop_name, value): """Set string value of *name* property to *value*.""" if not is_string(value): value = str(value) if len(value) > 255: tmpl = ( "exceeded 255 char limit for property, got:\n\n'%s'" ) r...
python
def _set_element_text(self, prop_name, value): """Set string value of *name* property to *value*.""" if not is_string(value): value = str(value) if len(value) > 255: tmpl = ( "exceeded 255 char limit for property, got:\n\n'%s'" ) r...
[ "def", "_set_element_text", "(", "self", ",", "prop_name", ",", "value", ")", ":", "if", "not", "is_string", "(", "value", ")", ":", "value", "=", "str", "(", "value", ")", "if", "len", "(", "value", ")", ">", "255", ":", "tmpl", "=", "(", "\"excee...
Set string value of *name* property to *value*.
[ "Set", "string", "value", "of", "*", "name", "*", "property", "to", "*", "value", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/coreprops.py#L294-L305
train
Set string value of name * property to value *.
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/coreprops.py
CT_CoreProperties._text_of_element
def _text_of_element(self, property_name): """ Return the text in the element matching *property_name*, or an empty string if the element is not present or contains no text. """ element = getattr(self, property_name) if element is None: return '' if el...
python
def _text_of_element(self, property_name): """ Return the text in the element matching *property_name*, or an empty string if the element is not present or contains no text. """ element = getattr(self, property_name) if element is None: return '' if el...
[ "def", "_text_of_element", "(", "self", ",", "property_name", ")", ":", "element", "=", "getattr", "(", "self", ",", "property_name", ")", "if", "element", "is", "None", ":", "return", "''", "if", "element", ".", "text", "is", "None", ":", "return", "''"...
Return the text in the element matching *property_name*, or an empty string if the element is not present or contains no text.
[ "Return", "the", "text", "in", "the", "element", "matching", "*", "property_name", "*", "or", "an", "empty", "string", "if", "the", "element", "is", "not", "present", "or", "contains", "no", "text", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/coreprops.py#L307-L317
train
Return the text of the element matching the given property name.
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/gif.py
Gif.from_stream
def from_stream(cls, stream): """ Return |Gif| instance having header properties parsed from GIF image in *stream*. """ px_width, px_height = cls._dimensions_from_stream(stream) return cls(px_width, px_height, 72, 72)
python
def from_stream(cls, stream): """ Return |Gif| instance having header properties parsed from GIF image in *stream*. """ px_width, px_height = cls._dimensions_from_stream(stream) return cls(px_width, px_height, 72, 72)
[ "def", "from_stream", "(", "cls", ",", "stream", ")", ":", "px_width", ",", "px_height", "=", "cls", ".", "_dimensions_from_stream", "(", "stream", ")", "return", "cls", "(", "px_width", ",", "px_height", ",", "72", ",", "72", ")" ]
Return |Gif| instance having header properties parsed from GIF image in *stream*.
[ "Return", "|Gif|", "instance", "having", "header", "properties", "parsed", "from", "GIF", "image", "in", "*", "stream", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/gif.py#L18-L24
train
Create a new Gif 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/opc/phys_pkg.py
_DirPkgReader.blob_for
def blob_for(self, pack_uri): """ Return contents of file corresponding to *pack_uri* in package directory. """ path = os.path.join(self._path, pack_uri.membername) with open(path, 'rb') as f: blob = f.read() return blob
python
def blob_for(self, pack_uri): """ Return contents of file corresponding to *pack_uri* in package directory. """ path = os.path.join(self._path, pack_uri.membername) with open(path, 'rb') as f: blob = f.read() return blob
[ "def", "blob_for", "(", "self", ",", "pack_uri", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_path", ",", "pack_uri", ".", "membername", ")", "with", "open", "(", "path", ",", "'rb'", ")", "as", "f", ":", "blob", "="...
Return contents of file corresponding to *pack_uri* in package directory.
[ "Return", "contents", "of", "file", "corresponding", "to", "*", "pack_uri", "*", "in", "package", "directory", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/phys_pkg.py#L59-L67
train
Return contents of file corresponding to pack_uri in package directory.
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/phys_pkg.py
_DirPkgReader.rels_xml_for
def rels_xml_for(self, source_uri): """ Return rels item XML for source with *source_uri*, or None if the item has no rels item. """ try: rels_xml = self.blob_for(source_uri.rels_uri) except IOError: rels_xml = None return rels_xml
python
def rels_xml_for(self, source_uri): """ Return rels item XML for source with *source_uri*, or None if the item has no rels item. """ try: rels_xml = self.blob_for(source_uri.rels_uri) except IOError: rels_xml = None return rels_xml
[ "def", "rels_xml_for", "(", "self", ",", "source_uri", ")", ":", "try", ":", "rels_xml", "=", "self", ".", "blob_for", "(", "source_uri", ".", "rels_uri", ")", "except", "IOError", ":", "rels_xml", "=", "None", "return", "rels_xml" ]
Return rels item XML for source with *source_uri*, or None if the item has no rels item.
[ "Return", "rels", "item", "XML", "for", "source", "with", "*", "source_uri", "*", "or", "None", "if", "the", "item", "has", "no", "rels", "item", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/phys_pkg.py#L83-L92
train
Return rels item XML for source with source_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/phys_pkg.py
_ZipPkgReader.rels_xml_for
def rels_xml_for(self, source_uri): """ Return rels item XML for source with *source_uri* or None if no rels item is present. """ try: rels_xml = self.blob_for(source_uri.rels_uri) except KeyError: rels_xml = None return rels_xml
python
def rels_xml_for(self, source_uri): """ Return rels item XML for source with *source_uri* or None if no rels item is present. """ try: rels_xml = self.blob_for(source_uri.rels_uri) except KeyError: rels_xml = None return rels_xml
[ "def", "rels_xml_for", "(", "self", ",", "source_uri", ")", ":", "try", ":", "rels_xml", "=", "self", ".", "blob_for", "(", "source_uri", ".", "rels_uri", ")", "except", "KeyError", ":", "rels_xml", "=", "None", "return", "rels_xml" ]
Return rels item XML for source with *source_uri* or None if no rels item is present.
[ "Return", "rels", "item", "XML", "for", "source", "with", "*", "source_uri", "*", "or", "None", "if", "no", "rels", "item", "is", "present", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/phys_pkg.py#L123-L132
train
Return rels item XML for source with source_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/phys_pkg.py
_ZipPkgWriter.write
def write(self, pack_uri, blob): """ Write *blob* to this zip package with the membername corresponding to *pack_uri*. """ self._zipf.writestr(pack_uri.membername, blob)
python
def write(self, pack_uri, blob): """ Write *blob* to this zip package with the membername corresponding to *pack_uri*. """ self._zipf.writestr(pack_uri.membername, blob)
[ "def", "write", "(", "self", ",", "pack_uri", ",", "blob", ")", ":", "self", ".", "_zipf", ".", "writestr", "(", "pack_uri", ".", "membername", ",", "blob", ")" ]
Write *blob* to this zip package with the membername corresponding to *pack_uri*.
[ "Write", "*", "blob", "*", "to", "this", "zip", "package", "with", "the", "membername", "corresponding", "to", "*", "pack_uri", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/phys_pkg.py#L150-L155
train
Writes the given blob to the named zip 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/bmp.py
Bmp.from_stream
def from_stream(cls, stream): """ Return |Bmp| instance having header properties parsed from the BMP image in *stream*. """ stream_rdr = StreamReader(stream, LITTLE_ENDIAN) px_width = stream_rdr.read_long(0x12) px_height = stream_rdr.read_long(0x16) horz...
python
def from_stream(cls, stream): """ Return |Bmp| instance having header properties parsed from the BMP image in *stream*. """ stream_rdr = StreamReader(stream, LITTLE_ENDIAN) px_width = stream_rdr.read_long(0x12) px_height = stream_rdr.read_long(0x16) horz...
[ "def", "from_stream", "(", "cls", ",", "stream", ")", ":", "stream_rdr", "=", "StreamReader", "(", "stream", ",", "LITTLE_ENDIAN", ")", "px_width", "=", "stream_rdr", ".", "read_long", "(", "0x12", ")", "px_height", "=", "stream_rdr", ".", "read_long", "(", ...
Return |Bmp| instance having header properties parsed from the BMP image in *stream*.
[ "Return", "|Bmp|", "instance", "having", "header", "properties", "parsed", "from", "the", "BMP", "image", "in", "*", "stream", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/bmp.py#L15-L31
train
Create a new Bmp object 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/oxml/ns.py
qn
def qn(tag): """ Stands for "qualified name", a utility function to turn a namespace prefixed tag name into a Clark-notation qualified tag name for lxml. For example, ``qn('p:cSld')`` returns ``'{http://schemas.../main}cSld'``. """ prefix, tagroot = tag.split(':') uri = nsmap[prefix] ret...
python
def qn(tag): """ Stands for "qualified name", a utility function to turn a namespace prefixed tag name into a Clark-notation qualified tag name for lxml. For example, ``qn('p:cSld')`` returns ``'{http://schemas.../main}cSld'``. """ prefix, tagroot = tag.split(':') uri = nsmap[prefix] ret...
[ "def", "qn", "(", "tag", ")", ":", "prefix", ",", "tagroot", "=", "tag", ".", "split", "(", "':'", ")", "uri", "=", "nsmap", "[", "prefix", "]", "return", "'{%s}%s'", "%", "(", "uri", ",", "tagroot", ")" ]
Stands for "qualified name", a utility function to turn a namespace prefixed tag name into a Clark-notation qualified tag name for lxml. For example, ``qn('p:cSld')`` returns ``'{http://schemas.../main}cSld'``.
[ "Stands", "for", "qualified", "name", "a", "utility", "function", "to", "turn", "a", "namespace", "prefixed", "tag", "name", "into", "a", "Clark", "-", "notation", "qualified", "tag", "name", "for", "lxml", ".", "For", "example", "qn", "(", "p", ":", "cS...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/ns.py#L105-L113
train
Returns a Clark - notation qualified tag name for a namespace prefixed tag name.
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/text/paragraph.py
CT_P.clear_content
def clear_content(self): """ Remove all child elements, except the ``<w:pPr>`` element if present. """ for child in self[:]: if child.tag == qn('w:pPr'): continue self.remove(child)
python
def clear_content(self): """ Remove all child elements, except the ``<w:pPr>`` element if present. """ for child in self[:]: if child.tag == qn('w:pPr'): continue self.remove(child)
[ "def", "clear_content", "(", "self", ")", ":", "for", "child", "in", "self", "[", ":", "]", ":", "if", "child", ".", "tag", "==", "qn", "(", "'w:pPr'", ")", ":", "continue", "self", ".", "remove", "(", "child", ")" ]
Remove all child elements, except the ``<w:pPr>`` element if present.
[ "Remove", "all", "child", "elements", "except", "the", "<w", ":", "pPr", ">", "element", "if", "present", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/paragraph.py#L46-L53
train
Removes all child elements except the <w : pPr 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/text/paragraph.py
CT_P.set_sectPr
def set_sectPr(self, sectPr): """ Unconditionally replace or add *sectPr* as a grandchild in the correct sequence. """ pPr = self.get_or_add_pPr() pPr._remove_sectPr() pPr._insert_sectPr(sectPr)
python
def set_sectPr(self, sectPr): """ Unconditionally replace or add *sectPr* as a grandchild in the correct sequence. """ pPr = self.get_or_add_pPr() pPr._remove_sectPr() pPr._insert_sectPr(sectPr)
[ "def", "set_sectPr", "(", "self", ",", "sectPr", ")", ":", "pPr", "=", "self", ".", "get_or_add_pPr", "(", ")", "pPr", ".", "_remove_sectPr", "(", ")", "pPr", ".", "_insert_sectPr", "(", "sectPr", ")" ]
Unconditionally replace or add *sectPr* as a grandchild in the correct sequence.
[ "Unconditionally", "replace", "or", "add", "*", "sectPr", "*", "as", "a", "grandchild", "in", "the", "correct", "sequence", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/paragraph.py#L55-L62
train
Unconditionally replace or add a sectPr as a grandchild in the correct sequence.
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/pkgreader.py
PackageReader.from_file
def from_file(pkg_file): """ Return a |PackageReader| instance loaded with contents of *pkg_file*. """ phys_reader = PhysPkgReader(pkg_file) content_types = _ContentTypeMap.from_xml(phys_reader.content_types_xml) pkg_srels = PackageReader._srels_for(phys_reader, PACKAGE_U...
python
def from_file(pkg_file): """ Return a |PackageReader| instance loaded with contents of *pkg_file*. """ phys_reader = PhysPkgReader(pkg_file) content_types = _ContentTypeMap.from_xml(phys_reader.content_types_xml) pkg_srels = PackageReader._srels_for(phys_reader, PACKAGE_U...
[ "def", "from_file", "(", "pkg_file", ")", ":", "phys_reader", "=", "PhysPkgReader", "(", "pkg_file", ")", "content_types", "=", "_ContentTypeMap", ".", "from_xml", "(", "phys_reader", ".", "content_types_xml", ")", "pkg_srels", "=", "PackageReader", ".", "_srels_f...
Return a |PackageReader| instance loaded with contents of *pkg_file*.
[ "Return", "a", "|PackageReader|", "instance", "loaded", "with", "contents", "of", "*", "pkg_file", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/pkgreader.py#L28-L39
train
Return a |PackageReader| instance loaded with contents of pkg_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/pkgreader.py
PackageReader.iter_sparts
def iter_sparts(self): """ Generate a 4-tuple `(partname, content_type, reltype, blob)` for each of the serialized parts in the package. """ for s in self._sparts: yield (s.partname, s.content_type, s.reltype, s.blob)
python
def iter_sparts(self): """ Generate a 4-tuple `(partname, content_type, reltype, blob)` for each of the serialized parts in the package. """ for s in self._sparts: yield (s.partname, s.content_type, s.reltype, s.blob)
[ "def", "iter_sparts", "(", "self", ")", ":", "for", "s", "in", "self", ".", "_sparts", ":", "yield", "(", "s", ".", "partname", ",", "s", ".", "content_type", ",", "s", ".", "reltype", ",", "s", ".", "blob", ")" ]
Generate a 4-tuple `(partname, content_type, reltype, blob)` for each of the serialized parts in the package.
[ "Generate", "a", "4", "-", "tuple", "(", "partname", "content_type", "reltype", "blob", ")", "for", "each", "of", "the", "serialized", "parts", "in", "the", "package", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/pkgreader.py#L41-L47
train
Iterate over the serialized parts in 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/pkgreader.py
PackageReader.iter_srels
def iter_srels(self): """ Generate a 2-tuple `(source_uri, srel)` for each of the relationships in the package. """ for srel in self._pkg_srels: yield (PACKAGE_URI, srel) for spart in self._sparts: for srel in spart.srels: yield (sp...
python
def iter_srels(self): """ Generate a 2-tuple `(source_uri, srel)` for each of the relationships in the package. """ for srel in self._pkg_srels: yield (PACKAGE_URI, srel) for spart in self._sparts: for srel in spart.srels: yield (sp...
[ "def", "iter_srels", "(", "self", ")", ":", "for", "srel", "in", "self", ".", "_pkg_srels", ":", "yield", "(", "PACKAGE_URI", ",", "srel", ")", "for", "spart", "in", "self", ".", "_sparts", ":", "for", "srel", "in", "spart", ".", "srels", ":", "yield...
Generate a 2-tuple `(source_uri, srel)` for each of the relationships in the package.
[ "Generate", "a", "2", "-", "tuple", "(", "source_uri", "srel", ")", "for", "each", "of", "the", "relationships", "in", "the", "package", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/pkgreader.py#L49-L58
train
Iterate over the relationships in 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/pkgreader.py
PackageReader._srels_for
def _srels_for(phys_reader, source_uri): """ Return |_SerializedRelationships| instance populated with relationships for source identified by *source_uri*. """ rels_xml = phys_reader.rels_xml_for(source_uri) return _SerializedRelationships.load_from_xml( sourc...
python
def _srels_for(phys_reader, source_uri): """ Return |_SerializedRelationships| instance populated with relationships for source identified by *source_uri*. """ rels_xml = phys_reader.rels_xml_for(source_uri) return _SerializedRelationships.load_from_xml( sourc...
[ "def", "_srels_for", "(", "phys_reader", ",", "source_uri", ")", ":", "rels_xml", "=", "phys_reader", ".", "rels_xml_for", "(", "source_uri", ")", "return", "_SerializedRelationships", ".", "load_from_xml", "(", "source_uri", ".", "baseURI", ",", "rels_xml", ")" ]
Return |_SerializedRelationships| instance populated with relationships for source identified by *source_uri*.
[ "Return", "|_SerializedRelationships|", "instance", "populated", "with", "relationships", "for", "source", "identified", "by", "*", "source_uri", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/pkgreader.py#L78-L85
train
Return |_SerializedRelationships| instance populated with relationships for source identified by source_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/pkgreader.py
_ContentTypeMap.from_xml
def from_xml(content_types_xml): """ Return a new |_ContentTypeMap| instance populated with the contents of *content_types_xml*. """ types_elm = parse_xml(content_types_xml) ct_map = _ContentTypeMap() for o in types_elm.overrides: ct_map._add_override(...
python
def from_xml(content_types_xml): """ Return a new |_ContentTypeMap| instance populated with the contents of *content_types_xml*. """ types_elm = parse_xml(content_types_xml) ct_map = _ContentTypeMap() for o in types_elm.overrides: ct_map._add_override(...
[ "def", "from_xml", "(", "content_types_xml", ")", ":", "types_elm", "=", "parse_xml", "(", "content_types_xml", ")", "ct_map", "=", "_ContentTypeMap", "(", ")", "for", "o", "in", "types_elm", ".", "overrides", ":", "ct_map", ".", "_add_override", "(", "o", "...
Return a new |_ContentTypeMap| instance populated with the contents of *content_types_xml*.
[ "Return", "a", "new", "|_ContentTypeMap|", "instance", "populated", "with", "the", "contents", "of", "*", "content_types_xml", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/pkgreader.py#L139-L150
train
Create a |_ContentTypeMap| instance populated with the contents of content_types_xml.
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/pkgreader.py
_SerializedRelationship.target_partname
def target_partname(self): """ |PackURI| instance containing partname targeted by this relationship. Raises ``ValueError`` on reference if target_mode is ``'External'``. Use :attr:`target_mode` to check before referencing. """ if self.is_external: msg = ('targ...
python
def target_partname(self): """ |PackURI| instance containing partname targeted by this relationship. Raises ``ValueError`` on reference if target_mode is ``'External'``. Use :attr:`target_mode` to check before referencing. """ if self.is_external: msg = ('targ...
[ "def", "target_partname", "(", "self", ")", ":", "if", "self", ".", "is_external", ":", "msg", "=", "(", "'target_partname attribute on Relationship is undefined w'", "'here TargetMode == \"External\"'", ")", "raise", "ValueError", "(", "msg", ")", "# lazy-load _target_pa...
|PackURI| instance containing partname targeted by this relationship. Raises ``ValueError`` on reference if target_mode is ``'External'``. Use :attr:`target_mode` to check before referencing.
[ "|PackURI|", "instance", "containing", "partname", "targeted", "by", "this", "relationship", ".", "Raises", "ValueError", "on", "reference", "if", "target_mode", "is", "External", ".", "Use", ":", "attr", ":", "target_mode", "to", "check", "before", "referencing",...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/pkgreader.py#L256-L270
train
Return |PackURI| instance containing partname targeted by this relationship.
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/pkgreader.py
_SerializedRelationships.load_from_xml
def load_from_xml(baseURI, rels_item_xml): """ Return |_SerializedRelationships| instance loaded with the relationships contained in *rels_item_xml*. Returns an empty collection if *rels_item_xml* is |None|. """ srels = _SerializedRelationships() if rels_item_xml ...
python
def load_from_xml(baseURI, rels_item_xml): """ Return |_SerializedRelationships| instance loaded with the relationships contained in *rels_item_xml*. Returns an empty collection if *rels_item_xml* is |None|. """ srels = _SerializedRelationships() if rels_item_xml ...
[ "def", "load_from_xml", "(", "baseURI", ",", "rels_item_xml", ")", ":", "srels", "=", "_SerializedRelationships", "(", ")", "if", "rels_item_xml", "is", "not", "None", ":", "rels_elm", "=", "parse_xml", "(", "rels_item_xml", ")", "for", "rel_elm", "in", "rels_...
Return |_SerializedRelationships| instance loaded with the relationships contained in *rels_item_xml*. Returns an empty collection if *rels_item_xml* is |None|.
[ "Return", "|_SerializedRelationships|", "instance", "loaded", "with", "the", "relationships", "contained", "in", "*", "rels_item_xml", "*", ".", "Returns", "an", "empty", "collection", "if", "*", "rels_item_xml", "*", "is", "|None|", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/pkgreader.py#L287-L298
train
Load the _SerializedRelationships| instance from the XML representation of the item.
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/packuri.py
PackURI.from_rel_ref
def from_rel_ref(baseURI, relative_ref): """ Return a |PackURI| instance containing the absolute pack URI formed by translating *relative_ref* onto *baseURI*. """ joined_uri = posixpath.join(baseURI, relative_ref) abs_uri = posixpath.abspath(joined_uri) return Pac...
python
def from_rel_ref(baseURI, relative_ref): """ Return a |PackURI| instance containing the absolute pack URI formed by translating *relative_ref* onto *baseURI*. """ joined_uri = posixpath.join(baseURI, relative_ref) abs_uri = posixpath.abspath(joined_uri) return Pac...
[ "def", "from_rel_ref", "(", "baseURI", ",", "relative_ref", ")", ":", "joined_uri", "=", "posixpath", ".", "join", "(", "baseURI", ",", "relative_ref", ")", "abs_uri", "=", "posixpath", ".", "abspath", "(", "joined_uri", ")", "return", "PackURI", "(", "abs_u...
Return a |PackURI| instance containing the absolute pack URI formed by translating *relative_ref* onto *baseURI*.
[ "Return", "a", "|PackURI|", "instance", "containing", "the", "absolute", "pack", "URI", "formed", "by", "translating", "*", "relative_ref", "*", "onto", "*", "baseURI", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/packuri.py#L26-L33
train
Return a |PackURI| instance containing the absolute pack URI formed by translating relative_ref onto baseURI.
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/packuri.py
PackURI.ext
def ext(self): """ The extension portion of this pack URI, e.g. ``'xml'`` for ``'/word/document.xml'``. Note the period is not included. """ # raw_ext is either empty string or starts with period, e.g. '.xml' raw_ext = posixpath.splitext(self)[1] return raw_ext[1:...
python
def ext(self): """ The extension portion of this pack URI, e.g. ``'xml'`` for ``'/word/document.xml'``. Note the period is not included. """ # raw_ext is either empty string or starts with period, e.g. '.xml' raw_ext = posixpath.splitext(self)[1] return raw_ext[1:...
[ "def", "ext", "(", "self", ")", ":", "# raw_ext is either empty string or starts with period, e.g. '.xml'", "raw_ext", "=", "posixpath", ".", "splitext", "(", "self", ")", "[", "1", "]", "return", "raw_ext", "[", "1", ":", "]", "if", "raw_ext", ".", "startswith"...
The extension portion of this pack URI, e.g. ``'xml'`` for ``'/word/document.xml'``. Note the period is not included.
[ "The", "extension", "portion", "of", "this", "pack", "URI", "e", ".", "g", ".", "xml", "for", "/", "word", "/", "document", ".", "xml", ".", "Note", "the", "period", "is", "not", "included", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/packuri.py#L45-L52
train
The extension portion of this pack URI e. g. xml for .
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/packuri.py
PackURI.idx
def idx(self): """ Return partname index as integer for tuple partname or None for singleton partname, e.g. ``21`` for ``'/ppt/slides/slide21.xml'`` and |None| for ``'/ppt/presentation.xml'``. """ filename = self.filename if not filename: return None ...
python
def idx(self): """ Return partname index as integer for tuple partname or None for singleton partname, e.g. ``21`` for ``'/ppt/slides/slide21.xml'`` and |None| for ``'/ppt/presentation.xml'``. """ filename = self.filename if not filename: return None ...
[ "def", "idx", "(", "self", ")", ":", "filename", "=", "self", ".", "filename", "if", "not", "filename", ":", "return", "None", "name_part", "=", "posixpath", ".", "splitext", "(", "filename", ")", "[", "0", "]", "# filename w/ext removed", "match", "=", ...
Return partname index as integer for tuple partname or None for singleton partname, e.g. ``21`` for ``'/ppt/slides/slide21.xml'`` and |None| for ``'/ppt/presentation.xml'``.
[ "Return", "partname", "index", "as", "integer", "for", "tuple", "partname", "or", "None", "for", "singleton", "partname", "e", ".", "g", ".", "21", "for", "/", "ppt", "/", "slides", "/", "slide21", ".", "xml", "and", "|None|", "for", "/", "ppt", "/", ...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/packuri.py#L64-L79
train
Return the index of the singleton partname.
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/packuri.py
PackURI.relative_ref
def relative_ref(self, baseURI): """ Return string containing relative reference to package item from *baseURI*. E.g. PackURI('/ppt/slideLayouts/slideLayout1.xml') would return '../slideLayouts/slideLayout1.xml' for baseURI '/ppt/slides'. """ # workaround for posixpath bu...
python
def relative_ref(self, baseURI): """ Return string containing relative reference to package item from *baseURI*. E.g. PackURI('/ppt/slideLayouts/slideLayout1.xml') would return '../slideLayouts/slideLayout1.xml' for baseURI '/ppt/slides'. """ # workaround for posixpath bu...
[ "def", "relative_ref", "(", "self", ",", "baseURI", ")", ":", "# workaround for posixpath bug in 2.6, doesn't generate correct", "# relative path when *start* (second) parameter is root ('/')", "if", "baseURI", "==", "'/'", ":", "relpath", "=", "self", "[", "1", ":", "]", ...
Return string containing relative reference to package item from *baseURI*. E.g. PackURI('/ppt/slideLayouts/slideLayout1.xml') would return '../slideLayouts/slideLayout1.xml' for baseURI '/ppt/slides'.
[ "Return", "string", "containing", "relative", "reference", "to", "package", "item", "from", "*", "baseURI", "*", ".", "E", ".", "g", ".", "PackURI", "(", "/", "ppt", "/", "slideLayouts", "/", "slideLayout1", ".", "xml", ")", "would", "return", "..", "/",...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/packuri.py#L90-L102
train
Returns string containing relative reference to package item from baseURI. E. g. baseURI = baseURI. E. g. baseURI = baseURI. E. g. baseURI = baseURI. E. g. baseURI = baseURI. E. g. baseURI = baseURI. E. g. baseURI = baseURI. E. g. baseURI = baseURI.
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...