<s> """<STR_LIT>""" <EOL> import pwd <EOL> import grp <EOL> import os <EOL> class PWEntry ( object ) : <EOL> def __init__ ( self , _ut ) : <EOL> self . name = _ut [ <NUM_LIT:0> ] <EOL> self . passwd = _ut [ <NUM_LIT:1> ] <EOL> self . uid = _ut [ <NUM_LIT:2> ] <EOL> self . gid = _ut [ <NUM_LIT:3> ] <EOL> self . group = _ut [ <NUM_LIT:3> ] <EOL> self . gecos = _ut [ <NUM_LIT:4> ] <EOL> self . fullname = _ut [ <NUM_LIT:4> ] <EOL> self . home = _ut [ <NUM_LIT:5> ] <EOL> self . shell = _ut [ <NUM_LIT:6> ] <EOL> self . _INDEX = { <NUM_LIT:0> : self . name , <NUM_LIT:1> : self . passwd , <NUM_LIT:2> : self . uid , <NUM_LIT:3> : self . gid , <EOL> <NUM_LIT:4> : self . gecos , <NUM_LIT:5> : self . home , <NUM_LIT:6> : self . shell } <EOL> self . _groups = None <EOL> def __repr__ ( self ) : <EOL> return "<STR_LIT>" % ( self . name , self . passwd , <EOL> self . uid , self . gid , self . gecos , self . home , self . shell ) <EOL> def __str__ ( self ) : <EOL> return self . name <EOL> def __int__ ( self ) : <EOL> return self . uid <EOL> def __getitem__ ( self , idx ) : <EOL> return self . _INDEX [ idx ] <EOL> groupname = property ( lambda self : grp . getgrgid ( self . gid ) [ <NUM_LIT:0> ] , <EOL> doc = "<STR_LIT>" ) <EOL> def _get_groups ( self ) : <EOL> grplist = [ ] <EOL> if self . _groups is None : <EOL> name = self . name <EOL> for gent in grp . getgrall ( ) : <EOL> if name in gent . gr_mem : <EOL> grplist . append ( gent . gr_gid ) <EOL> self . _groups = grplist <EOL> return self . _groups <EOL> groups = property ( _get_groups ) <EOL> def getpwuid ( uid ) : <EOL> return PWEntry ( pwd . getpwuid ( uid ) ) <EOL> def getpwnam ( name ) : <EOL> return PWEntry ( pwd . getpwnam ( name ) ) <EOL> def getpwall ( ) : <EOL> rv = [ ] <EOL> for pw in pwd . getpwall ( ) : <EOL> rv . append ( PWEntry ( pw ) ) <EOL> return rv <EOL> def getpwself ( ) : <EOL> return PWEntry ( pwd . getpwuid ( os . getuid ( ) ) ) </s>
