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

Method __init_subclass__

lib/matplotlib/artist.py:119–143  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

117 zorder = 0
118
119 def __init_subclass__(cls):
120
121 # Decorate draw() method so that all artists are able to stop
122 # rastrization when necessary. If the artist's draw method is already
123 # decorated (has a `_supports_rasterization` attribute), it won't be
124 # decorated.
125
126 if not hasattr(cls.draw, "_supports_rasterization"):
127 cls.draw = _prevent_rasterization(cls.draw)
128
129 # Inject custom set() methods into the subclass with signature and
130 # docstring based on the subclasses' properties.
131
132 if not hasattr(cls.set, '_autogenerated_signature'):
133 # Don't overwrite cls.set if the subclass or one of its parents
134 # has defined a set method set itself.
135 # If there was no explicit definition, cls.set is inherited from
136 # the hierarchy of auto-generated set methods, which hold the
137 # flag _autogenerated_signature.
138 return
139
140 cls.set = lambda self, **kwargs: Artist.set(self, **kwargs)
141 cls.set.__name__ = "set"
142 cls.set.__qualname__ = f"{cls.__qualname__}.set"
143 cls._update_set_signature_and_docstring()
144
145 _PROPERTIES_EXCLUDED_FROM_SET = [
146 'navigate_mode', # not a user-facing function

Callers

nothing calls this directly

Calls 3

_prevent_rasterizationFunction · 0.85
setMethod · 0.45

Tested by

no test coverage detected