defnumeric_scaling(digits: 'int > 0' = 7, *, pos: list): defdecorate(func): defscaled(*_args): __args = list(_args) f = math.pow(10, digits) # 数值精度,默认为7位小数 for p in pos: ifisinstance(_args[p], int) orisinstance(_args[p], float): __args[p] *= f elifisinstance(_args[p], list): __args[p] = [[tuple(map(lambda x: x * f, pt)) for pt in path] for path in _args[p]] else: pass _result = func(*tuple(__args)) # _result is list of paths _result = [[tuple(map(lambda x: x / f, pt)) for pt in path] for path in _result] return _result