name: Python fileTypes:

firstLineMatch: ^#!/.*bpythonb scopeName: source.python repository:

keyword_arguments: 
  endCaptures: 
    "1": 
      name: punctuation.separator.parameters.python
  begin: \b([a-zA-Z_][a-zA-Z_0-9]*)\s*(=)(?!=)
  beginCaptures: 
    "1": 
      name: variable.parameter.function.python
    "2": 
      name: keyword.operator.assignment.python
  end: \s*(?:(,)|(?=$\n?|[\)]))
  patterns: 
  - include: $self
generic_names: 
  match: "[A-Za-z_][A-Za-z0-9_]*"
escaped_char: 
  captures: 
    "6": 
      name: constant.character.escape.single-quote.python
    "11": 
      name: constant.character.escape.return.python
    "7": 
      name: constant.character.escape.bell.python
    "12": 
      name: constant.character.escape.tab.python
    "8": 
      name: constant.character.escape.backspace.python
    "13": 
      name: constant.character.escape.vertical-tab.python
    "9": 
      name: constant.character.escape.formfeed.python
    "1": 
      name: constant.character.escape.hex.python
    "2": 
      name: constant.character.escape.octal.python
    "3": 
      name: constant.character.escape.newline.python
    "4": 
      name: constant.character.escape.backlash.python
    "10": 
      name: constant.character.escape.linefeed.python
    "5": 
      name: constant.character.escape.double-quote.python
  match: (\\x[0-9A-F]{2})|(\\[0-7]{3})|(\\\n)|(\\\\)|(\\\")|(\\')|(\\a)|(\\b)|(\\f)|(\\n)|(\\r)|(\\t)|(\\v)
entity_name_class: 
  patterns: 
  - include: "#illegal_names"
  - include: "#generic_names"
dotted_name: 
  begin: (?=[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*)
  end: (?![A-Za-z0-9_\.])
  patterns: 
  - begin: (\.)(?=[A-Za-z_][A-Za-z0-9_]*)
    end: (?![A-Za-z0-9_])
    patterns: 
    - include: "#magic_function_names"
    - include: "#magic_variable_names"
    - include: "#illegal_names"
    - include: "#generic_names"
  - begin: (?<!\.)(?=[A-Za-z_][A-Za-z0-9_]*)
    end: (?![A-Za-z0-9_])
    patterns: 
    - include: "#builtin_functions"
    - include: "#builtin_types"
    - include: "#builtin_exceptions"
    - include: "#illegal_names"
    - include: "#magic_function_names"
    - include: "#magic_variable_names"
    - include: "#language_variables"
    - include: "#generic_names"
builtin_types: 
  name: support.type.python
  match: |-
    (?x)\b(
                              basestring|bool|buffer|classmethod|complex|dict|enumerate|file|
                              float|frozenset|int|list|long|object|open|property|reversed|set|
                              slice|staticmethod|str|super|tuple|type|unicode|xrange
                      )\b
builtin_exceptions: 
  name: support.type.exception.python
  match: (?x)\b((Arithmetic|Assertion|Attribute|EOF|Environment|FloatingPoint|IO|Import|Indentation|Index|Key|Lookup|Memory|Name|OS|Overflow|NotImplemented|Reference|Runtime|Standard|Syntax|System|Tab|Type|UnboundLocal|Unicode(Translate|Encode|Decode)?|Value|ZeroDivision)Error|(Deprecation|Future|Overflow|PendingDeprecation|Runtime|Syntax|User)?Warning|KeyboardInterrupt|NotImplemented|StopIteration|SystemExit|(Base)?Exception)\b
magic_variable_names: 
  name: support.variable.magic.python
  match: \b__(all|bases|class|debug|dict|doc|file|members|metaclass|methods|name|slots|weakref)__\b
  comment: magic variables which a class/module may have.
magic_function_names: 
  name: support.function.magic.python
  match: |-
    (?x)\b(__(?:
                                              abs|add|and|call|cmp|coerce|complex|contains|del|delattr|
                                              delete|delitem|delslice|div|divmod|enter|eq|exit|float|
                                              floordiv|ge|get|getattr|getattribute|getitem|getslice|gt|
                                              hash|hex|iadd|iand|idiv|ifloordiv|ilshift|imod|imul|init|
                                              int|invert|ior|ipow|irshift|isub|iter|itruediv|ixor|le|len|
                                              long|lshift|lt|mod|mul|ne|neg|new|nonzero|oct|or|pos|pow|
                                              radd|rand|rdiv|rdivmod|repr|rfloordiv|rlshift|rmod|rmul|ror|
                                              rpow|rrshift|rshift|rsub|rtruediv|rxor|set|setattr|setitem|
                                              setslice|str|sub|truediv|unicode|xor
                                      )__)\b
  comment: these methods have magic interpretation by python and are generally called indirectly through syntactic constructs
illegal_names: 
  name: invalid.illegal.name.python
  match: \b(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\b
builtin_functions: 
  name: support.function.builtin.python
  match: |-
    (?x)\b(
                    __import__|all|abs|any|apply|callable|chr|cmp|coerce|compile|delattr|dir|
                    divmod|eval|execfile|filter|getattr|globals|hasattr|hash|hex|id|
                    input|intern|isinstance|issubclass|iter|len|locals|map|max|min|oct|
                    ord|pow|range|raw_input|reduce|reload|repr|round|setattr|sorted|
                    sum|unichr|vars|zip
                      )\b
docstrings: 
  patterns: 
  - name: comment.block.python
    begin: ^\s*(?=[uU]?[rR]?""")
    end: (?<=""")
    patterns: 
    - include: "#string_quoted_double"
  - name: comment.block.python
    begin: ^\s*(?=[uU]?[rR]?''')
    end: (?<=''')
    patterns: 
    - include: "#string_quoted_single"
entity_name_function: 
  patterns: 
  - include: "#magic_function_names"
  - include: "#illegal_names"
  - include: "#generic_names"
strings: 
  patterns: 
  - include: "#string_quoted_double"
  - include: "#string_quoted_single"
string_quoted_single: 
  patterns: 
  - name: string.quoted.single.single-line.python
    captures: 
      "1": 
        name: punctuation.definition.string.begin.python
      "2": 
        name: punctuation.definition.string.end.python
      "3": 
        name: meta.empty-string.single.python
    match: (?<!')(')(('))(?!')
  - name: string.quoted.single.block.unicode-raw.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: meta.empty-string.single.python
    begin: ((?i:ur))(''')
    beginCaptures: 
      "1": 
        name: storage.type.string.python
      "2": 
        name: punctuation.definition.string.begin.python
    end: ((?<=''')(')''|''')
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_unicode_char"
    - include: "#escaped_char"
    - include: source.regexp.python
    comment: single quoted unicode-raw string
  - name: string.quoted.single.block.raw.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: meta.empty-string.single.python
    begin: ([rR])(''')
    beginCaptures: 
      "1": 
        name: storage.type.string.python
      "2": 
        name: punctuation.definition.string.begin.python
    end: ((?<=''')(')''|''')
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_char"
    - include: source.regexp.python
    comment: single quoted raw string
  - name: string.quoted.single.block.unicode.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: meta.empty-string.single.python
    begin: ([uU])(''')
    beginCaptures: 
      "1": 
        name: storage.type.string.python
      "2": 
        name: punctuation.definition.string.begin.python
    end: ((?<=''')(')''|''')
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_unicode_char"
    - include: "#escaped_char"
    comment: single quoted unicode string
  - name: string.quoted.single.single-line.unicode-raw.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: invalid.illegal.unclosed-string.python
    begin: ((?i:ur))(')
    beginCaptures: 
      "1": 
        name: storage.type.string.python
      "2": 
        name: punctuation.definition.string.begin.python
    end: (')|(\n)
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_unicode_char"
    - include: "#escaped_char"
    - include: source.regexp.python
    comment: single quoted raw string
  - name: string.quoted.single.single-line.raw.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: invalid.illegal.unclosed-string.python
    begin: ([rR])(')
    beginCaptures: 
      "1": 
        name: storage.type.string.python
      "2": 
        name: punctuation.definition.string.begin.python
    end: (')|(\n)
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_char"
    - include: source.regexp.python
    comment: single quoted raw string
  - name: string.quoted.single.single-line.unicode.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: invalid.illegal.unclosed-string.python
    begin: ([uU])(')
    beginCaptures: 
      "1": 
        name: storage.type.string.python
      "2": 
        name: punctuation.definition.string.begin.python
    end: (')|(\n)
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_unicode_char"
    - include: "#escaped_char"
    comment: single quoted unicode string
  - name: string.quoted.single.block.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: meta.empty-string.single.python
    begin: (''')
    beginCaptures: 
      "1": 
        name: punctuation.definition.string.begin.python
    end: ((?<=''')(')''|''')
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_char"
    comment: single quoted string
  - name: string.quoted.single.single-line.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: invalid.illegal.unclosed-string.python
    begin: (')
    beginCaptures: 
      "1": 
        name: punctuation.definition.string.begin.python
    end: (')|(\n)
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_char"
    comment: single quoted string
line_continuation: 
  captures: 
    "1": 
      name: punctuation.separator.continuation.line.python
    "2": 
      name: invalid.illegal.unexpected-text.python
  match: (\\)(.*)$\n?
constant_placeholder: 
  name: constant.other.placeholder.python
  match: (?i:%(\([a-z_]+\))?#?0?\-?[ ]?\+?([0-9]*|\*)(\.([0-9]*|\*))?[hL]?[a-z%])
function_name: 
  patterns: 
  - include: "#magic_function_names"
  - include: "#magic_variable_names"
  - include: "#builtin_exceptions"
  - include: "#builtin_functions"
  - include: "#builtin_types"
  - include: "#generic_names"
string_quoted_double: 
  patterns: 
  - name: string.quoted.double.block.unicode-raw.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: meta.empty-string.double.python
    begin: ((?i:ur))(""")
    beginCaptures: 
      "1": 
        name: storage.type.string.python
      "2": 
        name: punctuation.definition.string.begin.python
    end: ((?<=""")(")""|""")
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_unicode_char"
    - include: "#escaped_char"
    - include: source.regexp.python
    comment: single quoted unicode-raw string
  - name: string.quoted.double.block.raw.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: meta.empty-string.double.python
    begin: ([rR])(""")
    beginCaptures: 
      "1": 
        name: storage.type.string.python
      "2": 
        name: punctuation.definition.string.begin.python
    end: ((?<=""")(")""|""")
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_char"
    - include: source.regexp.python
    comment: double quoted raw string
  - name: string.quoted.double.block.unicode.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: meta.empty-string.double.python
    begin: ([uU])(""")
    beginCaptures: 
      "1": 
        name: storage.type.string.python
      "2": 
        name: punctuation.definition.string.begin.python
    end: ((?<=""")(")""|""")
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_unicode_char"
    - include: "#escaped_char"
    comment: double quoted unicode string
  - name: string.quoted.double.single-line.unicode-raw.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: meta.empty-string.double.python
      "3": 
        name: invalid.illegal.unclosed-string.python
    begin: ((?i:ur))(")
    beginCaptures: 
      "1": 
        name: storage.type.string.python
      "2": 
        name: punctuation.definition.string.begin.python
    end: ((?<=")(")|")|(\n)
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_unicode_char"
    - include: "#escaped_char"
    - include: source.regexp.python
    comment: double-quoted raw string
  - name: string.quoted.double.single-line.raw.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: meta.empty-string.double.python
      "3": 
        name: invalid.illegal.unclosed-string.python
    begin: ([rR])(")
    beginCaptures: 
      "1": 
        name: storage.type.string.python
      "2": 
        name: punctuation.definition.string.begin.python
    end: ((?<=")(")|")|(\n)
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_char"
    - include: source.regexp.python
    comment: double-quoted raw string
  - name: string.quoted.double.single-line.raw.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: meta.empty-string.double.python
      "3": 
        name: invalid.illegal.unclosed-string.python
    begin: ([rR])(")
    beginCaptures: 
      "1": 
        name: storage.type.string.python
      "2": 
        name: punctuation.definition.string.begin.python
    end: ((?<=")(")|")|(\n)
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_char"
    - include: source.regexp.python
    comment: double-quoted raw string
  - name: string.quoted.double.single-line.unicode.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: meta.empty-string.double.python
      "3": 
        name: invalid.illegal.unclosed-string.python
    begin: ([uU])(")
    beginCaptures: 
      "1": 
        name: storage.type.string.python
      "2": 
        name: punctuation.definition.string.begin.python
    end: ((?<=")(")|")|(\n)
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_unicode_char"
    - include: "#escaped_char"
    comment: double quoted unicode string
  - name: string.quoted.double.block.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: meta.empty-string.double.python
    begin: (""")
    beginCaptures: 
      "1": 
        name: punctuation.definition.string.begin.python
    end: ((?<=""")(")""|""")
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_char"
    comment: double quoted string
  - name: string.quoted.double.single-line.python
    endCaptures: 
      "1": 
        name: punctuation.definition.string.end.python
      "2": 
        name: meta.empty-string.double.python
      "3": 
        name: invalid.illegal.unclosed-string.python
    begin: (")
    beginCaptures: 
      "1": 
        name: punctuation.definition.string.begin.python
    end: ((?<=")(")|")|(\n)
    patterns: 
    - include: "#constant_placeholder"
    - include: "#escaped_char"
    comment: double quoted string
language_variables: 
  name: variable.language.python
  match: \b(self|cls)\b
escaped_unicode_char: 
  captures: 
    "1": 
      name: constant.character.escape.unicode.16-bit-hex.python
    "2": 
      name: constant.character.escape.unicode.32-bit-hex.python
    "3": 
      name: constant.character.escape.unicode.name.python
  match: (\\U[0-9A-Fa-f]{8})|(\\u[0-9A-Fa-f]{4})|(\\N\{[a-zA-Z ]+\})

uuid: F23DB5B2-7D08-11D9-A709-000D93B6E43C foldingStartMarker: ^s*(def|class)s+([.a-zA-Z0-9_ <]+)s*(((.*)))?s*:|{s*$|(s*$|[s*$|^s*“”“(?=.)(?!.*”“”) patterns:

foldingStopMarker: ^s*$|^s*}|^s*]|^s*)|^s*“”“s*$ keyEquivalent: ^~P comment: ”n\

\ttodo:\n\
\t\tlist comprehension / generator comprehension scope.\n\
\t\t\n\
\t"