Skip to content

Commit 6de75f3

Browse files
committed
Add docstring inherited messages
1 parent f971267 commit 6de75f3

File tree

9 files changed

+96
-1
lines changed

9 files changed

+96
-1
lines changed

lib/matplotlib/backends/backend_agg.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ def tostring_rgba_minimized(self):
118118
return np.array(region), extents
119119

120120
def draw_path(self, gc, path, transform, rgbFace=None):
121+
# docstring inherited
121122
nmax = rcParams['agg.path.chunksize'] # here at least for testing
122123
npts = path.vertices.shape[0]
123124

@@ -162,6 +163,8 @@ def draw_mathtext(self, gc, x, y, s, prop, angle):
162163
self._renderer.draw_text_image(font_image, x, y + 1, angle, gc)
163164

164165
def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
166+
# docstring inherited
167+
165168
if ismath:
166169
return self.draw_mathtext(gc, x, y, s, prop, angle)
167170

@@ -189,6 +192,8 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
189192
font, np.round(x - xd + xo), np.round(y + yd + yo) + 1, angle, gc)
190193

191194
def get_text_width_height_descent(self, s, prop, ismath):
195+
# docstring inherited
196+
192197
if ismath in ["TeX", "TeX!"]:
193198
# todo: handle props
194199
size = prop.get_size_in_points()
@@ -214,6 +219,7 @@ def get_text_width_height_descent(self, s, prop, ismath):
214219
return w, h, d
215220

216221
def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
222+
# docstring inherited
217223
# todo, handle props, angle, origins
218224
size = prop.get_size_in_points()
219225

@@ -231,6 +237,7 @@ def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
231237
self._renderer.draw_text_image(Z, x, y, angle, gc)
232238

233239
def get_canvas_width_height(self):
240+
# docstring inherited
234241
return self.width, self.height
235242

236243
def _get_agg_font(self, prop):
@@ -247,6 +254,7 @@ def _get_agg_font(self, prop):
247254
return font
248255

249256
def points_to_pixels(self, points):
257+
# docstring inherited
250258
return points * self.dpi / 72
251259

252260
def tostring_rgb(self):
@@ -262,12 +270,15 @@ def clear(self):
262270
self._renderer.clear()
263271

264272
def option_image_nocomposite(self):
273+
# docstring inherited
274+
265275
# It is generally faster to composite each image directly to
266276
# the Figure, and there's no file size benefit to compositing
267277
# with the Agg backend
268278
return True
269279

270280
def option_scale_image(self):
281+
# docstring inherited
271282
return False
272283

273284
def restore_region(self, region, bbox=None, xy=None):

lib/matplotlib/backends/backend_cairo.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ def convert_path(ctx, path, transform, clip=None):
225225
_append_path(ctx, path, transform, clip)
226226

227227
def draw_path(self, gc, path, transform, rgbFace=None):
228+
# docstring inherited
228229
ctx = gc.ctx
229230
# Clip the path to the actual rendering extents if it isn't filled.
230231
clip = (ctx.clip_extents()
@@ -239,8 +240,9 @@ def draw_path(self, gc, path, transform, rgbFace=None):
239240

240241
def draw_markers(self, gc, marker_path, marker_trans, path, transform,
241242
rgbFace=None):
242-
ctx = gc.ctx
243+
# docstring inherited
243244

245+
ctx = gc.ctx
244246
ctx.new_path()
245247
# Create the path for the marker; it needs to be flipped here already!
246248
_append_path(ctx, marker_path, marker_trans + Affine2D().scale(1, -1))
@@ -349,6 +351,8 @@ def draw_image(self, gc, x, y, im):
349351
ctx.restore()
350352

351353
def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
354+
# docstring inherited
355+
352356
# Note: x,y are device/display coords, not user-coords, unlike other
353357
# draw_* methods
354358
if ismath:
@@ -404,9 +408,12 @@ def _draw_mathtext(self, gc, x, y, s, prop, angle):
404408
ctx.restore()
405409

406410
def get_canvas_width_height(self):
411+
# docstring inherited
407412
return self.width, self.height
408413

409414
def get_text_width_height_descent(self, s, prop, ismath):
415+
# docstring inherited
416+
410417
if ismath:
411418
width, height, descent, fonts, used_characters = \
412419
self.mathtext_parser.parse(s, self.dpi, prop)
@@ -433,12 +440,14 @@ def get_text_width_height_descent(self, s, prop, ismath):
433440
return w, h, h + y_bearing
434441

435442
def new_gc(self):
443+
# docstring inherited
436444
self.gc.ctx.save()
437445
self.gc._alpha = 1
438446
self.gc._forced_alpha = False # if True, _alpha overrides A from RGBA
439447
return self.gc
440448

441449
def points_to_pixels(self, points):
450+
# docstring inherited
442451
return points / 72 * self.dpi
443452

444453

lib/matplotlib/backends/backend_pdf.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,12 +1640,16 @@ def get_image_magnification(self):
16401640
return self.image_dpi/72.0
16411641

16421642
def option_scale_image(self):
1643+
# docstring inherited
16431644
return True
16441645

16451646
def option_image_nocomposite(self):
1647+
# docstring inherited
16461648
return not rcParams['image.composite_image']
16471649

16481650
def draw_image(self, gc, x, y, im, transform=None):
1651+
# docstring inherited
1652+
16491653
h, w = im.shape[:2]
16501654
if w == 0 or h == 0:
16511655
return
@@ -1674,6 +1678,7 @@ def draw_image(self, gc, x, y, im, transform=None):
16741678
imob, Op.use_xobject, Op.grestore)
16751679

