
    )ic
                         S SK r S SKrS SKrS SKrSSKJr  SrSr\R                  " S5      r	S r
S rS	 rS
 r " S S\5      rSS jrg)    N   )Process      z
\(.+\)|\S+c            	          [         R                  " 5       n S HS  n[         R                  R                  [         R                  R	                  S[        U 5      U5      5      (       d  MQ  Us  $    [        S5      e)zDetect /proc filesystem style.

This checks the /proc/{pid} directory for possible formats. Returns one of
the following as str:

* `stat`: Linux-style, i.e. ``/proc/{pid}/stat``.
* `status`: BSD-style, i.e. ``/proc/{pid}/status``.
)statstatus/proczunsupported proc format)osgetpidpathexistsjoinstrProcFormatError)pidnames     V/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/shellingham/posix/proc.pydetect_procr      sT     ))+C"77>>"'',,wC$?@@K # 3
44    c                       [         R                  " 5       R                  R                  5       S;   $ ! [         a     gf = f)N)freebsdnetbsd	dragonflyF)r   unamesysnamelower	Exception r   r   _use_bsd_stat_formatr    #   s:    xxz!!'')-OOO s   /2 
??c                 >   [         R                  R                  S[        U 5      U5      n[        R
                  " USSS9 n[        R                  UR                  5       5      nS S S 5        [        5       (       a	  W[           $ W[           $ ! , (       d  f       N/= f)Nr
   asciireplaceencodingerrors)r   r   r   r   ioopenSTAT_PATTERNfindallreadr    BSD_STAT_PPIDLINUX_STAT_PPID)r   r   r   fpartss        r   	_get_ppidr0   *   ss    77<<S40D			:a$$QVVX. 
; ]##!! 
;	:s   $B
Bc                 H   [         R                  R                  S[        U 5      S5      n[        R
                  " 5       =(       d    Sn[        R                  " XSS9 n[        UR                  5       R                  S5      S S 5      sS S S 5        $ ! , (       d  f       g = f)Nr
   cmdlinezutf-8r#   r$    )r   r   r   r   sysgetfilesystemencodingr'   r(   tupler+   split)r   r   r%   r.   s       r   _get_cmdliner9   4   sk    77<<S95D((*5gH		;q
 QVVX^^D)#2./ 
<	;	;s   +B
B!c                       \ rS rSrSrg)r   ?   r   N)__name__
__module____qualname____firstlineno____static_attributes__r   r   r   r   r   ?   s    r   r   c                 4   ^ [        5       mU4S jnU" X5      $ )z8Try to look up the process tree via the /proc interface.c              3      >#    [        U5       H0  n[        U T5      n[        U 5      n[        X@US9v   US:X  a    g Un M2     g 7f)N)argsr   ppid0)ranger0   r9   r   )r   	max_depth_rD   rC   	stat_names        r   _iter_process_parents3iter_process_parents.<locals>._iter_process_parentsJ   sG     y!AS),D$Dt488s{C "s   AA)r   )r   rG   rJ   rI   s      @r   iter_process_parentsrL   C   s    I
 !00r   )
   )r'   r   rer5   _corer   r,   r-   compiler)   r   r    r0   r9   EnvironmentErrorr   rL   r   r   r   <module>rR      sV    	 	 	 
 
  zz-(5 "0	& 	1r   