Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9280b47

Browse files
authored
Merge pull request#30783 from timhoffm/doc-make-keyword-only
DOC: Add example usage to make_keyword_only()
1 parentb94feab commit9280b47

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎lib/matplotlib/_api/deprecation.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,23 @@ def make_keyword_only(since, name, func=None):
419419
When used on a method that has a pyplot wrapper, this should be the
420420
outermost decorator, so that :file:`boilerplate.py` can access the original
421421
signature.
422+
423+
Examples
424+
--------
425+
Assume we want to only allow *dataset* and *positions* as positional
426+
parameters on the method ::
427+
428+
def violinplot(self, dataset, positions=None, vert=None, ...)
429+
430+
Introduce the deprecation by adding the decorator ::
431+
432+
@_api.make_keyword_only("3.10", "vert")
433+
def violinplot(self, dataset, positions=None, vert=None, ...)
434+
435+
When the deprecation expires, switch to ::
436+
437+
def violinplot(self, dataset, positions=None, *, vert=None, ...)
438+
422439
"""
423440

424441
decorator=functools.partial(make_keyword_only,since,name)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp