MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / __init__

Method __init__

lib/matplotlib/backends/backend_pdf.py:515–552  ·  view source on GitHub ↗

Parameters ---------- id : int Object id of the stream. len : Reference or None An unused Reference object for the length of the stream; None means to use a memory buffer so the length can be inlined. file : PdfFile

(self, id, len, file, extra=None, png=None)

Source from the content-addressed store, hash-verified

513 __slots__ = ('id', 'len', 'pdfFile', 'file', 'compressobj', 'extra', 'pos')
514
515 def __init__(self, id, len, file, extra=None, png=None):
516 """
517 Parameters
518 ----------
519 id : int
520 Object id of the stream.
521 len : Reference or None
522 An unused Reference object for the length of the stream;
523 None means to use a memory buffer so the length can be inlined.
524 file : PdfFile
525 The underlying object to write the stream to.
526 extra : dict from Name to anything, or None
527 Extra key-value pairs to include in the stream header.
528 png : dict or None
529 If the data is already png encoded, the decode parameters.
530 """
531 self.id = id # object id
532 self.len = len # id of length object
533 self.pdfFile = file
534 self.file = file.fh # file to which the stream is written
535 self.compressobj = None # compression object
536 if extra is None:
537 self.extra = dict()
538 else:
539 self.extra = extra.copy()
540 if png is not None:
541 self.extra.update({'Filter': Name('FlateDecode'),
542 'DecodeParms': png})
543
544 self.pdfFile.recordXref(self.id)
545 if mpl.rcParams['pdf.compression'] and not png:
546 self.compressobj = zlib.compressobj(
547 mpl.rcParams['pdf.compression'])
548 if self.len is None:
549 self.file = BytesIO()
550 else:
551 self._writeHeader()
552 self.pos = self.file.tell()
553
554 def _writeHeader(self):
555 write = self.file.write

Callers

nothing calls this directly

Calls 5

_writeHeaderMethod · 0.95
NameClass · 0.85
recordXrefMethod · 0.80
copyMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected