Skip to content

Commit 7aefeba

Browse files
added typing_extensions.Self to _AxesBase.twinx
1 parent 6e69939 commit 7aefeba

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

environment.yml

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ dependencies:
2828
- python-dateutil>=2.1
2929
- setuptools_scm
3030
- wxpython
31+
- typing-extensions>=4.0.0
3132
# building documentation
3233
- colorspacious
3334
- graphviz

lib/matplotlib/axes/_base.pyi

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ from cycler import Cycler
2727
import numpy as np
2828
from numpy.typing import ArrayLike
2929
from typing import Any, Literal, TypeVar, overload
30+
from typing_extensions import Self
3031
from matplotlib.typing import ColorType
3132

3233
_T = TypeVar("_T", bound=Artist)
@@ -384,8 +385,8 @@ class _AxesBase(martist.Artist):
384385
bbox_extra_artists: Sequence[Artist] | None = ...,
385386
for_layout_only: bool = ...
386387
) -> Bbox | None: ...
387-
def twinx(self) -> _AxesBase: ...
388-
def twiny(self) -> _AxesBase: ...
388+
def twinx(self) -> Self: ...
389+
def twiny(self) -> Self: ...
389390
def get_shared_x_axes(self) -> cbook.GrouperView: ...
390391
def get_shared_y_axes(self) -> cbook.GrouperView: ...
391392
def label_outer(self, remove_inner_ticks: bool = ...) -> None: ...

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ dependencies = [
3939
"pillow >= 8",
4040
"pyparsing >= 2.3.1",
4141
"python-dateutil >= 2.7",
42+
"typing-extensions >= 4.0.0",
4243
]
4344
requires-python = ">=3.10"
4445

0 commit comments

Comments
 (0)