16761680
def draw_path(self, gc, path, transform, rgbFace=None):
1681+
# docstring inherited
16771682
self.check_gc(gc, rgbFace)
16781683
self.file.writePath(
16791684
path, transform,
@@ -1753,6 +1758,8 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
17531758

17541759
def draw_markers(self, gc, marker_path, marker_trans, path, trans,
17551760
rgbFace=None):
1761+
# docstring inherited
1762+
17561763
# Same logic as in draw_path_collection
17571764
len_marker_path = len(marker_path)
17581765
uses = len(path)
@@ -1885,6 +1892,7 @@ def draw_mathtext(self, gc, x, y, s, prop, angle):
18851892
self.file.output(Op.grestore)
18861893

18871894
def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
1895+
# docstring inherited
18881896
texmanager = self.get_texmanager()
18891897
fontsize = prop.get_size_in_points()
18901898
dvifile = texmanager.make_dvi(s, fontsize)
@@ -1968,6 +1976,8 @@ def encode_string(self, s, fonttype):
19681976
return s.encode('utf-16be', 'replace')
19691977

19701978
def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
1979+
# docstring inherited
1980+
19711981
# TODO: combine consecutive texts into one BT/ET delimited section
19721982

19731983
# This function is rather complex, since there is no way to
@@ -2111,6 +2121,8 @@ def draw_text_woven(chunks):
21112121
return draw_text_woven(chunks)
21122122

21132123
def get_text_width_height_descent(self, s, prop, ismath):
2124+
# docstring inherited
2125+
21142126
if rcParams['text.usetex']:
21152127
texmanager = self.get_texmanager()
21162128
fontsize = prop.get_size_in_points()
@@ -2166,12 +2178,15 @@ def _get_font_ttf(self, prop):
21662178
return font
21672179

21682180
def flipy(self):
2181+
# docstring inherited
21692182
return False
21702183

21712184
def get_canvas_width_height(self):
2185+
# docstring inherited
21722186
return self.file.width * 72.0, self.file.height * 72.0
21732187

21742188
def new_gc(self):
2189+
# docstring inherited
21752190
return GraphicsContextPdf(self.file)
21762191

21772192

lib/matplotlib/backends/backend_pgf.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,8 @@ def __init__(self, figure, fh, dummy=False):
406406

407407
def draw_markers(self, gc, marker_path, marker_trans, path, trans,
408408
rgbFace=None):
409+
# docstring inherited
410+
409411
writeln(self.fh, r"\begin{pgfscope}")
410412

411413
# convert from display units to in
@@ -437,6 +439,7 @@ def draw_markers(self, gc, marker_path, marker_trans, path, trans,
437439
writeln(self.fh, r"\end{pgfscope}")
438440

439441
def draw_path(self, gc, path, transform, rgbFace=None):
442+
# docstring inherited
440443
writeln(self.fh, r"\begin{pgfscope}")
441444
# draw the path
442445
self._print_pgf_clip(gc)
@@ -608,12 +611,16 @@ def _pgf_path_draw(self, stroke=True, fill=False):
608611
writeln(self.fh, r"\pgfusepath{%s}" % ",".join(actions))
609612

610613
def option_scale_image(self):
614+
# docstring inherited
611615
return True
612616

613617
def option_image_nocomposite(self):
618+
# docstring inherited
614619
return not rcParams['image.composite_image']
615620

616621
def draw_image(self, gc, x, y, im, transform=None):
622+
# docstring inherited
623+
617624
h, w = im.shape[:2]
618625
if w == 0 or h == 0:
619626
return
@@ -648,9 +655,12 @@ def draw_image(self, gc, x, y, im, transform=None):
648655
writeln(self.fh, r"\end{pgfscope}")
649656

650657
def draw_tex(self, gc, x, y, s, prop, angle, ismath="TeX!", mtext=None):
658+
# docstring inherited
651659
self.draw_text(gc, x, y, s, prop, angle, ismath, mtext)
652660

653661
def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
662+
# docstring inherited
663+
654664
# prepare string for tex
655665
s = common_texification(s)
656666
prop_cmds = _font_properties_str(prop)
@@ -700,6 +710,8 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
700710
writeln(self.fh, r"\end{pgfscope}")
701711

702712
def get_text_width_height_descent(self, s, prop, ismath):
713+
# docstring inherited
714+
703715
# check if the math is supposed to be displaystyled
704716
s = common_texification(s)
705717

@@ -712,15 +724,19 @@ def get_text_width_height_descent(self, s, prop, ismath):
712724
return w * f, h * f, d * f
713725

714726
def flipy(self):
727+
# docstring inherited
715728
return False
716729

717730
def get_canvas_width_height(self):
731+
# docstring inherited
718732
return self.figure.get_figwidth(), self.figure.get_figheight()
719733

720734
def points_to_pixels(self, points):
735+
# docstring inherited
721736
return points * mpl_pt_to_in * self.dpi
722737

723738
def new_gc(self):
739+
# docstring inherited
724740
return GraphicsContextPgf()
725741

726742

lib/matplotlib/backends/backend_ps.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,12 @@ def create_hatch(self, hatch):
324324
return name
325325

326326
def get_canvas_width_height(self):
327+
# docstring inherited
327328
return self.width * 72.0, self.height * 72.0
328329

329330
def get_text_width_height_descent(self, s, prop, ismath):
331+
# docstring inherited
332+
330333
if rcParams['text.usetex']:
331334
texmanager = self.get_texmanager()
332335
fontsize = prop.get_size_in_points()
@@ -362,6 +365,7 @@ def get_text_width_height_descent(self, s, prop, ismath):
362365
return w, h, d
363366

364367
def flipy(self):
368+
# docstring inherited
365369
return False
366370

367371
def _get_font_afm(self, prop):
@@ -411,9 +415,11 @@ def get_image_magnification(self):
411415
return self.image_magnification
412416

413417
def option_scale_image(self):
418+
# docstring inherited
414419
return True
415420

416421
def option_image_nocomposite(self):
422+
# docstring inherited
417423
return not rcParams['image.composite_image']
418424

419425
def _get_image_h_w_bits_command(self, im):
@@ -423,6 +429,8 @@ def _get_image_h_w_bits_command(self, im):
423429
return h, w, bits, imagecmd
424430

425431
def draw_image(self, gc, x, y, im, transform=None):
432+
# docstring inherited
433+
426434
h, w, bits, imagecmd = self._get_image_h_w_bits_command(im)
427435
hexlines = b'\n'.join(self._hex_lines(bits)).decode('ascii')
428436

@@ -488,13 +496,15 @@ def _get_clip_path(self, clippath, clippath_transform):
488496
return pid
489497

490498
def draw_path(self, gc, path, transform, rgbFace=None):
499+
# docstring inherited
491500
clip = rgbFace is None and gc.get_hatch_path() is None
492501
simplify = path.should_simplify and clip
493502
ps = self._convert_path(path, transform, clip=clip, simplify=simplify)
494503
self._draw_ps(ps, gc, rgbFace)
495504

496505
def draw_markers(
497506
self, gc, marker_path, marker_trans, path, trans, rgbFace=None):
507+
# docstring inherited
498508

499509
if debugPS:
500510
self._pswriter.write('% draw_markers \n')
@@ -595,6 +605,8 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
595605
self._path_collection_id += 1
596606

597607
def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
608+
# docstring inherited
609+
598610
w, h, bl = self.get_text_width_height_descent(s, prop, ismath)
599611
fontsize = prop.get_size_in_points()
600612
thetext = 'psmarker%d' % self.textcnt
@@ -632,6 +644,8 @@ def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
632644
self.textcnt += 1
633645

634646
def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
647+
# docstring inherited
648+
635649
# local to avoid repeated attribute lookups
636650
write = self._pswriter.write
637651
if debugPS:
@@ -734,6 +748,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
734748
self._pswriter.write(ps)
735749

736750
def new_gc(self):
751+
# docstring inherited
737752
return GraphicsContextPS()
738753

739754
def draw_mathtext(self, gc, x, y, s, prop, angle):

0 commit comments

Comments
 (0)