def get_unix_user(user=None):
 if isinstance(user, six.string_types):
  try:
   user_info = pwd.getpwnam(user)
  except KeyError:
   try:
    i = int(user)
   except ValueError:
    raise KeyError(("user name '%s' not found" % user))
   try:
    user_info = pwd.getpwuid(i)
   except KeyError:
    raise KeyError(('user id %d not found' % i))
 elif isinstance(user, int):
  try:
   user_info = pwd.getpwuid(user)
  except KeyError:
   raise KeyError(('user id %d not found' % user))
 elif (user is None):
  user_info = pwd.getpwuid(os.geteuid())
 else:
  user_cls_name = reflection.get_class_name(user, fully_qualified=False)
  raise TypeError(('user must be string, int or None; not %s (%r)' % (user_cls_name, user)))
 return (user_info.pw_uid, user_info.pw_name)

def get_unix_user ( user = None ) : if isinstance ( user , six . string_types ) : try : user_info = pwd . getpwnam ( user ) except KeyError : try : i = int ( user ) except ValueError : raise KeyError ( ( "user name '%s' not found" % user ) ) try : user_info = pwd . getpwuid ( i ) except KeyError : raise KeyError ( ( 'user id %d not found' % i ) ) elif isinstance ( user , int ) : try : user_info = pwd . getpwuid ( user ) except KeyError : raise KeyError ( ( 'user id %d not found' % user ) ) elif ( user is None ) : user_info = pwd . getpwuid ( os . geteuid ( ) ) else : user_cls_name = reflection . get_class_name ( user , fully_qualified = False ) raise TypeError ( ( 'user must be string, int or None; not %s (%r)' % ( user_cls_name , user ) ) ) return ( user_info . pw_uid , user_info . pw_name )
get the uid and user name .