Python源码示例:pygments.util.shebang_matches()

示例1
def analyse_text(text):
        return shebang_matches(text, shebang_regex) 
示例2
def analyse_text(text):
        return shebang_matches(text, r'(tcl)') 
示例3
def analyse_text(text):
        if shebang_matches(text, r'perl'):
            return True
        if re.search('(?:my|our)\s+[$@%(]', text):
            return 0.9 
示例4
def analyse_text(text):
        return shebang_matches(text, r'pythonw?(2(\.\d)?)?') or \
            'import ' in text[:1000] 
示例5
def analyse_text(text):
        return shebang_matches(text, r'pythonw?3(\.\d)?') 
示例6
def analyse_text(text):
        return shebang_matches(text, r'groovy') 
示例7
def analyse_text(text):
        return shebang_matches(text, r'ruby(1\.\d)?') 
示例8
def analyse_text(text):
        if shebang_matches(text, r'(ba|z|)sh'):
            return 1
        if text.startswith('$ '):
            return 0.2 
示例9
def analyse_text(text):
        return shebang_matches(text, r'julia') 
示例10
def analyse_text(text):
        return shebang_matches(text, r'(tcl)') 
示例11
def analyse_text(text):
        if shebang_matches(text, r'perl'):
            return True
        if re.search('(?:my|our)\s+[$@%(]', text):
            return 0.9 
示例12
def analyse_text(text):
        return shebang_matches(text, r'pythonw?(2(\.\d)?)?') or \
            'import ' in text[:1000] 
示例13
def analyse_text(text):
        return shebang_matches(text, r'pythonw?3(\.\d)?') 
示例14
def analyse_text(text):
        return shebang_matches(text, r'groovy') 
示例15
def analyse_text(text):
        return shebang_matches(text, r'ruby(1\.\d)?') 
示例16
def analyse_text(text):
        if shebang_matches(text, r'(ba|z|)sh'):
            return 1
        if text.startswith('$ '):
            return 0.2 
示例17
def analyse_text(text):
        return shebang_matches(text, r'julia') 
示例18
def analyse_text(text):
        return shebang_matches(text, r'(tcl)') 
示例19
def analyse_text(text):
        if shebang_matches(text, r'perl'):
            return True
        if re.search(r'(?:my|our)\s+[$@%(]', text):
            return 0.9 
示例20
def analyse_text(text):
        return shebang_matches(text, r'pythonw?(3(\.\d)?)?') 
示例21
def analyse_text(text):
        return shebang_matches(text, r'pythonw?2(\.\d)?') or \
            'import ' in text[:1000] 
示例22
def analyse_text(text):
        return shebang_matches(text, r'groovy') 
示例23
def analyse_text(text):
        return shebang_matches(text, r'ruby(1\.\d)?') 
示例24
def analyse_text(text):
        if shebang_matches(text, r'php'):
            return True
        rv = 0.0
        if re.search(r'<\?(?!xml)', text):
            rv += 0.3
        return rv 
示例25
def analyse_text(text):
        if shebang_matches(text, r'(ba|z|)sh'):
            return 1
        if text.startswith('$ '):
            return 0.2 
示例26
def analyse_text(text):
        if shebang_matches(text, r'execlineb'):
            return 1 
示例27
def test_shebang_matches():
    assert util.shebang_matches('#!/usr/bin/env python\n', r'python(2\.\d)?')
    assert util.shebang_matches('#!/usr/bin/python2.4', r'python(2\.\d)?')
    assert util.shebang_matches('#!/usr/bin/startsomethingwith python',
                                r'python(2\.\d)?')
    assert util.shebang_matches('#!C:\\Python2.4\\Python.exe', r'python(2\.\d)?')

    assert not util.shebang_matches('#!/usr/bin/python-ruby', r'python(2\.\d)?')
    assert not util.shebang_matches('#!/usr/bin/python/ruby', r'python(2\.\d)?')
    assert not util.shebang_matches('#!', r'python') 
示例28
def analyse_text(text):
        return shebang_matches(text, r'(tcl)') 
示例29
def analyse_text(text):
        if shebang_matches(text, r'perl'):
            return True
        if re.search('(?:my|our)\s+[$@%(]', text):
            return 0.9 
示例30
def analyse_text(text):
        return shebang_matches(text, r'pythonw?(2(\.\d)?)?') or \
            'import ' in text[:1000]