beforeRunningCommand nop command #!/usr/bin/python """Generate code to warn about a module's removal in Python 3.0. XXX Not supported: - Module's in a package do not have their full name generated. - Package's __init__ module; should detect and use the package's name instead. - Extension modules; need to create template. """ template = """from warnings import warnpy3k warnpy3k("the ${1:%s} module has been removed in Python 3.0", stacklevel=2) del warnpy3k $0""" import imp import os file_name = os.path.split(os.environ['TM_FILEPATH'])[1] for suffix in (tuple_[0] for tuple_ in imp.get_suffixes()): if not file_name.endswith(suffix): continue module_name = file_name[:-len(suffix)] print (template % module_name), break else: print (template % "XXX"), input none name 2 to 3 - Module Deletion output insertAsSnippet tabTrigger 2to3moddel uuid 9519C22B-6AB8-41A1-94F6-079E0B45C147