def is_sockfile(path):
 try:
  s = os.stat(path)
 except OSError as (no, e):
  if (no == errno.ENOENT):
   return False
  err(("warning: couldn't stat(%r): %s" % (path, e)))
  return None
 return ((s.st_mode & stat.S_IFSOCK) == stat.S_IFSOCK)

def is_sockfile ( path ) : try : s = os . stat ( path ) except OSError as ( no , e ) : if ( no == errno . ENOENT ) : return False err ( ( "warning: couldn't stat(%r): %s" % ( path , e ) ) ) return None return ( ( s . st_mode & stat . S_IFSOCK ) == stat . S_IFSOCK )
returns whether or not the given path is a socket file .