(mode_str)
return mode
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
Parse a mode string, e.g. 'drwxrwxrwx', into a st_mode value.
Parse a mode string e . g . drwxrwxrwx into a st_mode value .
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
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