
    h                        S r SSKJr  SSKrSSKJrJr  SSKJr  SSK	J
r
  SSKJr  / SQrSS	 jrSSS
 jjrSS jr\SS j5       r\SS j5       rSSS jjrS r\
" \" SSSS5      5      S 5       rg)z'
Common functions for the SSH classes.
    )annotationsN)Sequenceoverload)int_to_bytes)
deprecated)Version)NSgetNSMPgetMPffsc                    [        U [        5      (       a  U R                  S5      n [        R                  " S[        U 5      5      U -   $ )z
net string
zutf-8!L)
isinstancestrencodestructpacklen)ts    _/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/twisted/conch/ssh/common.pyr	   r	      s9     !SHHW;;tSV$q((    c                    / nSn[        U5       HE  n[        R                  " SXUS-    5      u  nUR                  XS-   SU-   U-    5        USU-   -  nMG     [	        U5      XS 4-   $ )z
get net string
r   r      N)ranger   unpackappendtuple)scountnscils         r   r
   r
      sw     
B	A5\}}T1Q<0
		!EAEAI&'	QU
  9"xr   c                    U S:X  a  gU S:  d   e[        U 5      n[        USS 5      S-  (       a  SU-   n[        R                  " S[	        U5      5      U-   $ )Nr   s                 >L)r   ordr   r   r   )numberbns     r   r   r   +   sW    {A::	f	B
2a7|cr\;;tSW%**r   c                    g N )datas    r   r   r   5       r   c                    g r.   r/   )r0   r    s     r   r   r   :   r1   r   c           	         / nSn[        U5       HY  n[        R                  " SXUS-    5      u  nUR                  [        R                  XS-   US-   U-    S5      5        USU-   -  nM[     [        U5      XS 4-   $ )a%  
Get multiple precision integer out of the string.  A multiple precision
integer is stored as a 4-byte length followed by length bytes of the
integer.  If count is specified, get count integers out of the string.
The return value is a tuple of count integers followed by the rest of
the data.
r   r)   r   bigN)r   r   r   r   int
from_bytesr   )r0   r    mpr"   r#   lengths         r   r   r   ?   s     
B	A5\MM$Q8	
		#..!ea!efn!=uEF	QZ  9R{""r   c                (    U  H  nX!;   d  M
  Us  $    g)zg
first from second
goes through the first list, looking for items in the second, returns the first one
Nr/   )r"   r   r#   s      r   r   r   P   s    
 6H r   Twisted      c                     g r.   r/   r/   r   r   installr>   Z   s     	r   )r   zbytes | strreturnbytes)r&   )r   r@   r    r5   r?   zSequence[bytes])r+   r5   r?   r@   )r0   r@   r?   ztuple[int, bytes])r0   r@   r    r5   r?   zSequence[int | bytes])__doc__
__future__r   r   typingr   r   cryptography.utilsr   twisted.python.deprecater   twisted.python.versionsr   __all__r	   r
   r   r   r   r>   r/   r   r   <module>rH      s   
 #  % + / +
/)
 + 
 
 
 
#" GIr1a()	 *	r   