_string.py 文件源码

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

项目:tidy 作者: cyrus- 项目源码 文件源码
def translate_Subscript(self, ctx, e):
        translation = astx.copy_node(e)
        translation.value = ctx.translate(e.value)
        slice_ = e.slice
        slice_translation = astx.copy_node(slice_)
        if isinstance(slice_, ast.Index):
            slice_translation.value = ctx.translate(slice_.value)
        else:
            lower, upper, step = slice_.lower, slice_.upper, slice_.step
            slice_translation.lower = ctx.translate(lower) if lower is not None else None
            slice_translation.upper = ctx.translate(upper) if upper is not None else None
            if not _is_None(step):
                slice_translation.step = ctx.translate(step)
            else:
                slice_translation.step = None
        translation.slice = slice_translation
        return translation
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号