
    h                     p    S r SSKJrJr  SS/r " S S5      r " S S5      r " S S	5      r " S
 S5      rg)zM
L{twisted.python.fakepwd} provides a fake implementation of the L{pwd} API.
    )ListOptionalUserDatabaseShadowDatabasec                   V    \ rS rSrSrS\S\S\S\S\S\S	\S
S4S jrS
\4S jrS r	Sr
g)_UserRecord   z
L{_UserRecord} holds the user data for a single user in L{UserDatabase}.
It corresponds to the C{passwd} structure from the L{pwd} module.
See that module for attribute documentation.
namepassworduidgidgecoshomeshellreturnNc                 X    Xl         X l        X0l        X@l        XPl        X`l        Xpl        g Npw_name	pw_passwdpw_uidpw_gidpw_gecospw_dirpw_shell)selfr
   r   r   r   r   r   r   s           ]/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/twisted/python/fakepwd.py__init___UserRecord.__init__   s'     !    c                     g)N    r   s    r   __len___UserRecord.__len__'       r    c                     U R                   U R                  U R                  U R                  U R                  U R
                  U R                  4U   $ r   r   r   indexs     r   __getitem___UserRecord.__getitem__*   sG    LLNNKKKKMMKKMM
  	r    )r   r   r   r   r   r   r   __name__
__module____qualname____firstlineno____doc__strintr   r%   r+   __static_attributes__r#   r    r   r   r      sk      	
     
$ 	r    r   c                       \ rS rSr% Sr\\   \S'   Sr\	\S'   Sr
\	\S'   SS
 jr      SS\S\S\\	   S\\	   S\S\S\SS	4S jjrS\	S\4S jrS\S\4S jrS\\   4S jrSrg	)r   6   z
L{UserDatabase} holds a traditional POSIX user data in memory and makes it
available via the same API as L{pwd}.

@ivar _users: A C{list} of L{_UserRecord} instances holding all user data
    added to this database.
_usersiu'  _lastUIDiN  _lastGIDr   Nc                     / U l         g r   r8   r$   s    r   r   UserDatabase.__init__C   	    r    r   usernamer   r   r   r   r   c           	          Uc!  U R                   nU =R                   S-  sl         Uc!  U R                  nU =R                  S-  sl        [        XX4XVU5      nU R                  R	                  U5        g)ab  
Add a new user record to this database.

@param username: The value for the C{pw_name} field of the user
    record to add.

@param password: The value for the C{pw_passwd} field of the user
    record to add.

@param uid: The value for the C{pw_uid} field of the user record to
    add.

@param gid: The value for the C{pw_gid} field of the user record to
    add.

@param gecos: The value for the C{pw_gecos} field of the user record
    to add.

@param home: The value for the C{pw_dir} field of the user record to
    add.

@param shell: The value for the C{pw_shell} field of the user record to
    add.
N   )r9   r:   r   r8   append)	r   r?   r   r   r   r   r   r   newUsers	            r   addUserUserDatabase.addUserF   s_    D ;--CMMQM;--CMMQMh#EO7#r    c                 d    U R                    H  nUR                  U:X  d  M  Us  $    [        5       e)z8
Return the user record corresponding to the given uid.
)r8   r   KeyError)r   r   entrys      r   getpwuidUserDatabase.getpwuidq   s-     [[E||s" ! jr    r
   c                     [        U[        5      (       d  [        S[        U5       35      eU R                   H  nUR
                  U:X  d  M  Us  $    [        5       e)z=
Return the user record corresponding to the given username.
z%getpwuam() argument must be str, not )
isinstancer3   	TypeErrortyper8   r   rG   )r   r
   rH   s      r   getpwnamUserDatabase.getpwnamz   sQ     $$$CDJ<PQQ[[E}}$ ! jr    c                     U R                   $ )z$
Return a list of all user records.
r<   r$   s    r   getpwallUserDatabase.getpwall        {{r    r<   r   N)r   NN rV   z/bin/sh)r.   r/   r0   r1   r2   r   r   __annotations__r9   r4   r:   r   r3   r   rD   rI   rO   rR   r5   r#   r    r   r   r   6   s     HcHc #!!)$)$ )$ c]	)$
 c])$ )$ )$ )$ 
)$VC K 	S 	[ 	${+ r    c                   ^    \ rS rSrSrS\S\S\S\S\S\S	\S
\S\SS4S jrS\4S jrS r	Sr
g)_ShadowRecord   z
L{_ShadowRecord} holds the shadow user data for a single user in
L{ShadowDatabase}.  It corresponds to C{spwd.struct_spwd}.  See that class
for attribute documentation.
r?   r   
lastChangeminmaxwarninactexpireflagr   Nc
                 p    Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        g r   	sp_namsp_pwd	sp_lstchgsp_minsp_maxsp_warnsp_inact	sp_expiresp_flag
r   r?   r   r[   r\   r]   r^   r_   r`   ra   s
             r   r   _ShadowRecord.__init__   s1     #r    c                     g)N	   r#   r$   s    r   r%   _ShadowRecord.__len__   r'   r    c           	          U R                   U R                  U R                  U R                  U R                  U R
                  U R                  U R                  U R                  4	U   $ r   rc   r)   s     r   r+   _ShadowRecord.__getitem__   sU    KKKKNNKKKKLLMMNNLL

 
 
	r    )	rk   rl   rj   rf   rh   rg   rd   re   ri   r-   r#   r    r   rY   rY      s      	
       
