Fix generate_pyi compatibility with Python 3.7 and lower
The docstring annotation filtering requires features of Python's ast parser module that weren't available until Python 3.8
The docstring annotation filtering requires features of Python's ast parser module that weren't available until Python 3.8