def get_arity(origin, args=[]): '''Gets the arity of some typing type ''' if isinstance(origin, typing.Generic): return 1 - (1 if args else 0) return 0