, r    rY   c                   ~    \ rS rSr% Sr\\   \S'   SS jrS\	S\	S	\
S
\
S\
S\
S\
S\
S\
SS4S jrS\	S\4S jrS rSrg)r      z
L{ShadowDatabase} holds a shadow user database in memory and makes it
available via the same API as C{spwd}.

@ivar _users: A C{list} of L{_ShadowRecord} instances holding all user data
    added to this database.

@since: 12.0
r8   r   Nc                     / U l         g r   r<   r$   s    r   r   ShadowDatabase.__init__   r>   r    r?   r   r[   r\   r]   r^   r_   r`   ra   c
                 T    U R                   R                  [        XX4XVXxU	5	      5        g)a  
Add a new user record to this database.

@param username: The value for the C{sp_nam} field of the user record to
    add.

@param password: The value for the C{sp_pwd} field of the user record to
    add.

@param lastChange: The value for the C{sp_lstchg} field of the user
    record to add.

@param min: The value for the C{sp_min} field of the user record to add.

@param max: The value for the C{sp_max} field of the user record to add.

@param warn: The value for the C{sp_warn} field of the user record to
    add.

@param inact: The value for the C{sp_inact} field of the user record to
    add.

@param expire: The value for the C{sp_expire} field of the user record
    to add.

@param flag: The value for the C{sp_flag} field of the user record to
    add.
N)r8   rB   rY   rm   s
             r   rD   ShadowDatabase.addUser   s*    P 	JSt	
r    c                     [        U[        5      (       d  [        S[        U5       35      eU R                   H  nUR
                  U:X  d  M  Us  $    [        U5      e)zD
Return the shadow user record corresponding to the given username.
z%getspnam() argument must be str, not )rL   r3   rM   rN   r8   rd   rG   )r   r?   rH   s      r   getspnamShadowDatabase.getspnam   sU     (C((CDNCSTUU[[E||x' ! x  r    c                     U R                   $ )z+
Return a list of all shadow user records.
r<   r$   s    r   getspallShadowDatabase.getspall  rT   r    r<   rU   )r.   r/   r0   r1   r2   r   rY   rW   r   r3   r4   rD   r{   r~   r5   r#   r    r   r   r      s     ,
,
 ,
 	,

 ,
 ,
 ,
 ,
 ,
 ,
 
,
\	! 	! 	!r    N)	r2   typingr   r   __all__r   r   rY   r   r#   r    r   <module>r      sI   
 "+
,% %PS Sl+ +\M Mr    