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

[TYP] Change typing for texts to StrLike#26867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
oscargus wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromoscargus:texttyping
Draft
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletionslib/matplotlib/artist.pyi
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,13 +4,15 @@ from .figure import Figure, SubFigure
from .path import Path
from .patches import Patch
from .patheffects import AbstractPathEffect
from .text import Text
from .transforms import (
BboxBase,
Bbox,
Transform,
TransformedPatchPath,
TransformedPath,
)
from .typing import StrLike

import numpy as np

Expand DownExpand Up@@ -117,8 +119,8 @@ class Artist:
def set_visible(self, b: bool) -> None: ...
def set_animated(self, b: bool) -> None: ...
def set_in_layout(self, in_layout: bool) -> None: ...
def get_label(self) ->object: ...
def set_label(self, s:object) -> None: ...
def get_label(self) ->str | Text | None: ...
def set_label(self, s:StrLike | None) -> None: ...
def get_zorder(self) -> float: ...
def set_zorder(self, level: float) -> None: ...
@property
Expand Down
18 changes: 9 additions & 9 deletionslib/matplotlib/axes/_axes.pyi
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,13 +34,13 @@ from collections.abc import Callable, Sequence
from typing import Any, Literal, overload
import numpy as np
from numpy.typing import ArrayLike
from matplotlib.typing import ColorType, MarkerType, LineStyleType
from matplotlib.typing import ColorType, MarkerType, LineStyleType, StrLike

class Axes(_AxesBase):
def get_title(self, loc: Literal["left", "center", "right"] = ...) -> str: ...
def set_title(
self,
label:str,
label:StrLike,
fontdict: dict[str, Any] | None = ...,
loc: Literal["left", "center", "right"] | None = ...,
pad: float | None = ...,
Expand DownExpand Up@@ -111,13 +111,13 @@ class Axes(_AxesBase):
self,
x: float,
y: float,
s:str,
s:StrLike,
fontdict: dict[str, Any] | None = ...,
**kwargs
) -> Text: ...
def annotate(
self,
text:str,
text:StrLike,
xy: tuple[float, float],
xytext: tuple[float, float] | None = ...,
xycoords: str
Expand DownExpand Up@@ -164,7 +164,7 @@ class Axes(_AxesBase):
xmax: float | ArrayLike,
colors: ColorType | Sequence[ColorType] | None = ...,
linestyles: LineStyleType = ...,
label:str = ...,
label:StrLike = ...,
*,
data=...,
**kwargs
Expand All@@ -176,7 +176,7 @@ class Axes(_AxesBase):
ymax: float | ArrayLike,
colors: ColorType | Sequence[ColorType] | None = ...,
linestyles: LineStyleType = ...,
label:str = ...,
label:StrLike = ...,
*,
data=...,
**kwargs
Expand DownExpand Up@@ -289,7 +289,7 @@ class Axes(_AxesBase):
markerfmt: str | None = ...,
basefmt: str | None = ...,
bottom: float = ...,
label:str | None = ...,
label:StrLike | None = ...,
orientation: Literal["vertical", "horizontal"] = ...,
data=...,
) -> StemContainer: ...
Expand DownExpand Up@@ -443,7 +443,7 @@ class Axes(_AxesBase):
self, x: float, y: float, dx: float, dy: float, **kwargs
) -> FancyArrow: ...
def quiverkey(
self, Q: Quiver, X: float, Y: float, U: float, label:str, **kwargs
self, Q: Quiver, X: float, Y: float, U: float, label:StrLike, **kwargs
) -> QuiverKey: ...
def quiver(self, *args, data=..., **kwargs) -> Quiver: ...
def barbs(self, *args, data=..., **kwargs) -> Barbs: ...
Expand DownExpand Up@@ -549,7 +549,7 @@ class Axes(_AxesBase):
rwidth: float | None = ...,
log: bool = ...,
color: ColorType | Sequence[ColorType] | None = ...,
label:str | Sequence[str] | None = ...,
label:StrLike | Sequence[StrLike] | None = ...,
stacked: bool = ...,
*,
data=...,
Expand Down
6 changes: 3 additions & 3 deletionslib/matplotlib/axes/_base.pyi
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@ from cycler import Cycler
import numpy as np
from numpy.typing import ArrayLike
from typing import Any, Literal, TypeVar, overload
from matplotlib.typing import ColorType
from matplotlib.typing import ColorType, StrLike

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

