Bug summary
Implementation:
|
def get_legend(self): |
|
"""Return the `.Legend` instance, or None if no legend is defined.""" |
|
return self.legend_ |
Type hints:
|
def get_legend(self) -> Legend: ... |
Proposed change:
- def get_legend(self) -> Legend: ...
+ def get_legend(self) -> Legend | None: ...
Code for reproduction
Actual outcome
type checkers warn of unnecessary is None checks.
Expected outcome
type checkers should not warn of unnecessary is None checks.
Additional information
No response
Operating system
No response
Matplotlib Version
3.10.3
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
None
Bug summary
Implementation:
matplotlib/lib/matplotlib/axes/_base.py
Lines 2226 to 2228 in b766c96
Type hints:
matplotlib/lib/matplotlib/axes/_base.pyi
Line 228 in b766c96
Proposed change:
Code for reproduction
Actual outcome
type checkers warn of unnecessary
is Nonechecks.Expected outcome
type checkers should not warn of unnecessary
is Nonechecks.Additional information
No response
Operating system
No response
Matplotlib Version
3.10.3
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
None