Type Hinting in Python

fig: matplotlib.figure.Figure=plt.figure()
ax: matplotlib.axes.Axes=fig.add_subplot(111)

or

fig, ax=plt.subplots()

assert isinstance(fig,matplotlib.figure.Figure)
assert isinstance(ax,matplotlib.axes.Axes)

Dictionary

from typing import Dict
cache: Dict[str, TemplateProperties] = {}

References
https://www.jetbrains.com/help/pycharm/type-hinting-in-product.html
https://docs.python.org/3/library/typing.html