def fix_future(self, token):
""" Fix print_function, absolute_import, with_statement.
"""
status = getattr(self, '_future_status', 0)
if status == 2:
return # Done
if status == 0 and token.type == 'string':
self._future_status = 1 # docstring
elif token.type != 'comment':
self._future_status = 2 # done
i = max(0, token.find_backward('\n'))
t = Token(token.total_text, '', i, i)
t.fix = '\nfrom __future__ import %s\n' % (', '.join(self.FUTURES))
return t
translate_to_legacy.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录