MCPcopy Index your code
hub / github.com/python-openxml/python-docx / from_stream

Method from_stream

src/docx/image/jpeg.py:403–415  ·  view source on GitHub ↗

Return an |_SofMarker| instance for the SOFn marker at `offset` in stream.

(cls, stream, marker_code, offset)

Source from the content-addressed store, hash-verified

401
402 @classmethod
403 def from_stream(cls, stream, marker_code, offset):
404 """Return an |_SofMarker| instance for the SOFn marker at `offset` in stream."""
405 # field off type notes
406 # ------------------ --- ----- ----------------------------
407 # segment length 0 short
408 # Data precision 2 byte
409 # Vertical lines 3 short px_height
410 # Horizontal lines 5 short px_width
411 # ------------------ --- ----- ----------------------------
412 segment_length = stream.read_short(offset)
413 px_height = stream.read_short(offset, 3)
414 px_width = stream.read_short(offset, 5)
415 return cls(marker_code, offset, segment_length, px_width, px_height)
416
417 @property
418 def px_height(self):

Callers

nothing calls this directly

Calls 1

read_shortMethod · 0.80

Tested by

no test coverage detected