8000 Add some docstrings · matplotlib/matplotlib@d135d87 · GitHub
[go: up one dir, main page]

Skip to content

Commit d135d87

Browse files
committed
Add some docstrings
and delete a useless comment
1 parent 070efac commit d135d87

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

lib/matplotlib/backends/backend_pdf.py

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,22 @@ class Stream:
348348
__slots__ = ('id', 'len', 'pdfFile', 'file', 'compressobj', 'extra', 'pos')
349349

350350
def __init__(self, id, len, file, extra=None, png=None):
351-
"""id: object id of stream; len: an unused Reference object for the
352-
length of the stream, or None (to use a memory buffer); file:
353-
a PdfFile; extra: a dictionary of extra key-value pairs to
354-
include in the stream header; png: if the data is already
355-
png compressed, the decode parameters"""
351+
"""
352+
Parameters
353+
----------
354+
355+
id : int
356+
object id of the stream
357+
len : Reference or None
358+
an unused Reference object for the length of the stream;
359+
None means to use a memory buffer so the length can be inlined
360+
file : PdfFile
361+
the underlying object to write the stream to
362+
extra : dict from Name to anything, or None
363+
extra key-value pairs to include in the stream header
364+
png : dict or None
365+
if the data is already png encoded, the decode parameters
366+
"""
356367
self.id = id # object id
357368
self.len = len # id of length object
358369
self.pdfFile = file
@@ -424,6 +435,24 @@ class PdfFile:
424435
"""PDF file object."""
425436

426437
def __init__(self, filename, metadata=None):
438+
"""
439+
Parameters
440+
----------
441+
442+
filename : file-like object or string
443+
output target; if a string, a file will be opened for writing
444+
metadata : dict from strings to strings and dates
445+
Information dictionary object (see PDF reference section 10.2.1
446+
'Document Information Dictionary'), e.g.:
447+
`{'Creator': 'My software', 'Author': 'Me',
448+
'Title': 'Awesome fig'}`
449+
450+
The standard keys are `'Title'`, `'Author'`, `'Subject'`,
451+
`'Keywords'`, `'Creator'`, `'Producer'`, `'CreationDate'`,
452+
`'ModDate'`, and `'Trapped'`. Values have been predefined
453+
for `'Creator'`, `'Producer'` and `'CreationDate'`. They
454+
can be removed by setting them to `None`.
455+
"""
427456
self.objectId = itertools.count(1) # consumed by reserveObject
428457
self.xrefTable = [[0, 65535, 'the zero object']]
429458
self.passed_in_file_object = False
@@ -2310,13 +2339,6 @@ def finalize(self):
23102339
cmds.extend(self.pop())
23112340
return cmds
23122341

2313-
########################################################################
2314-
#
2315-
# The following functions and classes are for pylab and implement
2316-
# window/figure managers, etc...
2317-
#
2318-
########################################################################
2319-
23202342

23212343
class PdfPages:
23222344
"""

0 commit comments

Comments
 (0)
0