TYP: Fix mypy error in core.py
xref #37715

Assign the  values to ````handles```` and ````labels```` itself versus changing the types of the ````self.legend_handles```` and ````self.legend_labels````
thanks @kashifkhan 