def _write_TypeVar(tpv, lines, inc=0):
args = [tpv.__name__]
if not tpv.__bound__ is None:
args.append('bound='+type_util.type_str(tpv.__bound__))
if tpv.__covariant__:
args.append('covariant=True')
if tpv.__contravariant__:
args.append('contravariant=True')
lines.append("%s%s = TypeVar('%s')"%(inc*indent, tpv.__name__, ', '.join(args)))
评论列表
文章目录