Expand DownExpand Up@@ -305,7 +305,7 @@ class _AxesBase(martist.Artist):
def get_xlabel(self) -> str: ...
def set_xlabel(
self,
xlabel:str,
xlabel:StrLike,
fontdict: dict[str, Any] | None = ...,
labelpad: float | None = ...,
*,
Expand All@@ -331,7 +331,7 @@ class _AxesBase(martist.Artist):
def get_ylabel(self) -> str: ...
def set_ylabel(
self,
ylabel:str,
ylabel:StrLike,
fontdict: dict[str, Any] | None = ...,
labelpad: float | None = ...,
*,
Expand Down
4 changes: 2 additions & 2 deletionslib/matplotlib/axis.pyi
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,7 @@ from matplotlib.lines import Line2D
from matplotlib.text import Text
from matplotlib.ticker import Locator, Formatter
from matplotlib.transforms import Transform, Bbox
from matplotlib.typing import ColorType
from matplotlib.typing import ColorType, StrLike


GRIDLINE_INTERPOLATION_STEPS: int
Expand DownExpand Up@@ -211,7 +211,7 @@ class Axis(martist.Artist):
def set_units(self, u) -> None: ...
def get_units(self): ...
def set_label_text(
self, label:str, fontdict: dict[str, Any] | None = ..., **kwargs
self, label:StrLike, fontdict: dict[str, Any] | None = ..., **kwargs
) -> Text: ...
def set_major_formatter(
self, formatter: Formatter | str | Callable[[float, float], str]
Expand Down
6 changes: 3 additions & 3 deletionslib/matplotlib/colorbar.pyi
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,7 @@ import numpy as np
from numpy.typing import ArrayLike
from collections.abc import Sequence
from typing import Any, Literal, overload
from .typing import ColorType
from .typing import ColorType, StrLike

class _ColorbarSpine(mspines.Spines):
def __init__(self, axes: Axes): ...
Expand DownExpand Up@@ -59,7 +59,7 @@ class Colorbar:
drawedges: bool = ...,
extendfrac: Literal["auto"] | float | Sequence[float] | None = ...,
extendrect: bool = ...,
label:str = ...,
label:StrLike = ...,
location: Literal["left", "right", "top", "bottom"] | None = ...
) -> None: ...
@property
Expand DownExpand Up@@ -108,7 +108,7 @@ class Colorbar:
) -> None: ...
def minorticks_on(self) -> None: ...
def minorticks_off(self) -> None: ...
def set_label(self, label:str, *, loc: str | None = ..., **kwargs) -> None: ...
def set_label(self, label:StrLike, *, loc: str | None = ..., **kwargs) -> None: ...
def set_alpha(self, alpha: float | np.ndarray) -> None: ...
def remove(self) -> None: ...
def drag_pan(self, button: Any, key: Any, x: float, y: float) -> None: ...
Expand Down
7 changes: 4 additions & 3 deletionslib/matplotlib/offsetbox.pyi
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@ from matplotlib.font_manager import FontProperties
from matplotlib.image import BboxImage
from matplotlib.patches import FancyArrowPatch, FancyBboxPatch
from matplotlib.transforms import Bbox, BboxBase, Transform
from matplotlib.typing import StrLike

import numpy as np
from numpy.typing import ArrayLike
Expand DownExpand Up@@ -117,12 +118,12 @@ class TextArea(OffsetBox):
offset_transform: Transform
def __init__(
self,
s:str,
s:StrLike,
*,
textprops: dict[str, Any] | None = ...,
multilinebaseline: bool = ...,
) -> None: ...
def set_text(self, s:str) -> None: ...
def set_text(self, s:StrLike) -> None: ...
def get_text(self) -> str: ...
def set_multilinebaseline(self, t: bool) -> None: ...
def get_multilinebaseline(self) -> bool: ...
Expand DownExpand Up@@ -180,7 +181,7 @@ class AnchoredText(AnchoredOffsetbox):
txt: TextArea
def __init__(
self,
s:str,
s:StrLike,
loc: str,
*,
pad: float = ...,
Expand Down
23 changes: 12 additions & 11 deletionslib/matplotlib/pyplot.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -119,7 +119,8 @@
from matplotlib.quiver import Barbs, Quiver, QuiverKey
from matplotlib.scale import ScaleBase
from matplotlib.transforms import Transform, Bbox
from matplotlib.typing import ColorType, LineStyleType, MarkerType, HashableList
from matplotlib.typing import (ColorType, HashableList, LineStyleType, MarkerType,
StrLike)
from matplotlib.widgets import SubplotTool

_P = ParamSpec('_P')
Expand DownExpand Up@@ -2640,7 +2641,7 @@ def angle_spectrum(
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
@_copy_docstring_and_deprecators(Axes.annotate)
def annotate(
text:str,
text:StrLike,
xy: tuple[float, float],
xytext: tuple[float, float] | None = None,
xycoords: str
Expand DownExpand Up@@ -3222,7 +3223,7 @@ def hist(
rwidth: float | None = None,
log: bool = False,
color: ColorType | Sequence[ColorType] | None = None,
label:str | Sequence[str] | None = None,
label:StrLike | Sequence[StrLike] | None = None,
stacked: bool = False,
*,
data=None,
Expand DownExpand Up@@ -3315,7 +3316,7 @@ def hlines(
xmax: float | ArrayLike,
colors: ColorType | Sequence[ColorType] | None = None,
linestyles: LineStyleType = "solid",
label:str = "",
label:StrLike = "",
*,
data=None,
**kwargs,
Expand DownExpand Up@@ -3670,7 +3671,7 @@ def quiver(*args, data=None, **kwargs) -> Quiver:
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
@_copy_docstring_and_deprecators(Axes.quiverkey)
def quiverkey(
Q: Quiver, X: float, Y: float, U: float, label:str, **kwargs
Q: Quiver, X: float, Y: float, U: float, label:StrLike, **kwargs
) -> QuiverKey:
return gca().quiverkey(Q, X, Y, U, label, **kwargs)

Expand DownExpand Up@@ -3827,7 +3828,7 @@ def stem(
markerfmt: str | None = None,
basefmt: str | None = None,
bottom: float = 0,
label:str | None = None,
label:StrLike | None = None,
orientation: Literal["vertical", "horizontal"] = "vertical",
data=None,
) -> StemContainer:
Expand DownExpand Up@@ -3951,7 +3952,7 @@ def table(
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
@_copy_docstring_and_deprecators(Axes.text)
def text(
x: float, y: float, s:str, fontdict: dict[str, Any] | None = None, **kwargs
x: float, y: float, s:StrLike, fontdict: dict[str, Any] | None = None, **kwargs
) -> Text:
return gca().text(x, y, s, fontdict=fontdict, **kwargs)

Expand DownExpand Up@@ -4077,7 +4078,7 @@ def vlines(
ymax: float | ArrayLike,
colors: ColorType | Sequence[ColorType] | None = None,
linestyles: LineStyleType = "solid",
label:str = "",
label:StrLike = "",
*,
data=None,
**kwargs,
Expand DownExpand Up@@ -4128,7 +4129,7 @@ def sci(im: ScalarMappable) -> None:
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
@_copy_docstring_and_deprecators(Axes.set_title)
def title(
label:str,
label:StrLike,
fontdict: dict[str, Any] | None = None,
loc: Literal["left", "center", "right"] | None = None,
pad: float | None = None,
Expand All@@ -4142,7 +4143,7 @@ def title(
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
@_copy_docstring_and_deprecators(Axes.set_xlabel)
def xlabel(
xlabel:str,
xlabel:StrLike,
fontdict: dict[str, Any] | None = None,
labelpad: float | None = None,
*,
Expand All@@ -4157,7 +4158,7 @@ def xlabel(
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
@_copy_docstring_and_deprecators(Axes.set_ylabel)
def ylabel(
ylabel:str,
ylabel:StrLike,
fontdict: dict[str, Any] | None = None,
labelpad: float | None = None,
*,
Expand Down
6 changes: 3 additions & 3 deletionslib/matplotlib/quiver.pyi
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,7 @@ import numpy as np
from numpy.typing import ArrayLike
from collections.abc import Sequence
from typing import Any, Literal, overload
from matplotlib.typing import ColorType
from matplotlib.typing import ColorType, StrLike

class QuiverKey(martist.Artist):
halign: dict[Literal["N", "S", "E", "W"], Literal["left", "center", "right"]]
Expand All@@ -23,7 +23,7 @@ class QuiverKey(martist.Artist):
angle: float
coord: Literal["axes", "figure", "data", "inches"]
color: ColorType | None
label:str
label:StrLike
labelpos: Literal["N", "S", "E", "W"]
labelcolor: ColorType | None
fontproperties: dict[str, Any]
Expand All@@ -36,7 +36,7 @@ class QuiverKey(martist.Artist):
X: float,
Y: float,
U: float,
label:str,
label:StrLike,
*,
angle: float = ...,
coordinates: Literal["axes", "figure", "data", "inches"] = ...,
Expand Down
3 changes: 2 additions & 1 deletionlib/matplotlib/sankey.pyi
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
from matplotlib.axes import Axes
from matplotlib.typing import StrLike

from collections.abc import Callable, Iterable
from typing import Any
Expand DownExpand Up@@ -46,7 +47,7 @@ class Sankey:
) -> None: ...
def add(
self,
patchlabel:str = ...,
patchlabel:StrLike = ...,
flows: Iterable[float] | None = ...,
orientations: Iterable[int] | None = ...,
labels: str | Iterable[str | None] = ...,
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp