
    f5                        d Z ddlZddlZddlZddlZddlZddlZddlZej                  j                  dk(  Ze Z ej                  d      Z ej                         dk(  Z ej                         dk(  Z ej                         dk(  Z ej&                  defi       Zej                  dd d	k  rej,                  ZneZ	 ej2                  ZerCdd
lmZmZ m!Z!m"Z#m$Z$ ddl%m&Z& e'fZ(e'e)fZ*e+Z,e'Z-d Z.d Z/d Z0d Z1d Z2d Z3 G d de4      Z5d Z6d Z7n]ddl8mZmZ m!Z! ddl$m"Z#m$Z$ ddl&m&Z& e(Z(e(Z*e,Z,e9Z-e:jv                  Z/e:jx                  Z0e:jz                  Z1e:j|                  Z2e?Z3e5Z5d Z.d Z6d Z7d Z@d ZAd ZBej                  dk(  ZDej                  dd dk  ZEdZF ej                         dk(  r eB ej                               ZFd ZHd!ZIej                  ej                  dfd"ZLy# e$ r ej6                  ZY -w xY w)#zPThe compat module provides various Python 2 / Python 3
compatibility functions

    N   z(\d+).+LinuxDarwinWindowsAbstractBase)   r   )quoteunquote	urlencodeparse_qsurlparse)StringIOc                  *    t        j                         S )z2
        Python 3 supports monotonic time
        )time	monotonic     F/var/www/cs2snipe.com/venv/lib/python3.12/site-packages/pika/compat.pytime_nowr   9   s     ~~r   c                 4    t        | j                               S )a   
        Returns a list of keys of dictionary

        dict.keys returns a view that works like .keys in Python 2
        *except* any modifications in the dictionary will be visible
        (and will cause errors if the view is being iterated over while
        it is modified).
        )listkeysdcts    r   dictkeysr   ?   s     CHHJr   c                 4    t        | j                               S )a(  
        Returns a list of values of a dictionary

        dict.values returns a view that works like .values in Python 2
        *except* any modifications in the dictionary will be visible
        (and will cause errors if the view is being iterated over while
        it is modified).
        )r   valuesr   s    r   
dictvaluesr   K   s     CJJL!!r   c                 "    | j                         S )a<  
        Returns an iterator of items (key/value pairs) of a dictionary

        dict.items returns a view that works like .items in Python 2
        *except* any modifications in the dictionary will be visible
        (and will cause errors if the view is being iterated over while
        it is modified).
        )itemsr   s    r   dict_iteritemsr!   V   s     yy{r   c                 "    | j                         S )zw
        :param dict dct:
        :returns: an iterator of the values of a dictionary
        :rtype: iterator
        )r   r   s    r   dict_itervaluesr#   a   s     zz|r   c                      t        |       S )a  
        This is the same as Python 2 `chr(n)` for bytes in Python 3

        Returns a single byte `bytes` for the given int argument (we
        optimize it a bit here by passing the positional argument tuple
        directly to the bytes constructor.
        )bytes)argss    r   byter'   i   s     T{r   c                       e Zd ZdZd Zd Zy)longzy
        A marker class that signifies that the integer value should be
        serialized as `l` instead of `I`
        c                 *    t        t        |             S )N)strintselfs    r   __str__zlong.__str__y   s    s4y>!r   c                     t        |       dz   S )NLr+   r-   s    r   __repr__zlong.__repr__|   s    t9s?"r   N)__name__
__module____qualname____doc__r/   r3   r   r   r   r)   r)   s   s    	
	"	#r   r)   c                     t        |       S )zs
        Return the canonical str value for the string.
        In both Python 3 and Python 2 this is str.
        r2   values    r   canonical_strr;      s     5zr   c                 "    t        | t              S z&
        Is value an integer?
        )
isinstancer,   r9   s    r   
is_integerr?      s     %%%r   )r	   r
   r   )r   r   c                  *    t        j                          S )z:
        Python 2 does not support monotonic time
        )r   r   r   r   r   r      s     yy{r   c                 l    	 t        |       S # t        $ r t        | j                  d            cY S w xY w)z
        Returns the canonical string value of the given string.
        In Python 2 this is the value unchanged if it is an str, otherwise
        it is the unicode value encoded as UTF-8.
        zutf-8)r+   UnicodeEncodeErrorencoder9   s    r   r;   r;      s4    	.u:! 	.u||G,--	.s   
 #33c                 .    t        | t        t        f      S r=   )r>   r,   r)   r9   s    r   r?   r?      s     %#t--r   c                 H    t        | t              s| j                  d      S | S )z 
    Returns value as bytes
    zUTF-8)r>   r%   rC   r9   s    r   as_bytesrF      s"     eU#||G$$Lr   c                     | j                         rt        |       S t        j                  |       }|rt        |j	                         d         S dS )z%
    Returns value as in integer
    r   )isdigitr,   RE_NUMmatchgroups)r:   rJ   s     r   to_digitrL      sB     }}5zLLE%*3u||~a !11r   c                     | j                  d      d   }t        t        t        |j                  d      dd             S )z
    Gets linux version
    -r   .Nr   )splittuplemaprL   )release_strver_strs     r   get_linux_versionrU      s;     $Q'GXw}}S1"15677r   posix)r      z	127.0.0.1z::1c                     | t         j                  k(  rt        }n%| t         j                  k(  rt        }nt        d      |t         j                  k7  rt        d      |dk7  rt        d      t        j                   | ||      }	 |j                  |df       |j                  t        t         j                  d             |j                         dd \  }}t        j                   | ||      }	 |j                  ||f       |j                         \  }}		 |j                          |j!                  d       |j!                  d       ||fS # t        $ r |j                           w xY w# |j                          w xY w)	z
    Returns a pair of sockets in the manner of socketpair with the additional
    feature that they will be non-blocking. Prior to Python 3.5, socketpair
    did not exist on Windows at all.
    z?Only AF_INET and AF_INET6 socket address families are supportedz0Only SOCK_STREAM socket socket_type is supportedr   zOnly protocol zero is supported   Nr   F)socketAF_INET
_LOCALHOSTAF_INET6_LOCALHOST_V6
ValueErrorSOCK_STREAMbindlistenmin	SOMAXCONNgetsocknameconnectaccept	Exceptionclosesetblocking)
familysocket_typeprotohostlsockaddrportcsockssock_s
             r   _nonblocking_socketpairru      sP    	6??	" ) * 	*f(((KLLz:;;MM&+u5E

D!9S))3/0&&(!,
dfk59	MM4,'||~HE1
 	 
e	e%<  	KKM	 	s   A)E+ 0&E E((E+ +E=)Mr7   abcosplatformrerZ   sys_sysr   version_infomajorPY2PY3compilerI   systemON_LINUXON_OSX
ON_WINDOWSABCMetaobjectr   errorSOCKET_ERROROSErrorSOL_TCPAttributeErrorIPPROTO_TCPurllib.parser	   	url_quoter
   url_unquoter   r   url_parse_qsr   ior   r+   
basestringr%   str_or_bytesrangexrangeunicode_typer   r   r   r!   r#   r'   r,   r)   r;   r?   urllibunicodedictr   r   	iteritems
itervalueschrrF   rL   rU   nameHAVE_SIGNALEINTR_IS_EXPOSEDLINUX_VERSIONreleaser\   r^   r[   r`   ru   r   r   r   <module>r      s@    	  	   
"
g	J	8??'		h	&X__)+
 s{{>F9b9Ra6!<<L L!nnG M M J <L F L 
 	"	
#s 
#& ON=!JLFLyyHJ^^NooODD
..28 gg $$Ra(F2 8??%&6h&6&6&89M
 $*>>(.(:(:"#)u  !  G!s    G% %G:9G: