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

Commit91d2c54

Browse files
committed
[TYP] Change typing for texts to StrLike
1 parentdce9ea4 commit91d2c54

14 files changed

+72
-62
lines changed

‎lib/matplotlib/artist.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ from .figure import Figure, SubFigure
44
from .pathimportPath
55
from .patchesimportPatch
66
from .patheffectsimportAbstractPathEffect
7+
from .textimportText
78
from .transformsimport (
89
BboxBase,
910
Bbox,
1011
Transform,
1112
TransformedPatchPath,
1213
TransformedPath,
1314
)
15+
from .typingimportStrLike
1416

1517
importnumpyasnp
1618

@@ -117,8 +119,8 @@ class Artist:
117119
defset_visible(self,b:bool)->None: ...
118120
defset_animated(self,b:bool)->None: ...
119121
defset_in_layout(self,in_layout:bool)->None: ...
120-
defget_label(self)->object: ...
121-
defset_label(self,s:object)->None: ...
122+
defget_label(self)->str|Text|None: ...
123+
defset_label(self,s:StrLike|None)->None: ...
122124
defget_zorder(self)->float: ...
123125
defset_zorder(self,level:float)->None: ...
124126
@property

‎lib/matplotlib/axes/_axes.pyi

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ from collections.abc import Callable, Sequence
3434
fromtypingimportAny,Literal,overload
3535
importnumpyasnp
3636
fromnumpy.typingimportArrayLike
37-
frommatplotlib.typingimportColorType,MarkerType,LineStyleType
37+
frommatplotlib.typingimportColorType,MarkerType,LineStyleType,StrLike
3838

3939
classAxes(_AxesBase):
4040
defget_title(self,loc:Literal["left","center","right"]= ...)->str: ...
4141
defset_title(
4242
self,
43-
label:str,
43+
label:StrLike,
4444
fontdict:dict[str,Any]|None= ...,
4545
loc:Literal["left","center","right"]|None= ...,
4646
pad:float|None= ...,
@@ -111,13 +111,13 @@ class Axes(_AxesBase):
111111
self,
112112
x:float,
113113
y:float,
114-
s:str,
114+
s:StrLike,
115115
fontdict:dict[str,Any]|None= ...,
116116
**kwargs
117117
)->Text: ...
118118
defannotate(
119119
self,
120-
text:str,
120+
text:StrLike,
121121
xy:tuple[float,float],
122122
xytext:tuple[float,float]|None= ...,
123123
xycoords:str
@@ -164,7 +164,7 @@ class Axes(_AxesBase):
164164
xmax:float|ArrayLike,
165165
colors:ColorType|Sequence[ColorType]|None= ...,
166166
linestyles:LineStyleType= ...,
167-
label:str= ...,
167+
label:StrLike= ...,
168168
*,
169169
data=...,
170170
**kwargs
@@ -176,7 +176,7 @@ class Axes(_AxesBase):
176176
ymax:float|ArrayLike,
177177
colors:ColorType|Sequence[ColorType]|None= ...,
178178
linestyles:LineStyleType= ...,
179-
label:str= ...,
179+
label:StrLike= ...,
180180
*,
181181
data=...,
182182
**kwargs
@@ -289,7 +289,7 @@ class Axes(_AxesBase):
289289
markerfmt:str|None= ...,
290290
basefmt:str|None= ...,
291291
bottom:float= ...,
292-
label:str|None= ...,
292+
label:StrLike|None= ...,
293293
orientation:Literal["vertical","horizontal"]= ...,
294294
data=...,
295295
)->StemContainer: ...
@@ -443,7 +443,7 @@ class Axes(_AxesBase):
443443
self,x:float,y:float,dx:float,dy:float,**kwargs
444444
)->FancyArrow: ...
445445
defquiverkey(
446-
self,Q:Quiver,X:float,Y:float,U:float,label:str,**kwargs
446+
self,Q:Quiver,X:float,Y:float,U:float,label:StrLike,**kwargs
447447
)->QuiverKey: ...
448448
defquiver(self,*args,data=...,**kwargs)->Quiver: ...
449449
defbarbs(self,*args,data=...,**kwargs)->Barbs: ...
@@ -549,7 +549,7 @@ class Axes(_AxesBase):
549549
rwidth:float|None= ...,
550550
log:bool= ...,
551551
color:ColorType|Sequence[ColorType]|None= ...,
552-
label:str|Sequence[str]|None= ...,
552+
label:StrLike|Sequence[StrLike]|None= ...,
553553
stacked:bool= ...,
554554
*,
555555
data=...,

‎lib/matplotlib/axes/_base.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ from cycler import Cycler
2727
importnumpyasnp
2828
fromnumpy.typingimportArrayLike
2929
fromtypingimportAny,Literal,TypeVar,overload
30-
frommatplotlib.typingimportColorType
30+
frommatplotlib.typingimportColorType,StrLike
3131

3232
_T=TypeVar("_T",bound=Artist)
3333

@@ -305,7 +305,7 @@ class _AxesBase(martist.Artist):
305305
defget_xlabel(self)->str: ...
306306
defset_xlabel(
307307
self,
308-
xlabel:str,
308+
xlabel:StrLike,
309309
fontdict:dict[str,Any]|None= ...,
310310
labelpad:float|None= ...,
311311
*,
@@ -331,7 +331,7 @@ class _AxesBase(martist.Artist):
331331
defget_ylabel(self)->str: ...
332332
defset_ylabel(
333333
self,
334-
ylabel:str,
334+
ylabel:StrLike,
335335
fontdict:dict[str,Any]|None= ...,
336336
labelpad:float|None= ...,
337337
*,

‎lib/matplotlib/axis.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ from matplotlib.lines import Line2D
1313
frommatplotlib.textimportText
1414
frommatplotlib.tickerimportLocator,Formatter
1515
frommatplotlib.transformsimportTransform,Bbox
16-
frommatplotlib.typingimportColorType
16+
frommatplotlib.typingimportColorType,StrLike
1717

1818

1919
GRIDLINE_INTERPOLATION_STEPS:int
@@ -211,7 +211,7 @@ class Axis(martist.Artist):
211211
defset_units(self,u)->None: ...
212212
defget_units(self): ...
213213
defset_label_text(
214-
self,label:str,fontdict:dict[str,Any]|None= ...,**kwargs
214+
self,label:StrLike,fontdict:dict[str,Any]|None= ...,**kwargs
215215
)->Text: ...
216216
defset_major_formatter(
217217
self,formatter:Formatter|str|Callable[[float,float],str]

‎lib/matplotlib/colorbar.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import numpy as np
1010
fromnumpy.typingimportArrayLike
1111
fromcollections.abcimportSequence
1212
fromtypingimportAny,Literal,overload
13-
from .typingimportColorType
13+
from .typingimportColorType,StrLike
1414

1515
class_ColorbarSpine(mspines.Spines):
1616
def__init__(self,axes:Axes): ...
@@ -59,7 +59,7 @@ class Colorbar:
5959
drawedges:bool= ...,
6060
extendfrac:Literal["auto"]|float|Sequence[float]|None= ...,
6161
extendrect:bool= ...,
62-
label:str= ...,
62+
label:StrLike= ...,
6363
location:Literal["left","right","top","bottom"]|None= ...
6464
)->None: ...
6565
@property
@@ -108,7 +108,7 @@ class Colorbar:
108108
)->None: ...
109109
defminorticks_on(self)->None: ...
110110
defminorticks_off(self)->None: ...
111-
defset_label(self,label:str,*,loc:str|None= ...,**kwargs)->None: ...
111+
defset_label(self,label:StrLike,*,loc:str|None= ...,**kwargs)->None: ...
112112
defset_alpha(self,alpha:float|np.ndarray)->None: ...
113113
defremove(self)->None: ...
114114
defdrag_pan(self,button:Any,key:Any,x:float,y:float)->None: ...

‎lib/matplotlib/offsetbox.pyi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ from matplotlib.font_manager import FontProperties
77
frommatplotlib.imageimportBboxImage
88
frommatplotlib.patchesimportFancyArrowPatch,FancyBboxPatch
99
frommatplotlib.transformsimportBbox,BboxBase,Transform
10+
frommatplotlib.typingimportStrLike
1011

1112
importnumpyasnp
1213
fromnumpy.typingimportArrayLike
@@ -117,12 +118,12 @@ class TextArea(OffsetBox):
117118
offset_transform:Transform
118119
def__init__(
119120
self,
120-
s:str,
121+
s:StrLike,
121122
*,
122123
textprops:dict[str,Any]|None= ...,
123124
multilinebaseline:bool= ...,
124125
)->None: ...
125-
defset_text(self,s:str)->None: ...
126+
defset_text(self,s:StrLike)->None: ...
126127
defget_text(self)->str: ...
127128
defset_multilinebaseline(self,t:bool)->None: ...
128129
defget_multilinebaseline(self)->bool: ...
@@ -180,7 +181,7 @@ class AnchoredText(AnchoredOffsetbox):
180181
txt:TextArea
181182
def__init__(
182183
self,
183-
s:str,
184+
s:StrLike,
184185
loc:str,
185186
*,
186187
pad:float= ...,

‎lib/matplotlib/pyplot.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@
119119
frommatplotlib.quiverimportBarbs,Quiver,QuiverKey
120120
frommatplotlib.scaleimportScaleBase
121121
frommatplotlib.transformsimportTransform,Bbox
122-
frommatplotlib.typingimportColorType,LineStyleType,MarkerType,HashableList
122+
frommatplotlib.typingimport (ColorType,HashableList,LineStyleType,MarkerType,
123+
StrLike)
123124
frommatplotlib.widgetsimportSubplotTool
124125

125126
_P=ParamSpec('_P')
@@ -2640,7 +2641,7 @@ def angle_spectrum(
26402641
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26412642
@_copy_docstring_and_deprecators(Axes.annotate)
26422643
defannotate(
2643-
text:str,
2644+
text:StrLike,
26442645
xy:tuple[float,float],
26452646
xytext:tuple[float,float]|None=None,
26462647
xycoords:str
@@ -3222,7 +3223,7 @@ def hist(
32223223
rwidth:float|None=None,
32233224
log:bool=False,
32243225
color:ColorType|Sequence[ColorType]|None=None,
3225-
label:str|Sequence[str]|None=None,
3226+
label:StrLike|Sequence[StrLike]|None=None,
32263227
stacked:bool=False,
32273228
*,
32283229
data=None,
@@ -3315,7 +3316,7 @@ def hlines(
33153316
xmax:float|ArrayLike,
33163317
colors:ColorType|Sequence[ColorType]|None=None,
33173318
linestyles:LineStyleType="solid",
3318-
label:str="",
3319+
label:StrLike="",
33193320
*,
33203321
data=None,
33213322
**kwargs,
@@ -3670,7 +3671,7 @@ def quiver(*args, data=None, **kwargs) -> Quiver:
36703671
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
36713672
@_copy_docstring_and_deprecators(Axes.quiverkey)
36723673
defquiverkey(
3673-
Q:Quiver,X:float,Y:float,U:float,label:str,**kwargs
3674+
Q:Quiver,X:float,Y:float,U:float,label:StrLike,**kwargs
36743675
)->QuiverKey:
36753676
returngca().quiverkey(Q,X,Y,U,label,**kwargs)
36763677

@@ -3827,7 +3828,7 @@ def stem(
38273828
markerfmt:str|None=None,
38283829
basefmt:str|None=None,
38293830
bottom:float=0,
3830-
label:str|None=None,
3831+
label:StrLike|None=None,
38313832
orientation:Literal["vertical","horizontal"]="vertical",
38323833
data=None,
38333834
)->StemContainer:
@@ -3951,7 +3952,7 @@ def table(
39513952
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
39523953
@_copy_docstring_and_deprecators(Axes.text)
39533954
deftext(
3954-
x:float,y:float,s:str,fontdict:dict[str,Any]|None=None,**kwargs
3955+
x:float,y:float,s:StrLike,fontdict:dict[str,Any]|None=None,**kwargs
39553956
)->Text:
39563957
returngca().text(x,y,s,fontdict=fontdict,**kwargs)
39573958

@@ -4077,7 +4078,7 @@ def vlines(
40774078
ymax:float|ArrayLike,
40784079
colors:ColorType|Sequence[ColorType]|None=None,
40794080
linestyles:LineStyleType="solid",
4080-
label:str="",
4081+
label:StrLike="",
40814082
*,
40824083
data=None,
40834084
**kwargs,
@@ -4128,7 +4129,7 @@ def sci(im: ScalarMappable) -> None:
41284129
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
41294130
@_copy_docstring_and_deprecators(Axes.set_title)
41304131
deftitle(
4131-
label:str,
4132+
label:StrLike,
41324133
fontdict:dict[str,Any]|None=None,
41334134
loc:Literal["left","center","right"]|None=None,
41344135
pad:float|None=None,
@@ -4142,7 +4143,7 @@ def title(
41424143
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
41434144
@_copy_docstring_and_deprecators(Axes.set_xlabel)
41444145
defxlabel(
4145-
xlabel:str,
4146+
xlabel:StrLike,
41464147
fontdict:dict[str,Any]|None=None,
41474148
labelpad:float|None=None,
41484149
*,
@@ -4157,7 +4158,7 @@ def xlabel(
41574158
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
41584159
@_copy_docstring_and_deprecators(Axes.set_ylabel)
41594160
defylabel(
4160-
ylabel:str,
4161+
ylabel:StrLike,
41614162
fontdict:dict[str,Any]|None=None,
41624163
labelpad:float|None=None,
41634164
*,

‎lib/matplotlib/quiver.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import numpy as np
1010
fromnumpy.typingimportArrayLike
1111
fromcollections.abcimportSequence
1212
fromtypingimportAny,Literal,overload
13-
frommatplotlib.typingimportColorType
13+
frommatplotlib.typingimportColorType,StrLike
1414

1515
classQuiverKey(martist.Artist):
1616
halign:dict[Literal["N","S","E","W"],Literal["left","center","right"]]
@@ -23,7 +23,7 @@ class QuiverKey(martist.Artist):
2323
angle:float
2424
coord:Literal["axes","figure","data","inches"]
2525
color:ColorType|None
26-
label:str
26+
label:StrLike
2727
labelpos:Literal["N","S","E","W"]
2828
labelcolor:ColorType|None
2929
fontproperties:dict[str,Any]
@@ -36,7 +36,7 @@ class QuiverKey(martist.Artist):
3636
X:float,
3737
Y:float,
3838
U:float,
39-
label:str,
39+
label:StrLike,
4040
*,
4141
angle:float= ...,
4242
coordinates:Literal["axes","figure","data","inches"]= ...,

‎lib/matplotlib/sankey.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
frommatplotlib.axesimportAxes
2+
frommatplotlib.typingimportStrLike
23

34
fromcollections.abcimportCallable,Iterable
45
fromtypingimportAny
@@ -46,7 +47,7 @@ class Sankey:
4647
)->None: ...
4748
defadd(
4849
self,
49-
patchlabel:str= ...,
50+
patchlabel:StrLike= ...,
5051
flows:Iterable[float]|None= ...,
5152
orientations:Iterable[int]|None= ...,
5253
labels:str|Iterable[str|None]= ...,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp