def transform(self, node, results):
# TODO: add a blank line between any __future__ imports and this?
touch_import_top(u'future', u'standard_library', node)
# TODO: also add standard_library.install_hooks()
python类install_hooks()的实例源码
fix_add_future_standard_library_import.py 文件源码
项目:FightstickDisplay
作者: calexil
项目源码
文件源码
阅读 22
收藏 0
点赞 0
评论 0
def __enter__(self):
# flog.debug('Entering hooks context manager')
self.old_sys_modules = copy.copy(sys.modules)
self.hooks_were_installed = detect_hooks()
# self.scrubbed = scrub_py2_sys_modules()
install_hooks()
return self
def __exit__(self, *args):
if self.hooks_were_installed:
install_hooks()
# restore_sys_modules(self.scrubbed)
def enable_hooks():
"""
Deprecated. Use install_hooks() instead. This will be removed by
``future`` v1.0.
"""
install_hooks()
fix_add_future_standard_library_import.py 文件源码
项目:cryptogram
作者: xinmingzhang
项目源码
文件源码
阅读 19
收藏 0
点赞 0
评论 0
def transform(self, node, results):
# TODO: add a blank line between any __future__ imports and this?
touch_import_top(u'future', u'standard_library', node)
# TODO: also add standard_library.install_hooks()
def __enter__(self):
# flog.debug('Entering hooks context manager')
self.old_sys_modules = copy.copy(sys.modules)
self.hooks_were_installed = detect_hooks()
# self.scrubbed = scrub_py2_sys_modules()
install_hooks()
return self
def __exit__(self, *args):
if self.hooks_were_installed:
install_hooks()
# restore_sys_modules(self.scrubbed)
def enable_hooks():
"""
Deprecated. Use install_hooks() instead. This will be removed by
``future`` v1.0.
"""
install_hooks()
fix_add_future_standard_library_import.py 文件源码
项目:Repobot
作者: Desgard
项目源码
文件源码
阅读 19
收藏 0
点赞 0
评论 0
def transform(self, node, results):
# TODO: add a blank line between any __future__ imports and this?
touch_import_top(u'future', u'standard_library', node)
# TODO: also add standard_library.install_hooks()
def __enter__(self):
# flog.debug('Entering hooks context manager')
self.old_sys_modules = copy.copy(sys.modules)
self.hooks_were_installed = detect_hooks()
# self.scrubbed = scrub_py2_sys_modules()
install_hooks()
return self
def __exit__(self, *args):
if self.hooks_were_installed:
install_hooks()
# restore_sys_modules(self.scrubbed)
def enable_hooks():
"""
Deprecated. Use install_hooks() instead. This will be removed by
``future`` v1.0.
"""
install_hooks()
def transform(self, node, results):
# TODO: add a blank line between any __future__ imports and this?
touch_import_top(u'future', u'standard_library', node)
# TODO: also add standard_library.install_hooks()
def __enter__(self):
# flog.debug('Entering hooks context manager')
self.old_sys_modules = copy.copy(sys.modules)
self.hooks_were_installed = detect_hooks()
# self.scrubbed = scrub_py2_sys_modules()
install_hooks()
return self
def __exit__(self, *args):
if self.hooks_were_installed:
install_hooks()
# restore_sys_modules(self.scrubbed)
def enable_hooks():
"""
Deprecated. Use install_hooks() instead. This will be removed by
``future`` v1.0.
"""
install_hooks()
fix_add_future_standard_library_import.py 文件源码
项目:blackmamba
作者: zrzka
项目源码
文件源码
阅读 20
收藏 0
点赞 0
评论 0
def transform(self, node, results):
# TODO: add a blank line between any __future__ imports and this?
touch_import_top(u'future', u'standard_library', node)
# TODO: also add standard_library.install_hooks()
def __enter__(self):
# flog.debug('Entering hooks context manager')
self.old_sys_modules = copy.copy(sys.modules)
self.hooks_were_installed = detect_hooks()
# self.scrubbed = scrub_py2_sys_modules()
install_hooks()
return self
def __exit__(self, *args):
if self.hooks_were_installed:
install_hooks()
# restore_sys_modules(self.scrubbed)
def enable_hooks():
"""
Deprecated. Use install_hooks() instead. This will be removed by
``future`` v1.0.
"""
install_hooks()