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

Method _update_set_signature_and_docstring

lib/matplotlib/artist.py:153–191  ·  view source on GitHub ↗

Update the signature of the set function to list all properties as keyword arguments. Property aliases are not listed in the signature for brevity, but are still accepted as keyword arguments.

(cls)

Source from the content-addressed store, hash-verified

151
152 @classmethod
153 def _update_set_signature_and_docstring(cls):
154 """
155 Update the signature of the set function to list all properties
156 as keyword arguments.
157
158 Property aliases are not listed in the signature for brevity, but
159 are still accepted as keyword arguments.
160 """
161 cls.set.__signature__ = Signature(
162 [Parameter("self", Parameter.POSITIONAL_OR_KEYWORD),
163 *[Parameter(prop, Parameter.KEYWORD_ONLY, default=_api.UNSET)
164 for prop in ArtistInspector(cls).get_setters()
165 if prop not in Artist._PROPERTIES_EXCLUDED_FROM_SET]])
166 cls.set._autogenerated_signature = True
167
168 cls.set.__doc__ = ("""\
169Set multiple properties at once.
170
171::
172
173 a.set(a=A, b=B, c=C)
174
175is equivalent to ::
176
177 a.set_a(A)
178 a.set_b(B)
179 a.set_c(C)
180
181In addition to the full property names, aliases are also supported, e.g.
182``set(lw=2)`` is equivalent to ``set(linewidth=2)``, but it is an error
183to pass both simultaneously.
184
185The order of the individual setter calls matches the order of parameters
186in ``set()``. However, most properties do not depend on each other so
187that order is rarely relevant.
188
189Supported properties are
190
191""" + kwdoc(cls))
192
193 def __init__(self):
194 self._stale = True

Callers 2

__init_subclass__Method · 0.80
artist.pyFile · 0.80

Calls 3

ArtistInspectorClass · 0.85
kwdocFunction · 0.85
get_settersMethod · 0.80

Tested by

no test coverage detected