def get_type_hints(func):
"""Resembles typing.get_type_hints, but is also workable on Python 2.7 and
searches stubfiles for type information.
Also on Python 3, this takes type comments
(python.org/dev/peps/pep-0484/#suggested-syntax-for-python-2-7-and-straddling-code)
into account if present.
"""
if not has_type_hints(func):
# What about defaults?
return {}
return _get_type_hints(func)
评论列表
文章目录