parameters: (mode_string, unary_modes="")
return_statement: return modes
docstring: [Internal]
docstring_summary: [Internal]
docstring_tokens: [ Internal ]
function: def _parse_modes(mode_string, unary_modes=""):
      """[Internal]"""
      modes = []
      arg_count = 0
  
      # State variable.
      sign = ""
  
      a = mode_string.split()
      if len(a) == 0:
          return []
      else:
          mode_part, args = a[0], a[1:]
  
      if mode_part[0] not in "+-":
          return []
      for ch in mode_part:
          if ch in "+-":
              sign = ch
          elif ch == " ":
              collecting_arguments = 1
          elif ch in unary_modes:
              if len(args) >= arg_count + 1:
                  modes.append([sign, ch, args[arg_count]])
                  arg_count = arg_count + 1
              else:
                  modes.append([sign, ch, None])
          else:
              modes.append([sign, ch, None])
      return modes
function_tokens: def _parse_modes ( mode_string , unary_modes = "" ) : modes = [ ] arg_count = 0 # State variable. sign = "" a = mode_string . split ( ) if len ( a ) == 0 : return [ ] else : mode_part , args = a [ 0 ] , a [ 1 : ] if mode_part [ 0 ] not in "+-" : return [ ] for ch in mode_part : if ch in "+-" : sign = ch elif ch == " " : collecting_arguments = 1 elif ch in unary_modes : if len ( args ) >= arg_count + 1 : modes . append ( [ sign , ch , args [ arg_count ] ] ) arg_count = arg_count + 1 else : modes . append ( [ sign , ch , None ] ) else : modes . append ( [ sign , ch , None ] ) return modes