我们从Python开源项目中,提取了以下45个代码示例,用于说明如何使用pygments.util.shebang_matches()。
def transpyler_lexer_factory(transpyler): """ Return a Pygments lexer class for the given transpyler. """ def analyse_text(text): return shebang_matches(text, r'pythonw?3(\.\d)?') return type( transpyler.pygments_class_name, (Python3Lexer,), dict( analyse_text=analyse_text, name=transpyler.name, aliases=[transpyler.display_name], filenames=transpyler.file_extensions, mimetypes=transpyler.mimetypes, flags=re.MULTILINE | re.UNICODE, uni_name="[%s][%s]*" % (uni.xid_start, uni.xid_continue), tokens=make_transpyled_tokens(transpyler), ) )
def analyse_text(text): return shebang_matches(text, r'pythonw?(2(\.\d)?)?') or \ 'import ' in text[:1000]
def analyse_text(text): return shebang_matches(text, r'pythonw?3(\.\d)?')
def analyse_text(text): return (shebang_matches(text, r'pythonw?(2(\.\d)?)?') or 'import ' in text[:1000]) \ and ('import numpy' in text or 'from numpy import' in text)
def analyse_text(text): return shebang_matches(text, r'julia')
def analyse_text(text): return shebang_matches(text, r'ruby(1\.\d)?')
def analyse_text(text): return shebang_matches(text, r'(tcl)')
def analyse_text(text): if shebang_matches(text, r'(ba|z|)sh'): return 1 if text.startswith('$ '): return 0.2
def analyse_text(text): return shebang_matches(text, r'(ba|z|)sh')
def analyse_text(text): return shebang_matches(text, r'pythonw?(2(\.\d)?)?')