Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a07ca82

Browse files
committed
MNT: switch to using class level type annotations to doc target
1 parent e72f942 commit a07ca82

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from operator import attrgetter
88
import re
99
import textwrap
10+
from typing import Callable
1011
import types
1112

1213
import numpy as np
@@ -594,20 +595,23 @@ class _AxesBase(martist.Artist):
594595
- :doc:`Axis API </api/axis_api>`
595596
"""
596597

597-
#: Callable to format the x-data in an interactive window.
598-
#:
599-
#: The expected signature is ::
600-
#:
601-
#: def fmt(val: float, /) -> str: ...
602-
fmt_xdata = None
598+
fmt_xdata: Callable[[float], str] | None
599+
"""
600+
Callable to format the x-data in an interactive window.
601+
602+
The expected signature is ::
603603
604-
#: Callable to format the y-data in an interactive window.
605-
#:
606-
#: The expected signature is ::
607-
#:
608-
#: def fmt(val: float, /) -> str: ...
609-
fmt_ydata = None
604+
def fmt(val: float, /) -> str: ...
605+
"""
610606

607+
fmt_ydata: Callable[[float], str] | None
608+
"""
609+
Callable to format the y-data in an interactive window.
610+
611+
The expected signature is ::
612+
613+
def fmt(val: float, /) -> str: ...
614+
"""
611615
def __str__(self):
612616
return "{0}({1[0]:g},{1[1]:g};{1[2]:g}x{1[3]:g})".format(
613617
type(self).__name__, self._position.bounds)

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import itertools
1515
import math
1616
import textwrap
17+
from typing import Callable
1718
import warnings
1819

1920
import numpy as np
@@ -57,12 +58,14 @@ class Axes3D(Axes):
5758
Axes._shared_axes["z"] = cbook.Grouper()
5859
Axes._shared_axes["view"] = cbook.Grouper()
5960

60-
#: Callable to format the z-data in an interactive window.
61-
#:
62-
#: The expected signature is ::
63-
#:
64-
#: def fmt(val: float, /) -> str: ...
65-
fmt_zdata = None
61+
fmt_zdata: Callable[[float], str] | None
62+
"""
63+
Callable to format the z-data in an interactive window.
64+
65+
The expected signature is ::
66+
67+
def fmt(val: float, /) -> str: ...
68+
"""
6669

6770
def __init__(
6871
self, fig, rect=None, *args,

0 commit comments

Comments
 (0)