Python pygments.util.shebang_matches() Examples

The following are 30 code examples of pygments.util.shebang_matches(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pygments.util , or try the search function .
Example #1
Source File: ruby.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'ruby(1\.\d)?') 
Example #2
Source File: python.py    From diaphora with GNU Affero General Public License v3.0 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'pythonw?(2(\.\d)?)?') or \
            'import ' in text[:1000] 
Example #3
Source File: perl.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        if shebang_matches(text, r'perl'):
            return True
        if re.search('(?:my|our)\s+[$@%(]', text):
            return 0.9 
Example #4
Source File: python.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'pythonw?(2(\.\d)?)?') or \
            'import ' in text[:1000] 
Example #5
Source File: python.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'pythonw?3(\.\d)?') 
Example #6
Source File: jvm.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'groovy') 
Example #7
Source File: ruby.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'ruby(1\.\d)?') 
Example #8
Source File: shell.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        if shebang_matches(text, r'(ba|z|)sh'):
            return 1
        if text.startswith('$ '):
            return 0.2 
Example #9
Source File: julia.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'julia') 
Example #10
Source File: tcl.py    From syntax-highlighting with GNU Affero General Public License v3.0 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'(tcl)') 
Example #11
Source File: perl.py    From syntax-highlighting with GNU Affero General Public License v3.0 5 votes vote down vote up
def analyse_text(text):
        if shebang_matches(text, r'perl'):
            return True
        if re.search('(?:my|our)\s+[$@%(]', text):
            return 0.9 
Example #12
Source File: tcl.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'(tcl)') 
Example #13
Source File: julia.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'julia') 
Example #14
Source File: shell.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        if shebang_matches(text, r'(ba|z|)sh'):
            return 1
        if text.startswith('$ '):
            return 0.2 
Example #15
Source File: php.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
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 
Example #16
Source File: tcl.py    From diaphora with GNU Affero General Public License v3.0 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'(tcl)') 
Example #17
Source File: jvm.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'groovy') 
Example #18
Source File: python.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'pythonw?2(\.\d)?') or \
            'import ' in text[:1000] 
Example #19
Source File: python.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'pythonw?(3(\.\d)?)?') 
Example #20
Source File: perl.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        if shebang_matches(text, r'perl'):
            return True
        if re.search(r'(?:my|our)\s+[$@%(]', text):
            return 0.9 
Example #21
Source File: tcl.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'(tcl)') 
Example #22
Source File: julia.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'julia') 
Example #23
Source File: shell.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        if shebang_matches(text, r'(ba|z|)sh'):
            return 1
        if text.startswith('$ '):
            return 0.2 
Example #24
Source File: ruby.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'ruby(1\.\d)?') 
Example #25
Source File: jvm.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'groovy') 
Example #26
Source File: python.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'pythonw?3(\.\d)?') 
Example #27
Source File: python.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'pythonw?(2(\.\d)?)?') or \
            'import ' in text[:1000] 
Example #28
Source File: perl.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        if shebang_matches(text, r'perl'):
            return True
        if re.search(r'(?:my|our)\s+[$@%(]', text):
            return 0.9 
Example #29
Source File: highlighter.py    From coconut with Apache License 2.0 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, shebang_regex) 
Example #30
Source File: cython_highlighting.py    From Pyfhel with GNU General Public License v3.0 5 votes vote down vote up
def analyse_text(text):
        return shebang_matches(text, r'pythonw?(2\.\d)?')