_fn.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:tidy 作者: cyrus- 项目源码 文件源码
def _get_pat_and_asc(ctx, binding):
        if isinstance(binding, ast.Subscript):
            value = binding.value
            if isinstance(value, ast.Name) and value.id == 'let':
                slice = binding.slice
                if isinstance(slice, ast.Index):
                    return (slice.value, None)
                elif isinstance(slice, ast.Slice):
                    lower, upper, step = slice.lower, slice.upper, slice.step
                    if lower is not None and upper is not None and step is None:
                        asc = typy._process_asc_ast(ctx, upper)
                        return lower, asc
                    else:
                        raise _errors.TyError("Invalid ascription format.", slice)
                else:
                    raise _errors.TyError("Invalid ascription format.", slice)
            else:
                raise _errors.TyError("Invalid with format.", value)
        else:
            raise _errors.TyError("Invalid with format.", binding)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号