parameters: (mode_str)
return_statement: return mode
docstring: Parse a mode string, e.g. 'drwxrwxrwx', into a st_mode value.
  
    Effectively the reverse of |mode_to_string| in, e.g.:
    https://github.com/landley/toybox/blob/master/lib/lib.c#L896
docstring_summary: Parse a mode string, e.g. 'drwxrwxrwx', into a st_mode value.
docstring_tokens: Parse a mode string e . g . drwxrwxrwx into a st_mode value .
function: def _ParseModeString(mode_str):
    """Parse a mode string, e.g. 'drwxrwxrwx', into a st_mode value.
  
    Effectively the reverse of |mode_to_string| in, e.g.:
    https://github.com/landley/toybox/blob/master/lib/lib.c#L896
    """
    if not _FILE_MODE_RE.match(mode_str):
      raise ValueError('Unexpected file mode %r', mode_str)
    mode = _FILE_MODE_KIND[mode_str[0]]
    for c, flag in zip(mode_str[1:], _FILE_MODE_PERMS):
      if c != '-' and c.islower():
        mode |= flag
    for c, (t, flag) in zip(mode_str[3::3], _FILE_MODE_SPECIAL):
      if c.lower() == t:
        mode |= flag
    return mode
function_tokens: def _ParseModeString ( mode_str ) : if not _FILE_MODE_RE . match ( mode_str ) : raise ValueError ( 'Unexpected file mode %r' , mode_str ) mode = _FILE_MODE_KIND [ mode_str [ 0 ] ] for c , flag in zip ( mode_str [ 1 : ] , _FILE_MODE_PERMS ) : if c != '-' and c . islower ( ) : mode |= flag for c , ( t , flag ) in zip ( mode_str [ 3 : : 3 ] , _FILE_MODE_SPECIAL ) : if c . lower ( ) == t : mode |= flag return mode