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

Class silent_list

lib/matplotlib/cbook.py:425–456  ·  view source on GitHub ↗

A list with a short ``repr()``. This is meant to be used for a homogeneous list of artists, so that they don't cause long, meaningless output. Instead of :: [ , ,

Source from the content-addressed store, hash-verified

423
424
425class silent_list(list):
426 """
427 A list with a short ``repr()``.
428
429 This is meant to be used for a homogeneous list of artists, so that they
430 don't cause long, meaningless output.
431
432 Instead of ::
433
434 [<matplotlib.lines.Line2D object at 0x7f5749fed3c8>,
435 <matplotlib.lines.Line2D object at 0x7f5749fed4e0>,
436 <matplotlib.lines.Line2D object at 0x7f5758016550>]
437
438 one will get ::
439
440 <a list of 3 Line2D objects>
441
442 If ``self.type`` is None, the type name is obtained from the first item in
443 the list (if any).
444 """
445
446 def __init__(self, type, seq=None):
447 self.type = type
448 if seq is not None:
449 self.extend(seq)
450
451 def __repr__(self):
452 if self.type is not None or len(self) != 0:
453 tp = self.type if self.type is not None else type(self[0]).__name__
454 return f"<a list of {len(self)} {tp} objects>"
455 else:
456 return "<an empty list>"
457
458
459def _local_over_kwdict(

Callers 2

get_patchesMethod · 0.90
get_textsMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…