text stringlengths 81 112k |
|---|
The top-most row index in the vertical span of this cell.
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 |
Add the width of *other_tc* to this cell. Does nothing if either this
tc or *other_tc* does not have a specified width.
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.
... |
The grid column at which this cell begins.
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) |
Grow this cell to *width* grid columns and *height* rows by expanding
horizontal spans and creating continuation cells to form vertical
spans.
def _grow_to(self, width, height, top_tc=None):
"""
Grow this cell to *width* grid columns and *height* rows by expanding
horizontal spa... |
True if this cell contains only a single empty ``<w:p>`` element.
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[... |
Append the content of this cell to *other_tc*, leaving this cell with
a single empty ``<w:p>`` element.
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 se... |
Remove the last content element from this cell if it is an empty
``<w:p>`` element.
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_co... |
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 _span_dimensions(self, other_tc):
"""
Return a (top, left, height, width) 4-tuple specifying the extents of
the merged cel... |
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... |
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... |
The tc element immediately below this one in its grid column.
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) |
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.
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.
""... |
The tr element next in sequence after the tr this cell appears in, or
|None| if this cell appears in the last row.
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 = sel... |
Decorating a class with @alias('FOO', 'BAR', ..) allows the class to
be referenced by each of the names provided as arguments.
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 decorato... |
The RestructuredText documentation page for the enumeration. This is
the only API member for the class.
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----... |
Docstring of the enumeration, formatted for documentation page.
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 Non... |
Return an individual member definition formatted as an RST glossary
entry, wrapped to fit within 78 columns.
def _member_def(self, member):
"""
Return an individual member definition formatted as an RST glossary
entry, wrapped to fit within 78 columns.
"""
member_docstri... |
A single string containing the aggregated member definitions section
of the documentation page
def _member_defs(self):
"""
A single string containing the aggregated member definitions section
of the documentation page
"""
members = self._clsdict['__members__']
me... |
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.
def _add_enum_members(meta, clsdict):
"""
Dispatch ``.add_to_enum()`` call to each member so it... |
Return a sequence containing the enumeration values that are valid
assignment values. Return-only values are excluded.
def _collect_valid_settings(meta, clsdict):
"""
Return a sequence containing the enumeration values that are valid
assignment values. Return-only values are excluded.
... |
Raise |ValueError| if *value* is not an assignable value.
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.__na... |
Return the enumeration member corresponding to the XML value
*xml_val*.
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(
"a... |
Return the XML value of the enumeration value *enum_val*.
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... |
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):
"""
Add a member n... |
Compile XML mappings in addition to base add behavior.
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) |
Add XML mappings to the enumeration class state for this member.
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
... |
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.
def Document(docx=None):
"""
Return a |Document| object loaded from *docx*, wh... |
Return the path to the built-in default .docx package.
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') |
|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... |
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 ... |
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 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.
def _line_spacing_rule(line, lineRule):
"""
Return the line spacing rul... |
Return a new ``<w:num>`` element having numId of *num_id* and having
a ``<w:abstractNumId>`` child with val attribute set to
*abstractNum_id*.
def new(cls, num_id, abstractNum_id):
"""
Return a new ``<w:num>`` element having numId of *num_id* and having
a ``<w:abstractNumId>`` c... |
Return a newly added CT_Num (<w:num>) element referencing the
abstract numbering definition identified by *abstractNum_id*.
def add_num(self, abstractNum_id):
"""
Return a newly added CT_Num (<w:num>) element referencing the
abstract numbering definition identified by *abstractNum_id*.
... |
Return the ``<w:num>`` child element having ``numId`` attribute
matching *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:
... |
The first ``numId`` unused by a ``<w:num>`` element, starting at
1 and filling any gaps in numbering between existing ``<w:num>``
elements.
def _next_numId(self):
"""
The first ``numId`` unused by a ``<w:num>`` element, starting at
1 and filling any gaps in numbering between exi... |
Return a newly added |_Relationship| instance.
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_exte... |
Return relationship of *reltype* to *target_part*, newly added if not
already present in collection.
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_m... |
Return rId of external relationship of *reltype* to *target_ref*,
newly added if not already present in collection.
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.
... |
Serialize this relationship collection into XML suitable for storage
as a .rels file in an OPC package.
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()
... |
Return relationship of matching *reltype*, *target*, and
*is_external* from collection, or None if not found.
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.
... |
Return single relationship of type *reltype* from the collection.
Raises |KeyError| if no matching relationship is found. Raises
|ValueError| if more than one matching relationship is found.
def _get_rel_of_type(self, reltype):
"""
Return single relationship of type *reltype* from the c... |
Next available rId in collection, starting from 'rId1' and making use
of any gaps in numbering, e.g. 'rId2' for rIds ['rId1', 'rId3'].
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', '... |
Return a new ``CT_DecimalNumber`` element having tagname *nsptagname*
and ``val`` attribute set to *val*.
def new(cls, nsptagname, val):
"""
Return a new ``CT_DecimalNumber`` element having tagname *nsptagname*
and ``val`` attribute set to *val*.
"""
return OxmlElement(n... |
Return a new ``CT_String`` element with tagname *nsptagname* and
``val`` attribute set to *val*.
def new(cls, nsptagname, val):
"""
Return a new ``CT_String`` element with tagname *nsptagname* and
``val`` attribute set to *val*.
"""
elm = OxmlElement(nsptagname)
... |
Return a style object of the appropriate |BaseStyle| subclass, according
to the type of *style_elm*.
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: _Paragrap... |
The UI name of this style.
def name(self):
"""
The UI name of this style.
"""
name = self._element.name_val
if name is None:
return None
return BabelFish.internal2ui(name) |
Member of :ref:`WdStyleType` corresponding to the type of this style,
e.g. ``WD_STYLE_TYPE.PARAGRAPH``.
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 ty... |
|_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... |
Integer value of revision property.
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... |
Set revision property to string value of integer *value*.
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'"
ra... |
Return element returned by 'get_or_add_' method for *prop_name*.
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_na... |
Return a |datetime| instance that is offset from datetime *dt* by
the timezone offset specified in *offset_str*, a string like
``'-07:00'``.
def _offset_dt(cls, dt, offset_str):
"""
Return a |datetime| instance that is offset from datetime *dt* by
the timezone offset specified i... |
Set date/time value of child element having *prop_name* to *value*.
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 ... |
Set string value of *name* property to *value*.
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 pr... |
Return the text in the element matching *property_name*, or an empty
string if the element is not present or contains no text.
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 cont... |
Return |Gif| instance having header properties parsed from GIF image
in *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)
ret... |
Return contents of file corresponding to *pack_uri* in package
directory.
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... |
Return rels item XML for source with *source_uri*, or None if the
item has no rels item.
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_... |
Return rels item XML for source with *source_uri* or None if no rels
item is present.
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.re... |
Write *blob* to this zip package with the membername corresponding to
*pack_uri*.
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) |
Return |Bmp| instance having header properties parsed from the BMP
image in *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_... |
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'``.
def qn(tag):
"""
Stands for "qualified name", a utility function to turn a namespace
pre... |
Remove all child elements, except the ``<w:pPr>`` element if present.
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(ch... |
Unconditionally replace or add *sectPr* as a grandchild in the
correct sequence.
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._i... |
Return a |PackageReader| instance loaded with contents of *pkg_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_x... |
Generate a 4-tuple `(partname, content_type, reltype, blob)` for each
of the serialized parts in the package.
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._spart... |
Generate a 2-tuple `(source_uri, srel)` for each of the relationships
in the package.
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)
... |
Return |_SerializedRelationships| instance populated with
relationships for source identified by *source_uri*.
def _srels_for(phys_reader, source_uri):
"""
Return |_SerializedRelationships| instance populated with
relationships for source identified by *source_uri*.
"""
... |
Return a new |_ContentTypeMap| instance populated with the contents
of *content_types_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)
... |
|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.
def target_partname(self):
"""
|PackURI| instance containing partname targeted by this relation... |
Return |_SerializedRelationships| instance loaded with the
relationships contained in *rels_item_xml*. Returns an empty
collection if *rels_item_xml* is |None|.
def load_from_xml(baseURI, rels_item_xml):
"""
Return |_SerializedRelationships| instance loaded with the
relationship... |
Return a |PackURI| instance containing the absolute pack URI formed by
translating *relative_ref* onto *baseURI*.
def from_rel_ref(baseURI, relative_ref):
"""
Return a |PackURI| instance containing the absolute pack URI formed by
translating *relative_ref* onto *baseURI*.
"""
... |
The extension portion of this pack URI, e.g. ``'xml'`` for
``'/word/document.xml'``. Note the period is not included.
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... |
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'``.
def idx(self):
"""
Return partname index as integer for tuple partname or None for
singleton partname, e.... |
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'.
def relative_ref(self, baseURI):
"""
Return string containing relative reference to p... |
The pack URI of the .rels part corresponding to the current pack URI.
Only produces sensible output if the pack URI is a partname or the
package pseudo-partname '/'.
def rels_uri(self):
"""
The pack URI of the .rels part corresponding to the current pack URI.
Only produces sensi... |
Return a new ``<Default>`` element with attributes set to parameter
values.
def new(ext, content_type):
"""
Return a new ``<Default>`` element with attributes set to parameter
values.
"""
xml = '<Default xmlns="%s"/>' % nsmap['ct']
default = parse_xml(xml)
... |
Return a new ``<Override>`` element with attributes set to parameter
values.
def new(partname, content_type):
"""
Return a new ``<Override>`` element with attributes set to parameter
values.
"""
xml = '<Override xmlns="%s"/>' % nsmap['ct']
override = parse_xml(xm... |
Return a new ``<Relationship>`` element.
def new(rId, reltype, target, target_mode=RTM.INTERNAL):
"""
Return a new ``<Relationship>`` element.
"""
xml = '<Relationship xmlns="%s"/>' % nsmap['pr']
relationship = parse_xml(xml)
relationship.set('Id', rId)
relations... |
Add a child ``<Relationship>`` element with attributes set according
to parameter values.
def add_rel(self, rId, reltype, target, is_external=False):
"""
Add a child ``<Relationship>`` element with attributes set according
to parameter values.
"""
target_mode = RTM.EXTER... |
Add a child ``<Default>`` element with attributes set to parameter
values.
def add_default(self, ext, content_type):
"""
Add a child ``<Default>`` element with attributes set to parameter
values.
"""
default = CT_Default.new(ext, content_type)
self.append(default... |
Add a child ``<Override>`` element with attributes set to parameter
values.
def add_override(self, partname, content_type):
"""
Add a child ``<Override>`` element with attributes set to parameter
values.
"""
override = CT_Override.new(partname, content_type)
self... |
Return a paragraph newly added to the end of the content in this
container, having *text* in a single run if present, and having
paragraph style *style*. If *style* is |None|, no paragraph style is
applied, which has the same effect as applying the 'Normal' style.
def add_paragraph(self, text='... |
Return a table of *width* having *rows* rows and *cols* columns,
newly appended to the content in this container. *width* is evenly
distributed between the table columns.
def add_table(self, rows, cols, width):
"""
Return a table of *width* having *rows* rows and *cols* columns,
... |
A list containing the tables in this container, in document order.
Read-only.
def tables(self):
"""
A list containing the tables in this container, in document order.
Read-only.
"""
from .table import Table
return [Table(tbl, self) for tbl in self._element.tbl_ls... |
Return a |_Chunk| subclass instance appropriate to *chunk_type* parsed
from *stream_rdr* at *offset*.
def _ChunkFactory(chunk_type, stream_rdr, offset):
"""
Return a |_Chunk| subclass instance appropriate to *chunk_type* parsed
from *stream_rdr* at *offset*.
"""
chunk_cls_map = {
PNG_CH... |
Integer dots per inch for the width of this image. Defaults to 72
when not present in the file, as is often the case.
def horz_dpi(self):
"""
Integer dots per inch for the width of this image. Defaults to 72
when not present in the file, as is often the case.
"""
pHYs = ... |
Integer dots per inch for the height of this image. Defaults to 72
when not present in the file, as is often the case.
def vert_dpi(self):
"""
Integer dots per inch for the height of this image. Defaults to 72
when not present in the file, as is often the case.
"""
pHYs ... |
Return a |_Chunks| instance containing the PNG chunks in *stream*.
def from_stream(cls, stream):
"""
Return a |_Chunks| instance containing the PNG chunks in *stream*.
"""
chunk_parser = _ChunkParser.from_stream(stream)
chunks = [chunk for chunk in chunk_parser.iter_chunks()]
... |
IHDR chunk in PNG image
def IHDR(self):
"""
IHDR chunk in PNG image
"""
match = lambda chunk: chunk.type_name == PNG_CHUNK_TYPE.IHDR # noqa
IHDR = self._find_first(match)
if IHDR is None:
raise InvalidImageStreamError('no IHDR chunk in PNG image')
re... |
pHYs chunk in PNG image, or |None| if not present
def pHYs(self):
"""
pHYs chunk in PNG image, or |None| if not present
"""
match = lambda chunk: chunk.type_name == PNG_CHUNK_TYPE.pHYs # noqa
return self._find_first(match) |
Generate a |_Chunk| subclass instance for each chunk in this parser's
PNG stream, in the order encountered in the stream.
def iter_chunks(self):
"""
Generate a |_Chunk| subclass instance for each chunk in this parser's
PNG stream, in the order encountered in the stream.
"""
... |
Generate a (chunk_type, chunk_offset) 2-tuple for each of the chunks
in the PNG image stream. Iteration stops after the IEND chunk is
returned.
def _iter_chunk_offsets(self):
"""
Generate a (chunk_type, chunk_offset) 2-tuple for each of the chunks
in the PNG image stream. Iterat... |
Return an _IHDRChunk instance containing the image dimensions
extracted from the IHDR chunk in *stream* at *offset*.
def from_offset(cls, chunk_type, stream_rdr, offset):
"""
Return an _IHDRChunk instance containing the image dimensions
extracted from the IHDR chunk in *stream* at *offs... |
Return a _pHYsChunk instance containing the image resolution
extracted from the pHYs chunk in *stream* at *offset*.
def from_offset(cls, chunk_type, stream_rdr, offset):
"""
Return a _pHYsChunk instance containing the image resolution
extracted from the pHYs chunk in *stream* at *offset... |
Return the int value of the byte at the file position defined by
self._base_offset + *base* + *offset*. If *base* is None, the byte is
read from the current position in the stream.
def read_byte(self, base, offset=0):
"""
Return the int value of the byte at the file position defined by
... |
Return the int value of the four bytes at the file position defined by
self._base_offset + *base* + *offset*. If *base* is None, the long is
read from the current position in the stream. The endian setting of
this instance is used to interpret the byte layout of the long.
def read_long(self, ba... |
Return the int value of the two bytes at the file position determined
by *base* and *offset*, similarly to ``read_long()`` above.
def read_short(self, base, offset=0):
"""
Return the int value of the two bytes at the file position determined
by *base* and *offset*, similarly to ``read_l... |
Return a string containing the *char_count* bytes at the file
position determined by self._base_offset + *base* + *offset*.
def read_str(self, char_count, base, offset=0):
"""
Return a string containing the *char_count* bytes at the file
position determined by self._base_offset + *base*... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.