errata.cpython-39.opt-1.pyc000064400000003114151114561130011407 0ustar00a ߾g @sfddlmZddlmZddlmZddlmZdgZdZddZdd dZ d d Z e d krbe d S)) rhnserver) up2dateAuth)pkgUtils)packagesupdatecCst}|jt|S)N)rZ RhnServerZerrataZ getErrataInforZ getSystemId)Z errata_idsr 6/usr/lib/python3.9/site-packages/rhn/actions/errata.py__getErrataInfosr Nc Cs~g}t|tgtdfvr"|g}|D]}t|}||}q&i}i}tjddD]$}|||d|d<|||d<qPi}t|ddkr|D]|}d|d|df|vr|||d|d<qd |d|vr|||d|d<q|dd kr|d|vr|||d<qn&|D] }|d|vr|||d<qt|}|gkrri} d | d <d | d<|| d<dd| fSt||S)Nr )ZgetArchnameZarchrz%s%sz%snoarchZnoarch0versionzerrata.update.no_packagesZerratas'z*No packages from that errata are available) typer rZgetInstalledPackageListlenlistvaluesrr) Z errataidlistZ cache_onlyZ packagelistZerrataidZtmpListZcurrent_packages_with_archZcurrent_packagespudatar r r rsD   cCsttdgdS)Niie)printrr r r r mainPsr__main__)N) Zup2date_clientrrrZ rhn.actionsrZ __rhnexport__ZACTION_VERSIONr rr__name__r r r r  s     7errata.cpython-39.pyc000064400000003114151114561130010450 0ustar00a ߾g @sfddlmZddlmZddlmZddlmZdgZdZddZdd dZ d d Z e d krbe d S)) rhnserver) up2dateAuth)pkgUtils)packagesupdatecCst}|jt|S)N)rZ RhnServerZerrataZ getErrataInforZ getSystemId)Z errata_idsr 6/usr/lib/python3.9/site-packages/rhn/actions/errata.py__getErrataInfosr Nc Cs~g}t|tgtdfvr"|g}|D]}t|}||}q&i}i}tjddD]$}|||d|d<|||d<qPi}t|ddkr|D]|}d|d|df|vr|||d|d<qd |d|vr|||d|d<q|dd kr|d|vr|||d<qn&|D] }|d|vr|||d<qt|}|gkrri} d | d <d | d<|| d<dd| fSt||S)Nr )ZgetArchnameZarchrz%s%sz%snoarchZnoarch0versionzerrata.update.no_packagesZerratas'z*No packages from that errata are available) typer rZgetInstalledPackageListlenlistvaluesrr) Z errataidlistZ cache_onlyZ packagelistZerrataidZtmpListZcurrent_packages_with_archZcurrent_packagespudatar r r rsD   cCsttdgdS)Niie)printrr r r r mainPsr__main__)N) Zup2date_clientrrrZ rhn.actionsrZ __rhnexport__ZACTION_VERSIONr rr__name__r r r r  s     7packages.cpython-39.opt-1.pyc000064400000000551151114561130011711 0ustar00a /h@s^ddlZdD]LZeeee<eejD].ZeeksBeedr(ejeejde<q(q dS)N)Zurllib3ZidnaZchardet.zrequests.packages.)syspackage __import__localslistmodulesmod startswithr r 5/usr/lib/python3.9/site-packages/requests/packages.pys packages.cpython-39.pyc000064400000000551151114561130010752 0ustar00a /h@s^ddlZdD]LZeeee<eejD].ZeeksBeedr(ejeejde<q(q dS)N)Zurllib3ZidnaZchardet.zrequests.packages.)syspackage __import__localslistmodulesmod startswithr r 5/usr/lib/python3.9/site-packages/requests/packages.pys __init__.cpython-39.opt-1.pyc000064400000000224151114561130011667 0ustar00a "e@sdS)Nrrr9/usr/lib/python3.9/site-packages/tracer/tests/__init__.py__init__.cpython-39.pyc000064400000000224151114561130010730 0ustar00a "e@sdS)Nrrr9/usr/lib/python3.9/site-packages/tracer/tests/__init__.pyhardware.cpython-39.opt-1.pyc000064400000001737151114561130011737 0ustar00a f8hI@sRddlmZddlmZddlmZdZdgZd ddZddZed krNedS) )hardware) up2dateAuth) rpcServer refresh_listNcCsn|rddifSt}t}tdkr.tdz|jt |WntdddifYS0ddifS) Nrzno-ops for cachingzCalled refresh_hardwarez3ERROR: sending hardware database for System Profile z Error refreshing system hardwarezhardware list refreshed) rZHardwarerZ getServer argVerboseprintZ registrationZrefresh_hw_profilerZ getSystemId)Z cache_onlyZ hardwareListsr 8/usr/lib/python3.9/site-packages/rhn/actions/hardware.pyrs  cCsttdS)N)r rr r r r main(sr __main__)N) Zup2date_clientrrrrZ __rhnexport__rr __name__r r r r  s    hardware.cpython-39.pyc000064400000001737151114561130011000 0ustar00a f8hI@sRddlmZddlmZddlmZdZdgZd ddZddZed krNedS) )hardware) up2dateAuth) rpcServer refresh_listNcCsn|rddifSt}t}tdkr.tdz|jt |WntdddifYS0ddifS) Nrzno-ops for cachingzCalled refresh_hardwarez3ERROR: sending hardware database for System Profile z Error refreshing system hardwarezhardware list refreshed) rZHardwarerZ getServer argVerboseprintZ registrationZrefresh_hw_profilerZ getSystemId)Z cache_onlyZ hardwareListsr 8/usr/lib/python3.9/site-packages/rhn/actions/hardware.pyrs  cCsttdS)N)r rr r r r main(sr __main__)N) Zup2date_clientrrrrZ __rhnexport__rr __name__r r r r  s    reboot.cpython-39.opt-1.pyc000064400000002340151114561130011423 0ustar00a f8hN@s^ddlZdgZddlmZddlmZeZeZdZ d ddZ ddZ e d krZe dS) Nreboot) up2dateLog)configcCs|rddifStdr ddifSt}ddi}dtd d }|sz4|rftd d d d d|gntd d d d|gWn$tyd|d<dd|fYS0tddd|fS)Nrzno-ops for cachingZnoReboot&z*Up2date is configured not to allow rebootsversion0zReboot of system "z'" initiated by Spacewalk reboot action.z/sbin/shutdownz-rz-kz+3zreboot.reboot.shutdown_failedname"z Could not execute /sbin/shutdownzRebooting the system nowzReboot sucessfully started)cfgosforkunameexecvpOSErrorlogZlog_me)testZ cache_onlypiddataZreboot_messager6/usr/lib/python3.9/site-packages/rhn/actions/reboot.pyrs"    cCsttdddS)Nr )r)printrrrrrmain1sr__main__)NN) r Z __rhnexport__Zup2date_clientrrZinitUp2dateConfigr ZinitLogrZACTION_VERSIONrr__name__rrrr s   reboot.cpython-39.pyc000064400000002340151114561130010464 0ustar00a f8hN@s^ddlZdgZddlmZddlmZeZeZdZ d ddZ ddZ e d krZe dS) Nreboot) up2dateLog)configcCs|rddifStdr ddifSt}ddi}dtd d }|sz4|rftd d d d d|gntd d d d|gWn$tyd|d<dd|fYS0tddd|fS)Nrzno-ops for cachingZnoReboot&z*Up2date is configured not to allow rebootsversion0zReboot of system "z'" initiated by Spacewalk reboot action.z/sbin/shutdownz-rz-kz+3zreboot.reboot.shutdown_failedname"z Could not execute /sbin/shutdownzRebooting the system nowzReboot sucessfully started)cfgosforkunameexecvpOSErrorlogZlog_me)testZ cache_onlypiddataZreboot_messager6/usr/lib/python3.9/site-packages/rhn/actions/reboot.pyrs"    cCsttdddS)Nr )r)printrrrrrmain1sr__main__)NN) r Z __rhnexport__Zup2date_clientrrZinitUp2dateConfigr ZinitLogrZACTION_VERSIONrr__name__rrrr s   rhnsd.cpython-39.opt-1.pyc000064400000002441151114561130011251 0ustar00a f8hS@srddlZdgZd ddZdddZedkrneedeedd eed d d eed d eed dS)N configurec Csd}t|d}|}d}d}g}|D]:}|} || | dd} | ddkrX|}|d}q&|dkrvd|||<|t|d}d |} || |dS) Nz/etc/sysconfig/rhn/rhnsdrr=ZINTERVALz INTERVAL=%sw )open readlinesstripappendsplitclosejoinwrite) interval cache_onlyZ rhnsdconfigfdlinescountindexZtmplineslinetmpcompscontentsr5/usr/lib/python3.9/site-packages/rhn/actions/rhnsd.py __configRhnsds(         rcCsd|rddifSd}|rDzt|d}WntyBddifYS0|rZtd}|d}d|ifS) Nrzno-ops for cachingzrhnsd interval config updated. %z)Could not modify /etc/sysconfig/rhn/rhnsdz'/sbin/service rhnsd restart > /dev/nullzrhnsd restarted)rIOErrorossystem)rrestartrmsgrcrrrr(s   __main__Z240Z361rZ127)r"Z192)N)NNN)r Z __rhnexport__rr__name__printrrrrs   rhnsd.cpython-39.pyc000064400000002441151114561130010312 0ustar00a f8hS@srddlZdgZd ddZdddZedkrneedeedd eed d d eed d eed dS)N configurec Csd}t|d}|}d}d}g}|D]:}|} || | dd} | ddkrX|}|d}q&|dkrvd|||<|t|d}d |} || |dS) Nz/etc/sysconfig/rhn/rhnsdrr=ZINTERVALz INTERVAL=%sw )open readlinesstripappendsplitclosejoinwrite) interval cache_onlyZ rhnsdconfigfdlinescountindexZtmplineslinetmpcompscontentsr5/usr/lib/python3.9/site-packages/rhn/actions/rhnsd.py __configRhnsds(         rcCsd|rddifSd}|rDzt|d}WntyBddifYS0|rZtd}|d}d|ifS) Nrzno-ops for cachingzrhnsd interval config updated. %z)Could not modify /etc/sysconfig/rhn/rhnsdz'/sbin/service rhnsd restart > /dev/nullzrhnsd restarted)rIOErrorossystem)rrestartrmsgrcrrrr(s   __main__Z240Z361rZ127)r"Z192)N)NNN)r Z __rhnexport__rr__name__printrrrrs   systemid.cpython-39.opt-1.pyc000064400000001225151114561130011773 0ustar00a f8h@sddlZdgZdddZdS)NdisablecCsJ|rddifSd}t|d}|dtt|f|ddifS)z5We have been told that we should disable the systemidrzno-ops for cachingz/etc/sysconfig/rhn/disablewz4Disable lock created on %s. RHN Server Message: %s z*systemId disable lock file has been writen)openwritetimectimeclose)Z messageTextZ cache_onlyZdisableFilePathfdr 8/usr/lib/python3.9/site-packages/rhn/actions/systemid.pyrs  )N)rZ __rhnexport__rr r r r ssystemid.cpython-39.pyc000064400000001225151114561130011034 0ustar00a f8h@sddlZdgZdddZdS)NdisablecCsJ|rddifSd}t|d}|dtt|f|ddifS)z5We have been told that we should disable the systemidrzno-ops for cachingz/etc/sysconfig/rhn/disablewz4Disable lock created on %s. RHN Server Message: %s z*systemId disable lock file has been writen)openwritetimectimeclose)Z messageTextZ cache_onlyZdisableFilePathfdr 8/usr/lib/python3.9/site-packages/rhn/actions/systemid.pyrs  )N)rZ __rhnexport__rr r r r sup2date_config.cpython-39.opt-1.pyc000064400000003240151114561130013022 0ustar00a f8h@s^ddlZddlZddlmZeZddgZdZd ddZd ddZ ddZ e d krZe dS) N)configupdategetcCs|rddifStdkrtdt|tikr8ddifSg}tdrNtd}ng}|D]}||vrhqZt|||qZt|r|StddifS) z9Invoke this to change the ondisk configuration of up2daterno-ops for cachingzcalled update_up2date_config z$Invalid arguments passed to functionZdisallowConfChangeszconfig updated) argVerboseprinttypecfgkeyssetlenZsave)Z configdict cache_onlyZ unknownparamsZ skipParamsZparamr>/usr/lib/python3.9/site-packages/rhn/actions/up2date_config.pyrs$    cCsJ|rddifStdkrtdi}tD]}t|||<q*ddd|ifS)z.Reterieve the current configuration of up2daterrrzcalled get_up2date_configzconfiguration retriveddata)rr r r )rretkrrrr3s  cCsjt}|dd}ddl}|}||d<t|ddl}|t|d|d<d|d<|t|dS) NrrZ timeStampTestz)https://xmlrpc.cln.cloudlinux.com/XMLRPC/Z serverURLz.https://ipv6.xmlrpc.cln.cloudlinux.com/XMLRPC/Z serverURLipv6)rtimer pprintr)Z configdatatupZ configdatarZ timestamprrrrmain@s r__main__)N)N) osreZup2date_clientrZinitUp2dateConfigr Z __rhnexport__rrrr__name__rrrrs   up2date_config.cpython-39.pyc000064400000003240151114561130012063 0ustar00a f8h@s^ddlZddlZddlmZeZddgZdZd ddZd ddZ ddZ e d krZe dS) N)configupdategetcCs|rddifStdkrtdt|tikr8ddifSg}tdrNtd}ng}|D]}||vrhqZt|||qZt|r|StddifS) z9Invoke this to change the ondisk configuration of up2daterno-ops for cachingzcalled update_up2date_config z$Invalid arguments passed to functionZdisallowConfChangeszconfig updated) argVerboseprinttypecfgkeyssetlenZsave)Z configdict cache_onlyZ unknownparamsZ skipParamsZparamr>/usr/lib/python3.9/site-packages/rhn/actions/up2date_config.pyrs$    cCsJ|rddifStdkrtdi}tD]}t|||<q*ddd|ifS)z.Reterieve the current configuration of up2daterrrzcalled get_up2date_configzconfiguration retriveddata)rr r r )rretkrrrr3s  cCsjt}|dd}ddl}|}||d<t|ddl}|t|d|d<d|d<|t|dS) NrrZ timeStampTestz)https://xmlrpc.cln.cloudlinux.com/XMLRPC/Z serverURLz.https://ipv6.xmlrpc.cln.cloudlinux.com/XMLRPC/Z serverURLipv6)rtimer pprintr)Z configdatatupZ configdatarZ timestamprrrrmain@s r__main__)N)N) osreZup2date_clientrZinitUp2dateConfigr Z __rhnexport__rrrr__name__rrrrs   help.cpython-39.pyc000064400000005062151116515220010127 0ustar00a /h @sdZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl m Z zddl mZWneydZdZdZYn0ddlZddlZddZd d Zd d Zed kredS)z'Module containing bug report helper(s).)print_functionN) __version__) pyopensslcCst}|dkrt}nj|dkr\dtjjtjjtjjf}tjjdkrd |tjjg}n(|dkrnt}n|dkrt}nd}||d S) aReturn a dict with the Python implementation and version. Provide both the name and the version of the Python implementation currently running. For example, on CPython 2.7.5 it will return {'name': 'CPython', 'version': '2.7.5'}. This function works best on CPython and PyPy: in particular, it probably doesn't work for Jython or IronPython. Future investigation should be done to work out the correct shape of the code for those platforms. ZCPythonZPyPyz%s.%s.%sfinalZJythonZ IronPythonUnknown)nameversion) platformZpython_implementationZpython_versionsysZpypy_version_infomajorminormicro releaseleveljoin)implementationZimplementation_versionr1/usr/lib/python3.9/site-packages/requests/help.py_implementations$     rc Cszttd}Wnty2ddd}Yn0t}dtji}dtji}ddd}trptjdtj j d}dt t ddi}dt t ddi}tj }d|durd|ndi}|||tdu|||||dtid S) z&Generate information for a bug report.)systemreleaserr Nr)r Zopenssl_versionz%xr) r r system_sslZusing_pyopensslZ pyOpenSSLurllib3chardet cryptographyidnaZrequests)r rrIOErrorrrrrOpenSSLZSSLZOPENSSL_VERSION_NUMBERgetattrrrsslrrequests_version) Z platform_infoZimplementation_infoZ urllib3_infoZ chardet_infoZpyopenssl_infoZcryptography_infoZ idna_inforZsystem_ssl_inforrrinfo;sJ        r"cCsttjtddddS)z)Pretty-print the bug information as JSON.T)Z sort_keysindentN)printjsondumpsr"rrrrmainqsr(__main__)__doc__Z __future__rr&r r r rrrrrr!Zurllib3.contribr ImportErrorrrrr"r(__name__rrrrs,    !6hooks.cpython-39.opt-1.pyc000064400000001656151116515220011266 0ustar00a /h@sdZdgZddZddZdS)z requests.hooks ~~~~~~~~~~~~~~ This module provides the capabilities for the Requests hooks system. Available hooks: ``response``: The response generated from a Request. ZresponsecCsddtDS)NcSsi|] }|gqSr).0Zeventrr2/usr/lib/python3.9/site-packages/requests/hooks.py z!default_hooks..)HOOKSrrrr default_hookssrcKsP|pi}||}|rLt|dr&|g}|D] }||fi|}|dur*|}q*|S)z6Dispatches a hook dictionary on a given piece of data.__call__N)gethasattr)keyZhooksZ hook_datakwargshookZ _hook_datarrr dispatch_hooks  rN)__doc__rrrrrrrs hooks.cpython-39.pyc000064400000001656151116515220010327 0ustar00a /h@sdZdgZddZddZdS)z requests.hooks ~~~~~~~~~~~~~~ This module provides the capabilities for the Requests hooks system. Available hooks: ``response``: The response generated from a Request. ZresponsecCsddtDS)NcSsi|] }|gqSr).0Zeventrr2/usr/lib/python3.9/site-packages/requests/hooks.py z!default_hooks..)HOOKSrrrr default_hookssrcKsP|pi}||}|rLt|dr&|g}|D] }||fi|}|dur*|}q*|S)z6Dispatches a hook dictionary on a given piece of data.__call__N)gethasattr)keyZhooksZ hook_datakwargshookZ _hook_datarrr dispatch_hooks  rN)__doc__rrrrrrrs models.cpython-39.opt-1.pyc000064400000056413151116515220011427 0ustar00a /h@sdZddlZddlZddlZddlmZddlmZddl m Z ddl m Z m Z mZmZddlmZdd lmZdd lmZdd lmZdd lmZmZmZdd lmZmZmZm Z m!Z!m"Z"m#Z#ddl$m%Z%m&Z&ddl'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1ddl2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;mZ>ddl2m?Z@ddlAmBZBeBjCeBjDeBjEeBjFeBjGfZHdZIdZJdZKGdddeLZMGdddeLZNGdddeNZOGdddeMeNZPGdddeLZQdS) z` requests.models ~~~~~~~~~~~~~~~ This module contains the primary objects that power Requests. N) RequestField)encode_multipart_formdata) parse_url) DecodeErrorReadTimeoutError ProtocolErrorLocationParseError)UnsupportedOperation) default_hooks)CaseInsensitiveDict) HTTPBasicAuth)cookiejar_from_dictget_cookie_header_copy_cookie_jar) HTTPError MissingSchema InvalidURLChunkedEncodingErrorContentDecodingErrorConnectionErrorStreamConsumedError)to_native_stringunicode_is_ascii) guess_filenameget_auth_from_url requote_uristream_decode_response_unicodeto_key_val_listparse_header_links iter_slicesguess_json_utf super_lencheck_header_validity) CallableMapping cookielib urlunparseurlsplit urlencodestrbytesis_py2chardet builtin_str basestring)json)codesi(ic@s0eZdZeddZeddZeddZdS)RequestEncodingMixincCsNg}t|j}|j}|sd}|||j}|rD|d||d|S)zBuild the path URL to use./?)r(urlpathappendqueryjoin)selfr7pr8r:r>3/usr/lib/python3.9/site-packages/requests/models.pypath_url=s    zRequestEncodingMixin.path_urlcCst|ttfr|St|dr |St|drg}t|D]j\}}t|tsRt|dsX|g}|D]B}|dur\|t|tr|dn|t|tr|dn|fq\q6t|ddS|SdS)zEncode parameters in a piece of data. Will successfully encode parameters when passed as a dict or a list of 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary if parameters are supplied as a dict. read__iter__Nutf-8T)doseq) isinstancer*r+hasattrrr/r9encoder))dataresultkZvsvr>r>r?_encode_paramsRs$    z#RequestEncodingMixin._encode_paramscCs|stdnt|tr tdg}t|p,i}t|p8i}|D]|\}}t|ts\t|dsb|g}|D]T}|durft|tst|}|t|tr|dn|t|tr| dn|fqfq@|D]\}}d}d} t|t t fr t |dkr|\} } n&t |dkr|\} } }n |\} } }} nt |p,|} |} t| tttfrJ| } n(t| dr`| } n| durnqn| } t|| | | d } | j|d || qt|\}}||fS) aBuild the body for a multipart/form-data request. Will successfully encode files when passed as a dict or a list of tuples. Order is retained if data is a list of tuples but arbitrary if parameters are supplied as a dict. The tuples may be 2-tuples (filename, fileobj), 3-tuples (filename, fileobj, contentype) or 4-tuples (filename, fileobj, contentype, custom_headers). zFiles must be provided.zData must not be a string.rBNrCrA)namerHfilenameheaders) content_type) ValueErrorrEr/rrFr+r*r9decoderGtuplelistlenr bytearrayrArZmake_multipartr)filesrHZ new_fieldsfieldsZfieldvalrKrJZftZfhfnfpZfdataZrfbodyrRr>r>r? _encode_filesmsT                 z"RequestEncodingMixin._encode_filesN)__name__ __module__ __qualname__propertyr@ staticmethodrLr_r>r>r>r?r3<s   r3c@seZdZddZddZdS)RequestHooksMixincCsZ||jvrtd|t|tr2|j||n$t|drV|j|dd|DdS)zProperly register a hook.z1Unsupported event specified, with event name "%s"rBcss|]}t|tr|VqdSN)rEr$).0hr>r>r? z2RequestHooksMixin.register_hook..N)hooksrSrEr$r9rFextendr<eventhookr>r>r? register_hooks     zRequestHooksMixin.register_hookcCs0z|j||WdSty*YdS0dS)ziDeregister a previously registered hook. Returns True if the hook existed, False if not. TFN)rkremoverSrmr>r>r?deregister_hooks  z!RequestHooksMixin.deregister_hookN)r`rarbrprrr>r>r>r?res rec @s*eZdZdZd ddZddZddZdS) Requesta{A user-created :class:`Request ` object. Used to prepare a :class:`PreparedRequest `, which is sent to the server. :param method: HTTP method to use. :param url: URL to send. :param headers: dictionary of headers to send. :param files: dictionary of {filename: fileobject} files to multipart upload. :param data: the body to attach to the request. If a dictionary or list of tuples ``[(key, value)]`` is provided, form-encoding will take place. :param json: json for the body to attach to the request (if files or data is not specified). :param params: URL parameters to append to the URL. If a dictionary or list of tuples ``[(key, value)]`` is provided, form-encoding will take place. :param auth: Auth handler or (user, pass) tuple. :param cookies: dictionary or CookieJar of cookies to attach to this request. :param hooks: dictionary of callback hooks, for internal usage. Usage:: >>> import requests >>> req = requests.Request('GET', 'https://httpbin.org/get') >>> req.prepare() Nc Cs|dur gn|}|durgn|}|dur,in|}|durr>r?__init__s"zRequest.__init__cCs d|jS)Nzrur<r>r>r?__repr__szRequest.__repr__c Cs<t}|j|j|j|j|j|j|j|j|j |j |j d |S)zXConstructs a :class:`PreparedRequest ` for transmission and returns it.) rur7rQrYrHr0rvrwrxrk) PreparedRequestpreparerur7rQrYrHr0rvrwrxrkr<r=r>r>r?r~s zRequest.prepare) NNNNNNNNNN)r`rarb__doc__ryr|r~r>r>r>r?rss  rsc @seZdZdZddZdddZddZd d Zd d Ze d dZ ddZ ddZ dddZ ddZd ddZddZddZdS)!r}a)The fully mutable :class:`PreparedRequest ` object, containing the exact bytes that will be sent to the server. Instances are generated from a :class:`Request ` object, and should not be instantiated manually; doing so may produce undesirable effects. Usage:: >>> import requests >>> req = requests.Request('GET', 'https://httpbin.org/get') >>> r = req.prepare() >>> r >>> s = requests.Session() >>> s.send(r) cCs0d|_d|_d|_d|_d|_t|_d|_dSrf)rur7rQ_cookiesr^r rk_body_positionr{r>r>r?ry%szPreparedRequest.__init__Nc CsR||||||||||||| ||||| dS)z6Prepares the entire request with the given parameters.N)prepare_method prepare_urlprepare_headersprepare_cookies prepare_body prepare_auth prepare_hooks) r<rur7rQrYrHrvrwrxrkr0r>r>r?r~6s     zPreparedRequest.preparecCs d|jS)Nzrzr{r>r>r?r|HszPreparedRequest.__repr__cCsXt}|j|_|j|_|jdur*|jnd|_t|j|_|j|_|j|_|j |_ |Srf) r}rur7rQcopyrrr^rkrrr>r>r?rKs zPreparedRequest.copycCs$||_|jdur t|j|_dS)zPrepares the given HTTP method.N)rurupper)r<rur>r>r?rVs zPreparedRequest.prepare_methodcCs>ddl}z|j|ddd}Wn|jy8tYn0|S)NrT)Zuts46rC)idnarGrTZ IDNAError UnicodeError)hostrr>r>r?_get_idna_encoded_host\s  z&PreparedRequest._get_idna_encoded_hostc Cs,t|tr|d}ntr"t|nt|}|}d|vrR|dsR||_ dSzt |\}}}}}}} Wn.t y} zt | j WYd} ~ n d} ~ 00|sd} | t|d} t| |st d|t|sz||}Wntyt dYn0n|drt d|pd } | r.| d 7} | |7} |rL| dt|7} |sVd }trt|trr|d }t| tr| d } t|tr|d }t|tr|d }t| tr| d } t|ttfrt|}||} | r |rd || f}n| }tt|| |d|| g}||_ dS)zPrepares the given HTTP URL.utf8:httpNzDInvalid URL {0!r}: No schema supplied. Perhaps you meant http://{0}?z Invalid URL %r: No host suppliedzURL has an invalid label.*r6@r4rCz%s&%s)rEr+rTr,Zunicoder*lstriplower startswithr7rrrargsformatrrrrrrGrLrr')r<r7rvschemerwrportr8r:fragmenteerrornetlocZ enc_paramsr>r>r?rfsh                   zPreparedRequest.prepare_urlcCs<t|_|r8|D]"}t||\}}||jt|<qdS)z Prepares the given HTTP headers.N)r rQrtr#r)r<rQheaderrOvaluer>r>r?rs  zPreparedRequest.prepare_headersc Csnd}d}|s6|dur6d}t|}t|ts6|d}tt|dt|ttt t f g}|rz t |}Wnt t tfyd}Yn0|}t|dddurz||_Wnttfyt|_Yn0|rtd|rt||jd<n d|jd <np|r |||\}}n2|r>||}t|ts4t|d r:d}nd }|||rdd |jvrd||jd <||_dS)z"Prepares the given HTTP body data.Nzapplication/jsonrCrBtellz1Streamed bodies and files are mutually exclusive.Content-LengthZchunkedzTransfer-EncodingrAz!application/x-www-form-urlencodedz content-typez Content-Type) complexjsondumpsrEr+rGallrFr/rVrUr%r" TypeErrorAttributeErrorr getattrrrIOErrorOSErrorobjectNotImplementedErrorr.rQr_rLprepare_content_lengthr^)r<rHrYr0r^rRZ is_streamlengthr>r>r?rsL          zPreparedRequest.prepare_bodycCsL|dur$t|}|rHt||jd<n$|jdvrH|jddurHd|jd<dS)z>Prepare Content-Length header based on request method and bodyNr)ZGETZHEAD0)r"r.rQruget)r<r^rr>r>r?r s z&PreparedRequest.prepare_content_lengthr6cCsj|dur"t|j}t|r|nd}|rft|trDt|dkrDt|}||}|j|j| |j dS)z"Prepares the given HTTP auth data.NrM) rr7anyrErUrWr __dict__updaterr^)r<rwr7Zurl_authrr>r>r?rs zPreparedRequest.prepare_authcCs@t|tjr||_n t||_t|j|}|dur<||jd<dS)aPrepares the given HTTP cookie data. This function eventually generates a ``Cookie`` header from the given cookies using cookielib. Due to cookielib's design, the header will not be regenerated if it already exists, meaning this function can only be called once for the life of the :class:`PreparedRequest ` object. Any subsequent calls to ``prepare_cookies`` will have no actual effect, unless the "Cookie" header is removed beforehand. NZCookie)rEr&Z CookieJarrrrrQ)r<rxZ cookie_headerr>r>r?r/s   zPreparedRequest.prepare_cookiescCs&|pg}|D]}||||q dS)zPrepares the given hooks.N)rp)r<rkrnr>r>r?rCszPreparedRequest.prepare_hooks) NNNNNNNNNN)N)r6)r`rarbrryr~r|rrrdrrrrrrrrr>r>r>r?r}s"   V E r}c@seZdZdZgdZddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ eddZeddZeddZeddZeddZd2d!d"Zed d#fd$d%Zed&d'Zed(d)Zd*d+Zed,d-Zd.d/Zd0d1Zd#S)3ResponsezhThe :class:`Response ` object, which contains a server's response to an HTTP request. ) _content status_coderQr7historyencodingreasonrxelapsedrequestcCs^d|_d|_d|_d|_t|_d|_d|_d|_g|_ d|_ t i|_ t d|_d|_dS)NFr)r_content_consumed_nextrr rQrawr7rrrrrxdatetimeZ timedeltarrr{r>r>r?ryWs  zResponse.__init__cCs|Srfr>r{r>r>r? __enter__szResponse.__enter__cGs |dSrf)close)r<rr>r>r?__exit__szResponse.__exit__cs js jfddjDS)Ncsi|]}|t|dqSrf)r)rgattrr{r>r? rjz)Response.__getstate__..)rcontent __attrs__r{r>r{r? __getstate__szResponse.__getstate__cCs:|D]\}}t|||qt|ddt|dddS)NrTr)rtsetattr)r<staterOrr>r>r? __setstate__s zResponse.__setstate__cCs d|jS)Nz)rr{r>r>r?r|szResponse.__repr__cCs|jSakReturns True if :attr:`status_code` is less than 400. This attribute checks if the status code of the response is between 400 and 600 to see if there was a client error or a server error. If the status code, is between 200 and 400, this will return True. This is **not** a check to see if the response code is ``200 OK``. okr{r>r>r?__bool__szResponse.__bool__cCs|jSrrr{r>r>r? __nonzero__szResponse.__nonzero__cCs |dS)z,Allows you to use a response as an iterator.) iter_contentr{r>r>r?rBszResponse.__iter__cCs&z |Wnty YdS0dS)axReturns True if :attr:`status_code` is less than 400, False if not. This attribute checks if the status code of the response is between 400 and 600 to see if there was a client error or a server error. If the status code is between 200 and 400, this will return True. This is **not** a check to see if the response code is ``200 OK``. FT)raise_for_statusrr{r>r>r?rs   z Response.okcCsd|jvo|jtvS)zTrue if this Response is a well-formed HTTP redirect that could have been processed automatically (by :meth:`Session.resolve_redirects`). location)rQrREDIRECT_STATIr{r>r>r? is_redirectszResponse.is_redirectcCsd|jvo|jtjtjfvS)z@True if this Response one of the permanent versions of redirect.r)rQrr1Zmoved_permanentlypermanent_redirectr{r>r>r?is_permanent_redirectszResponse.is_permanent_redirectcCs|jS)zTReturns a PreparedRequest for the next request in a redirect chain, if there is one.)rr{r>r>r?nextsz Response.nextcCst|jdS)z7The apparent encoding, provided by the chardet library.r)r-Zdetectrr{r>r>r?apparent_encodingszResponse.apparent_encodingr Fcs|fdd}jr(tjtr(tn"durJttsJtdttj}|}jrf|n|}|rxt |}|S)aIterates over the response data. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. The chunk size is the number of bytes it should read into memory. This is not necessarily the length of each item returned as decoding can take place. chunk_size must be of type int or None. A value of None will function differently depending on the value of `stream`. stream=True will read data as it arrives in whatever size the chunks are received. If stream=False, data is returned as a single chunk. If decode_unicode is True, content will be decoded using the best available encoding based on the response. c 3stjdrz jjddD] }|VqWqtyX}zt|WYd}~qd}~0ty}zt|WYd}~qd}~0ty}zt|WYd}~qd}~00nj }|sq|Vqd_ dS)NstreamT)Zdecode_content) rFrrrrrrrrrAr)chunkr chunk_sizer<r>r?generates    z'Response.iter_content..generateNz.chunk_size must be an int, it is instead a %s.) rrErboolrintrtyper r)r<rdecode_unicoderZ reused_chunksZ stream_chunkschunksr>rr?rs  zResponse.iter_contentNccsd}|j||dD]n}|dur&||}|r6||}n|}|rl|drl|rl|dd|dkrl|}nd}|D] }|Vqtq|dur|VdS)zIterates over the response data, one line at a time. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. .. note:: This method is not reentrant safe. N)rr)rsplit splitlinespop)r<rrZ delimiterpendingrlinesliner>r>r? iter_liness $  zResponse.iter_linescCsV|jdurJ|jrtd|jdks,|jdur4d|_nd|tpFd|_d|_|jS)z"Content of the response, in bytes.Fz2The content for this response was already consumedrNrjT)rr RuntimeErrorrrr;rCONTENT_CHUNK_SIZEr{r>r>r?r2s zResponse.contentc Csfd}|j}|jstdS|jdur(|j}zt|j|dd}Wn$ttfy`t|jdd}Yn0|S)aContent of the response, in unicode. If Response.encoding is None, encoding will be guessed using ``chardet``. The encoding of the response content is determined based solely on HTTP headers, following RFC 2616 to the letter. If you can take advantage of non-HTTP knowledge to make a better guess at the encoding, you should set ``r.encoding`` appropriately before accessing this property. Nr6replace)errors)rrr*r LookupErrorr)r<rrr>r>r?textFs z Response.textcKsp|js\|jr\t|jdkr\t|j}|dur\ztj|j|fi|WStyZYn0tj|jfi|S)zReturns the json-encoded content of a response, if any. :param \*\*kwargs: Optional arguments that ``json.loads`` takes. :raises ValueError: If the response body does not contain valid json. rNN) rrrWr!rloadsrTUnicodeDecodeErrorr)r<kwargsrr>r>r?r0ls   z Response.jsoncCsF|jd}i}|rBt|}|D] }|dp6|d}|||<q |S)z8Returns the parsed header links of the response, if any.linkrelr7)rQrr)r<rllinksrkeyr>r>r?rs  zResponse.linkscCsd}t|jtrBz|jd}WqHty>|jd}YqH0n|j}d|jkr^dkrvnnd|j||jf}n,d|jkrdkrnnd|j||jf}|rt||d d S) z+Raises :class:`HTTPError`, if one occurred.r6rCz iso-8859-1iiz%s Client Error: %s for url: %siXz%s Server Error: %s for url: %s)ZresponseN)rErr+rTrrr7r)r<Zhttp_error_msgrr>r>r?rs  zResponse.raise_for_statuscCs0|js|jt|jdd}|dur,|dS)zReleases the connection back to the pool. Once this method has been called the underlying ``raw`` object must not be accessed again. *Note: Should not normally need to be called explicitly.* release_connN)rrrr)r<rr>r>r?rs  zResponse.close)r F)r`rarbrrryrrrrr|rrrBrcrrrrrrITER_CHUNK_SIZErrrr0rrrr>r>r>r?rMs@/        7  % r)RrrsysZencodings.idna encodingsZurllib3.fieldsrZurllib3.filepostrZ urllib3.utilrZurllib3.exceptionsrrrrior rkr Z structuresr rwr rxrrr exceptionsrrrrrrrZ_internal_utilsrrZutilsrrrrrrr r!r"r#compatr$r%r&r'r(r)r*r+r,r-r.r/r0rZ status_codesr1ZmovedfoundotherZtemporary_redirectrrZDEFAULT_REDIRECT_LIMITrrrr3rersr}rr>r>r>r?sD       $08  rJ?models.cpython-39.pyc000064400000056413151116515220010470 0ustar00a /h@sdZddlZddlZddlZddlmZddlmZddl m Z ddl m Z m Z mZmZddlmZdd lmZdd lmZdd lmZdd lmZmZmZdd lmZmZmZm Z m!Z!m"Z"m#Z#ddl$m%Z%m&Z&ddl'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1ddl2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;mZ>ddl2m?Z@ddlAmBZBeBjCeBjDeBjEeBjFeBjGfZHdZIdZJdZKGdddeLZMGdddeLZNGdddeNZOGdddeMeNZPGdddeLZQdS) z` requests.models ~~~~~~~~~~~~~~~ This module contains the primary objects that power Requests. N) RequestField)encode_multipart_formdata) parse_url) DecodeErrorReadTimeoutError ProtocolErrorLocationParseError)UnsupportedOperation) default_hooks)CaseInsensitiveDict) HTTPBasicAuth)cookiejar_from_dictget_cookie_header_copy_cookie_jar) HTTPError MissingSchema InvalidURLChunkedEncodingErrorContentDecodingErrorConnectionErrorStreamConsumedError)to_native_stringunicode_is_ascii) guess_filenameget_auth_from_url requote_uristream_decode_response_unicodeto_key_val_listparse_header_links iter_slicesguess_json_utf super_lencheck_header_validity) CallableMapping cookielib urlunparseurlsplit urlencodestrbytesis_py2chardet builtin_str basestring)json)codesi(ic@s0eZdZeddZeddZeddZdS)RequestEncodingMixincCsNg}t|j}|j}|sd}|||j}|rD|d||d|S)zBuild the path URL to use./?)r(urlpathappendqueryjoin)selfr7pr8r:r>3/usr/lib/python3.9/site-packages/requests/models.pypath_url=s    zRequestEncodingMixin.path_urlcCst|ttfr|St|dr |St|drg}t|D]j\}}t|tsRt|dsX|g}|D]B}|dur\|t|tr|dn|t|tr|dn|fq\q6t|ddS|SdS)zEncode parameters in a piece of data. Will successfully encode parameters when passed as a dict or a list of 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary if parameters are supplied as a dict. read__iter__Nutf-8T)doseq) isinstancer*r+hasattrrr/r9encoder))dataresultkZvsvr>r>r?_encode_paramsRs$    z#RequestEncodingMixin._encode_paramscCs|stdnt|tr tdg}t|p,i}t|p8i}|D]|\}}t|ts\t|dsb|g}|D]T}|durft|tst|}|t|tr|dn|t|tr| dn|fqfq@|D]\}}d}d} t|t t fr t |dkr|\} } n&t |dkr|\} } }n |\} } }} nt |p,|} |} t| tttfrJ| } n(t| dr`| } n| durnqn| } t|| | | d } | j|d || qt|\}}||fS) aBuild the body for a multipart/form-data request. Will successfully encode files when passed as a dict or a list of tuples. Order is retained if data is a list of tuples but arbitrary if parameters are supplied as a dict. The tuples may be 2-tuples (filename, fileobj), 3-tuples (filename, fileobj, contentype) or 4-tuples (filename, fileobj, contentype, custom_headers). zFiles must be provided.zData must not be a string.rBNrCrA)namerHfilenameheaders) content_type) ValueErrorrEr/rrFr+r*r9decoderGtuplelistlenr bytearrayrArZmake_multipartr)filesrHZ new_fieldsfieldsZfieldvalrKrJZftZfhfnfpZfdataZrfbodyrRr>r>r? _encode_filesmsT                 z"RequestEncodingMixin._encode_filesN)__name__ __module__ __qualname__propertyr@ staticmethodrLr_r>r>r>r?r3<s   r3c@seZdZddZddZdS)RequestHooksMixincCsZ||jvrtd|t|tr2|j||n$t|drV|j|dd|DdS)zProperly register a hook.z1Unsupported event specified, with event name "%s"rBcss|]}t|tr|VqdSN)rEr$).0hr>r>r? z2RequestHooksMixin.register_hook..N)hooksrSrEr$r9rFextendr<eventhookr>r>r? register_hooks     zRequestHooksMixin.register_hookcCs0z|j||WdSty*YdS0dS)ziDeregister a previously registered hook. Returns True if the hook existed, False if not. TFN)rkremoverSrmr>r>r?deregister_hooks  z!RequestHooksMixin.deregister_hookN)r`rarbrprrr>r>r>r?res rec @s*eZdZdZd ddZddZddZdS) Requesta{A user-created :class:`Request ` object. Used to prepare a :class:`PreparedRequest `, which is sent to the server. :param method: HTTP method to use. :param url: URL to send. :param headers: dictionary of headers to send. :param files: dictionary of {filename: fileobject} files to multipart upload. :param data: the body to attach to the request. If a dictionary or list of tuples ``[(key, value)]`` is provided, form-encoding will take place. :param json: json for the body to attach to the request (if files or data is not specified). :param params: URL parameters to append to the URL. If a dictionary or list of tuples ``[(key, value)]`` is provided, form-encoding will take place. :param auth: Auth handler or (user, pass) tuple. :param cookies: dictionary or CookieJar of cookies to attach to this request. :param hooks: dictionary of callback hooks, for internal usage. Usage:: >>> import requests >>> req = requests.Request('GET', 'https://httpbin.org/get') >>> req.prepare() Nc Cs|dur gn|}|durgn|}|dur,in|}|durr>r?__init__s"zRequest.__init__cCs d|jS)Nzrur<r>r>r?__repr__szRequest.__repr__c Cs<t}|j|j|j|j|j|j|j|j|j |j |j d |S)zXConstructs a :class:`PreparedRequest ` for transmission and returns it.) rur7rQrYrHr0rvrwrxrk) PreparedRequestpreparerur7rQrYrHr0rvrwrxrkr<r=r>r>r?r~s zRequest.prepare) NNNNNNNNNN)r`rarb__doc__ryr|r~r>r>r>r?rss  rsc @seZdZdZddZdddZddZd d Zd d Ze d dZ ddZ ddZ dddZ ddZd ddZddZddZdS)!r}a)The fully mutable :class:`PreparedRequest ` object, containing the exact bytes that will be sent to the server. Instances are generated from a :class:`Request ` object, and should not be instantiated manually; doing so may produce undesirable effects. Usage:: >>> import requests >>> req = requests.Request('GET', 'https://httpbin.org/get') >>> r = req.prepare() >>> r >>> s = requests.Session() >>> s.send(r) cCs0d|_d|_d|_d|_d|_t|_d|_dSrf)rur7rQ_cookiesr^r rk_body_positionr{r>r>r?ry%szPreparedRequest.__init__Nc CsR||||||||||||| ||||| dS)z6Prepares the entire request with the given parameters.N)prepare_method prepare_urlprepare_headersprepare_cookies prepare_body prepare_auth prepare_hooks) r<rur7rQrYrHrvrwrxrkr0r>r>r?r~6s     zPreparedRequest.preparecCs d|jS)Nzrzr{r>r>r?r|HszPreparedRequest.__repr__cCsXt}|j|_|j|_|jdur*|jnd|_t|j|_|j|_|j|_|j |_ |Srf) r}rur7rQcopyrrr^rkrrr>r>r?rKs zPreparedRequest.copycCs$||_|jdur t|j|_dS)zPrepares the given HTTP method.N)rurupper)r<rur>r>r?rVs zPreparedRequest.prepare_methodcCs>ddl}z|j|ddd}Wn|jy8tYn0|S)NrT)Zuts46rC)idnarGrTZ IDNAError UnicodeError)hostrr>r>r?_get_idna_encoded_host\s  z&PreparedRequest._get_idna_encoded_hostc Cs,t|tr|d}ntr"t|nt|}|}d|vrR|dsR||_ dSzt |\}}}}}}} Wn.t y} zt | j WYd} ~ n d} ~ 00|sd} | t|d} t| |st d|t|sz||}Wntyt dYn0n|drt d|pd } | r.| d 7} | |7} |rL| dt|7} |sVd }trt|trr|d }t| tr| d } t|tr|d }t|tr|d }t| tr| d } t|ttfrt|}||} | r |rd || f}n| }tt|| |d|| g}||_ dS)zPrepares the given HTTP URL.utf8:httpNzDInvalid URL {0!r}: No schema supplied. Perhaps you meant http://{0}?z Invalid URL %r: No host suppliedzURL has an invalid label.*r6@r4rCz%s&%s)rEr+rTr,Zunicoder*lstriplower startswithr7rrrargsformatrrrrrrGrLrr')r<r7rvschemerwrportr8r:fragmenteerrornetlocZ enc_paramsr>r>r?rfsh                   zPreparedRequest.prepare_urlcCs<t|_|r8|D]"}t||\}}||jt|<qdS)z Prepares the given HTTP headers.N)r rQrtr#r)r<rQheaderrOvaluer>r>r?rs  zPreparedRequest.prepare_headersc Csnd}d}|s6|dur6d}t|}t|ts6|d}tt|dt|ttt t f g}|rz t |}Wnt t tfyd}Yn0|}t|dddurz||_Wnttfyt|_Yn0|rtd|rt||jd<n d|jd <np|r |||\}}n2|r>||}t|ts4t|d r:d}nd }|||rdd |jvrd||jd <||_dS)z"Prepares the given HTTP body data.Nzapplication/jsonrCrBtellz1Streamed bodies and files are mutually exclusive.Content-LengthZchunkedzTransfer-EncodingrAz!application/x-www-form-urlencodedz content-typez Content-Type) complexjsondumpsrEr+rGallrFr/rVrUr%r" TypeErrorAttributeErrorr getattrrrIOErrorOSErrorobjectNotImplementedErrorr.rQr_rLprepare_content_lengthr^)r<rHrYr0r^rRZ is_streamlengthr>r>r?rsL          zPreparedRequest.prepare_bodycCsL|dur$t|}|rHt||jd<n$|jdvrH|jddurHd|jd<dS)z>Prepare Content-Length header based on request method and bodyNr)ZGETZHEAD0)r"r.rQruget)r<r^rr>r>r?r s z&PreparedRequest.prepare_content_lengthr6cCsj|dur"t|j}t|r|nd}|rft|trDt|dkrDt|}||}|j|j| |j dS)z"Prepares the given HTTP auth data.NrM) rr7anyrErUrWr __dict__updaterr^)r<rwr7Zurl_authrr>r>r?rs zPreparedRequest.prepare_authcCs@t|tjr||_n t||_t|j|}|dur<||jd<dS)aPrepares the given HTTP cookie data. This function eventually generates a ``Cookie`` header from the given cookies using cookielib. Due to cookielib's design, the header will not be regenerated if it already exists, meaning this function can only be called once for the life of the :class:`PreparedRequest ` object. Any subsequent calls to ``prepare_cookies`` will have no actual effect, unless the "Cookie" header is removed beforehand. NZCookie)rEr&Z CookieJarrrrrQ)r<rxZ cookie_headerr>r>r?r/s   zPreparedRequest.prepare_cookiescCs&|pg}|D]}||||q dS)zPrepares the given hooks.N)rp)r<rkrnr>r>r?rCszPreparedRequest.prepare_hooks) NNNNNNNNNN)N)r6)r`rarbrryr~r|rrrdrrrrrrrrr>r>r>r?r}s"   V E r}c@seZdZdZgdZddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ eddZeddZeddZeddZeddZd2d!d"Zed d#fd$d%Zed&d'Zed(d)Zd*d+Zed,d-Zd.d/Zd0d1Zd#S)3ResponsezhThe :class:`Response ` object, which contains a server's response to an HTTP request. ) _content status_coderQr7historyencodingreasonrxelapsedrequestcCs^d|_d|_d|_d|_t|_d|_d|_d|_g|_ d|_ t i|_ t d|_d|_dS)NFr)r_content_consumed_nextrr rQrawr7rrrrrxdatetimeZ timedeltarrr{r>r>r?ryWs  zResponse.__init__cCs|Srfr>r{r>r>r? __enter__szResponse.__enter__cGs |dSrf)close)r<rr>r>r?__exit__szResponse.__exit__cs js jfddjDS)Ncsi|]}|t|dqSrf)r)rgattrr{r>r? rjz)Response.__getstate__..)rcontent __attrs__r{r>r{r? __getstate__szResponse.__getstate__cCs:|D]\}}t|||qt|ddt|dddS)NrTr)rtsetattr)r<staterOrr>r>r? __setstate__s zResponse.__setstate__cCs d|jS)Nz)rr{r>r>r?r|szResponse.__repr__cCs|jSakReturns True if :attr:`status_code` is less than 400. This attribute checks if the status code of the response is between 400 and 600 to see if there was a client error or a server error. If the status code, is between 200 and 400, this will return True. This is **not** a check to see if the response code is ``200 OK``. okr{r>r>r?__bool__szResponse.__bool__cCs|jSrrr{r>r>r? __nonzero__szResponse.__nonzero__cCs |dS)z,Allows you to use a response as an iterator.) iter_contentr{r>r>r?rBszResponse.__iter__cCs&z |Wnty YdS0dS)axReturns True if :attr:`status_code` is less than 400, False if not. This attribute checks if the status code of the response is between 400 and 600 to see if there was a client error or a server error. If the status code is between 200 and 400, this will return True. This is **not** a check to see if the response code is ``200 OK``. FT)raise_for_statusrr{r>r>r?rs   z Response.okcCsd|jvo|jtvS)zTrue if this Response is a well-formed HTTP redirect that could have been processed automatically (by :meth:`Session.resolve_redirects`). location)rQrREDIRECT_STATIr{r>r>r? is_redirectszResponse.is_redirectcCsd|jvo|jtjtjfvS)z@True if this Response one of the permanent versions of redirect.r)rQrr1Zmoved_permanentlypermanent_redirectr{r>r>r?is_permanent_redirectszResponse.is_permanent_redirectcCs|jS)zTReturns a PreparedRequest for the next request in a redirect chain, if there is one.)rr{r>r>r?nextsz Response.nextcCst|jdS)z7The apparent encoding, provided by the chardet library.r)r-Zdetectrr{r>r>r?apparent_encodingszResponse.apparent_encodingr Fcs|fdd}jr(tjtr(tn"durJttsJtdttj}|}jrf|n|}|rxt |}|S)aIterates over the response data. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. The chunk size is the number of bytes it should read into memory. This is not necessarily the length of each item returned as decoding can take place. chunk_size must be of type int or None. A value of None will function differently depending on the value of `stream`. stream=True will read data as it arrives in whatever size the chunks are received. If stream=False, data is returned as a single chunk. If decode_unicode is True, content will be decoded using the best available encoding based on the response. c 3stjdrz jjddD] }|VqWqtyX}zt|WYd}~qd}~0ty}zt|WYd}~qd}~0ty}zt|WYd}~qd}~00nj }|sq|Vqd_ dS)NstreamT)Zdecode_content) rFrrrrrrrrrAr)chunkr chunk_sizer<r>r?generates    z'Response.iter_content..generateNz.chunk_size must be an int, it is instead a %s.) rrErboolrintrtyper r)r<rdecode_unicoderZ reused_chunksZ stream_chunkschunksr>rr?rs  zResponse.iter_contentNccsd}|j||dD]n}|dur&||}|r6||}n|}|rl|drl|rl|dd|dkrl|}nd}|D] }|Vqtq|dur|VdS)zIterates over the response data, one line at a time. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. .. note:: This method is not reentrant safe. N)rr)rsplit splitlinespop)r<rrZ delimiterpendingrlinesliner>r>r? iter_liness $  zResponse.iter_linescCsV|jdurJ|jrtd|jdks,|jdur4d|_nd|tpFd|_d|_|jS)z"Content of the response, in bytes.Fz2The content for this response was already consumedrNrjT)rr RuntimeErrorrrr;rCONTENT_CHUNK_SIZEr{r>r>r?r2s zResponse.contentc Csfd}|j}|jstdS|jdur(|j}zt|j|dd}Wn$ttfy`t|jdd}Yn0|S)aContent of the response, in unicode. If Response.encoding is None, encoding will be guessed using ``chardet``. The encoding of the response content is determined based solely on HTTP headers, following RFC 2616 to the letter. If you can take advantage of non-HTTP knowledge to make a better guess at the encoding, you should set ``r.encoding`` appropriately before accessing this property. Nr6replace)errors)rrr*r LookupErrorr)r<rrr>r>r?textFs z Response.textcKsp|js\|jr\t|jdkr\t|j}|dur\ztj|j|fi|WStyZYn0tj|jfi|S)zReturns the json-encoded content of a response, if any. :param \*\*kwargs: Optional arguments that ``json.loads`` takes. :raises ValueError: If the response body does not contain valid json. rNN) rrrWr!rloadsrTUnicodeDecodeErrorr)r<kwargsrr>r>r?r0ls   z Response.jsoncCsF|jd}i}|rBt|}|D] }|dp6|d}|||<q |S)z8Returns the parsed header links of the response, if any.linkrelr7)rQrr)r<rllinksrkeyr>r>r?rs  zResponse.linkscCsd}t|jtrBz|jd}WqHty>|jd}YqH0n|j}d|jkr^dkrvnnd|j||jf}n,d|jkrdkrnnd|j||jf}|rt||d d S) z+Raises :class:`HTTPError`, if one occurred.r6rCz iso-8859-1iiz%s Client Error: %s for url: %siXz%s Server Error: %s for url: %s)ZresponseN)rErr+rTrrr7r)r<Zhttp_error_msgrr>r>r?rs  zResponse.raise_for_statuscCs0|js|jt|jdd}|dur,|dS)zReleases the connection back to the pool. Once this method has been called the underlying ``raw`` object must not be accessed again. *Note: Should not normally need to be called explicitly.* release_connN)rrrr)r<rr>r>r?rs  zResponse.close)r F)r`rarbrrryrrrrr|rrrBrcrrrrrrITER_CHUNK_SIZErrrr0rrrr>r>r>r?rMs@/        7  % r)RrrsysZencodings.idna encodingsZurllib3.fieldsrZurllib3.filepostrZ urllib3.utilrZurllib3.exceptionsrrrrior rkr Z structuresr rwr rxrrr exceptionsrrrrrrrZ_internal_utilsrrZutilsrrrrrrr r!r"r#compatr$r%r&r'r(r)r*r+r,r-r.r/r0rZ status_codesr1ZmovedfoundotherZtemporary_redirectrrZDEFAULT_REDIRECT_LIMITrrrr3rersr}rr>r>r>r?sD       $08  rJ?sessions.cpython-39.opt-1.pyc000064400000046550151116515220012013 0ustar00a /hzv@sdZddlZddlZddlZddlmZddlmZddlm Z ddl m Z m Z m Z mZmZddlmZmZmZmZdd lmZmZmZdd lmZmZdd lmZdd lmZm Z m!Z!dd l"m#Z#m$Z$m%Z%m&Z&ddl'm(Z(ddl)m*Z*ddlm+Z+m,Z,m-Z-m.Z.m/Z/m0Z0ddl1m2Z2ddlm3Z3ej4dkrTz ej5Z6Wne7yPej8Z6Yn0nejZ6efddZ9efddZ:Gddde;ZdS)z requests.sessions ~~~~~~~~~~~~~~~~~ This module provides a Session object to manage and persist settings across requests (cookies, auth, proxies). N) timedelta) OrderedDict)_basic_auth_str) cookielibis_py3urljoinurlparseMapping)cookiejar_from_dictextract_cookies_to_jarRequestsCookieJar merge_cookies)RequestPreparedRequestDEFAULT_REDIRECT_LIMIT) default_hooks dispatch_hook)to_native_string)to_key_val_listdefault_headers DEFAULT_PORTS)TooManyRedirects InvalidSchemaChunkedEncodingErrorContentDecodingError)CaseInsensitiveDict) HTTPAdapter) requote_uriget_environ_proxiesget_netrc_authshould_bypass_proxiesget_auth_from_url rewind_body)codes)REDIRECT_STATIwin32cCsp|dur |S|dur|St|tr,t|ts0|S|t|}|t|dd|D}|D] }||=q`|S)zDetermines appropriate setting for a given request, taking into account the explicit setting on that request, and the setting in the session. If a setting is a dictionary, they will be merged together using `dict_class` NcSsg|]\}}|dur|qSN).0kvr(r(5/usr/lib/python3.9/site-packages/requests/sessions.py Jz!merge_setting..) isinstancer rupdateitems)Zrequest_settingZsession_setting dict_classZmerged_settingZ none_keyskeyr(r(r, merge_setting2s r4cCs@|dus|dgkr|S|dus0|dgkr4|St|||S)zProperly merges both requests and session hooks. This is necessary because when request_hooks == {'response': []}, the merge breaks Session hooks entirely. Nresponse)getr4)Z request_hooksZ session_hooksr2r(r(r, merge_hooksQs r7c@s>eZdZddZddZddd Zd d Zd d ZddZdS)SessionRedirectMixincCs,|jr(|jd}tr|d}t|dSdS)z7Receives a Response. Returns a redirect URI or ``None``locationlatin1utf8N)Z is_redirectheadersrencoder)selfrespr9r(r(r,get_redirect_targetbs    z(SessionRedirectMixin.get_redirect_targetcCst|}t|}|j|jkr dS|jdkrL|jdvrL|jdkrL|jdvrLdS|j|jk}|j|jk}t|jddf}|s|j|vr|j|vrdS|p|S)zFDecide whether Authorization header should be removed when redirectingThttp)PNhttps)iNFN)r hostnameschemeportrr6)r>Zold_urlZnew_urlZ old_parsedZ new_parsedZ changed_portZchanged_schemeZ default_portr(r(r,should_strip_authws$   z&SessionRedirectMixin.should_strip_authFNTc  ksFg} ||} t|jj} | rB|} | || dd|_z |jWn&tt t fyp|j j ddYn0t |j|jkrtd|j|d|| drt|j}dt|j| g} t| }|jd kr| r|j| d }n |jr|j} |} |jst|jt| } nt| } t| | _|| ||jtjtjfvrnd }|D]}| j !|dqRd| _"| j }|!d dt#| j$||j t%| j$|j&| '| j$|(| |}|)| || j*duod |vpd|v}|rt+| | }|r|Vq|j,|f|||||dd| }t#|j&| |j ||} |VqdS)zBReceives a Response. Returns a generator of Responses or Requests.rNF)Zdecode_contentzExceeded {} redirects.)r5z//:)fragment)Content-Lengthz Content-TypeTransfer-EncodingZCookierKrL)streamtimeoutverifycertproxiesallow_redirects)-r@r urlrJcopyappendhistorycontentrr RuntimeErrorrawreadlen max_redirectsrformatclose startswithjoinrrE_replacegeturlnetlocrrrebuild_method status_coder$Ztemporary_redirectZpermanent_redirectr<popbodyr Z_cookiesrcookiesZprepare_cookiesrebuild_proxies rebuild_authZ_body_positionr#send)r>r?reqrMrNrOrPrQyield_requestsZadapter_kwargsZhistrSZprevious_fragmentprepared_requestZ parsed_rurlparsedZpurged_headersheaderr<Z rewindabler(r(r,resolve_redirectss~               z&SessionRedirectMixin.resolve_redirectscCsR|j}|j}d|vr*||jj|r*|d=|jr8t|nd}|durN||dS)zWhen being redirected we may want to strip authentication from the request to avoid leaking credentials. This method intelligently removes and reapplies authentication where possible to avoid credential loss. Z AuthorizationN)r<rSrGrequest trust_envr Z prepare_auth)r>rnr5r<rSZnew_authr(r(r,rjsz!SessionRedirectMixin.rebuild_authc Cs|dur |ni}|j}|j}t|j}|}|d}t||d}|jr||s|t||d} | || d} | r|| || d|vr|d=zt ||\} } Wnt yd\} } Yn0| ds| r| rt | | |d<|S)aThis method re-evaluates the proxy configuration by considering the environment variables. If we are redirected to a URL covered by NO_PROXY, we strip the proxy configuration. Otherwise, we set missing proxy keys for this URL (in case they were stripped by a previous redirect). This method also replaces the Proxy-Authorization header where necessary. :rtype: dict Nno_proxyrtallzProxy-Authorization)NNrC)r<rSr rErTr6r!rsr setdefaultr"KeyErrorr_r) r>rnrQr<rSrEZ new_proxiesrtZ bypass_proxyZenviron_proxiesproxyusernamepasswordr(r(r,ris*        z$SessionRedirectMixin.rebuild_proxiescCsX|j}|jtjkr|dkrd}|jtjkr6|dkr6d}|jtjkrN|dkrNd}||_dS)zWhen being redirected we may want to change the method of the request based on certain specs or browser behavior. HEADGETPOSTN)methodrer$Z see_otherfoundZmoved)r>rnr5rr(r(r,rd<sz#SessionRedirectMixin.rebuild_method)FNTNNF) __name__ __module__ __qualname__r@rGrqrjrirdr(r(r(r,r8`s n+r8c@seZdZdZgdZddZddZddZd d Zd+d dZ ddZ ddZ ddZ d,ddZ d-ddZd.ddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd S)/SessionaA Requests session. Provides cookie persistence, connection-pooling, and configuration. Basic Usage:: >>> import requests >>> s = requests.Session() >>> s.get('https://httpbin.org/get') Or as a context manager:: >>> with requests.Session() as s: ... s.get('https://httpbin.org/get') ) r<rhauthrQhooksparamsrOrPadaptersrMrsr\cCsrt|_d|_i|_t|_i|_d|_d|_d|_ t |_ d|_ t i|_t|_|dt|dtdS)NFTzhttps://zhttp://)rr<rrQrrrrMrOrPrr\rsr rhrrmountrr>r(r(r,__init__ls  zSession.__init__cCs|Sr'r(rr(r(r, __enter__szSession.__enter__cGs |dSr')r^)r>argsr(r(r,__exit__szSession.__exit__c Cs|jpi}t|tjst|}ttt|j|}|j}|jrR|sR|jsRt |j }t }|j |j |j |j|j|jt|j|jtdt|j|jt||j|t|j|jd |S)aConstructs a :class:`PreparedRequest ` for transmission and returns it. The :class:`PreparedRequest` has settings merged from the :class:`Request ` instance and those of the :class:`Session`. :param request: :class:`Request` instance to prepare with this session's settings. :rtype: requests.PreparedRequest )r2) rrSfilesdatajsonr<rrrhr)rhr/rZ CookieJarr rr rrsr rSrZpreparerupperrrrr4r<rrr7r)r>rrrhZmerged_cookiesrpr(r(r,prepare_requests.       zSession.prepare_requestNTc Csxt|||||pi||pi||| d }||}| p8i} ||j| | ||}| | d}|||j|fi|}|S)ax Constructs a :class:`Request `, prepares it and sends it. Returns :class:`Response ` object. :param method: method for the new :class:`Request` object. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json to send in the body of the :class:`Request`. :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`. :param files: (optional) Dictionary of ``'filename': file-like-objects`` for multipart encoding upload. :param auth: (optional) Auth tuple or callable to enable Basic/Digest/Custom HTTP Auth. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple :param allow_redirects: (optional) Set to True by default. :type allow_redirects: bool :param proxies: (optional) Dictionary mapping protocol or protocol and hostname to the URL of the proxy. :param stream: (optional) whether to immediately download the response content. Defaults to ``False``. :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. Defaults to ``True``. When set to ``False``, requests will accept any TLS certificate presented by the server, and will ignore hostname mismatches and/or expired certificates, which will make your application vulnerable to man-in-the-middle (MitM) attacks. Setting verify to ``False`` may be useful during local development or testing. :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. :rtype: requests.Response ) rrSr<rrrrrrhr)rNrR)rrrmerge_environment_settingsrSr0rk)r>rrSrrr<rhrrrNrRrQrrMrOrPrrlZprepZsettingsZ send_kwargsr?r(r(r,rrs..   zSession.requestcKs |dd|jd|fi|S)zSends a GET request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response rRTr}rwrrr>rSkwargsr(r(r,r6$s z Session.getcKs |dd|jd|fi|S)zSends a OPTIONS request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response rRTZOPTIONSrrr(r(r,options/s zSession.optionscKs |dd|jd|fi|S)zSends a HEAD request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response rRFr|rrr(r(r,head:s z Session.headcKs|jd|f||d|S)aSends a POST request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response r~)rrrr)r>rSrrrr(r(r,postEs z Session.postcKs|jd|fd|i|S)auSends a PUT request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response ZPUTrrr>rSrrr(r(r,putRs z Session.putcKs|jd|fd|i|S)awSends a PATCH request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response ZPATCHrrrr(r(r,patch^s z Session.patchcKs|jd|fi|S)zSends a DELETE request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response ZDELETErrr(r(r,deletejszSession.deletec Ks|d|j|d|j|d|j|d|jt|trJtd|dd}| d}|j }|j |j d}t }|j|fi|}t |} t| d |_td ||fi|}|jr|jD]} t|j| j| jqt|j||j|r|j||fi|} d d | D} ng} | r8| d || }| |_|svz"t|j||fddi||_WntytYn0|s|j|S)zISend a given PreparedRequest. :rtype: requests.Response rMrOrPrQz#You can only send PreparedRequests.rRT)rS)Zsecondsr5cSsg|]}|qSr(r()r)r?r(r(r,r-r.z Session.send..rrm)rwrMrOrPrQr/r ValueErrorrfr6r get_adapterrSpreferred_clockrkrelapsedrrVr rhrrrYrqinsertnextZ_next StopIterationrW) r>rrrrRrMradapterstartrrr?genrVr(r(r,rktsF       "z Session.sendc Cs|jrn|dur|dnd}t||d}|D]\}} ||| q0|dusV|durntjdpltjd}t||j}t||j }t||j }t||j }||||dS)z^ Check the environment and merge it with some settings. :rtype: dict NrtruTZREQUESTS_CA_BUNDLEZCURL_CA_BUNDLE)rOrQrMrP) rsr6rr1rwosenvironr4rQrMrOrP) r>rSrQrMrOrPrtZ env_proxiesr*r+r(r(r,rs        z"Session.merge_environment_settingscCs@|jD]"\}}||r |Sq td|dS)z~ Returns the appropriate connection adapter for the given URL. :rtype: requests.adapters.BaseAdapter z*No connection adapters were found for {!r}N)rr1lowerr_rr])r>rSprefixrr(r(r,rs zSession.get_adaptercCs|jD] }|q dS)z+Closes all adapters and as such the sessionN)rvaluesr^)r>r+r(r(r,r^sz Session.closecs>||j<fdd|jD}|D]}|j||j|<q"dS)zwRegisters a connection adapter to a prefix. Adapters are sorted in descending order by prefix length. cs g|]}t|tkr|qSr()r[)r)r*rr(r,r-r.z!Session.mount..N)rrf)r>rrZ keys_to_mover3r(rr,rs z Session.mountcsfddjD}|S)Ncsi|]}|t|dqSr')getattr)r)attrrr(r, r.z(Session.__getstate__..) __attrs__)r>stater(rr, __getstate__szSession.__getstate__cCs"|D]\}}t|||qdSr')r1setattr)r>rrvaluer(r(r, __setstate__szSession.__setstate__)NNNNNNNTNNNNNN)NN)N)N)rrr__doc__rrrrrrrr6rrrrrrrkrrr^rrrr(r(r(r,rSs0>) L    K rcCstS)aZ Returns a :class:`Session` for context-management. .. deprecated:: 1.0.0 This method has been deprecated since version 1.0.0 and is only kept for backwards compatibility. New code should use :class:`~requests.sessions.Session` to create a session. This may be removed at a future date. :rtype: Session )rr(r(r(r,sessions r)?rrsystimeZdatetimer collectionsrrrcompatrrrr r rhr r r rZmodelsrrrrrrZ_internal_utilsrZutilsrrr exceptionsrrrrZ structuresrrrrrr r!r"r#Z status_codesr$r%platform perf_counterrAttributeErrorZclockr4r7objectr8rrr(r(r(r,sB             t3sessions.cpython-39.pyc000064400000046550151116515220011054 0ustar00a /hzv@sdZddlZddlZddlZddlmZddlmZddlm Z ddl m Z m Z m Z mZmZddlmZmZmZmZdd lmZmZmZdd lmZmZdd lmZdd lmZm Z m!Z!dd l"m#Z#m$Z$m%Z%m&Z&ddl'm(Z(ddl)m*Z*ddlm+Z+m,Z,m-Z-m.Z.m/Z/m0Z0ddl1m2Z2ddlm3Z3ej4dkrTz ej5Z6Wne7yPej8Z6Yn0nejZ6efddZ9efddZ:Gddde;ZdS)z requests.sessions ~~~~~~~~~~~~~~~~~ This module provides a Session object to manage and persist settings across requests (cookies, auth, proxies). N) timedelta) OrderedDict)_basic_auth_str) cookielibis_py3urljoinurlparseMapping)cookiejar_from_dictextract_cookies_to_jarRequestsCookieJar merge_cookies)RequestPreparedRequestDEFAULT_REDIRECT_LIMIT) default_hooks dispatch_hook)to_native_string)to_key_val_listdefault_headers DEFAULT_PORTS)TooManyRedirects InvalidSchemaChunkedEncodingErrorContentDecodingError)CaseInsensitiveDict) HTTPAdapter) requote_uriget_environ_proxiesget_netrc_authshould_bypass_proxiesget_auth_from_url rewind_body)codes)REDIRECT_STATIwin32cCsp|dur |S|dur|St|tr,t|ts0|S|t|}|t|dd|D}|D] }||=q`|S)zDetermines appropriate setting for a given request, taking into account the explicit setting on that request, and the setting in the session. If a setting is a dictionary, they will be merged together using `dict_class` NcSsg|]\}}|dur|qSN).0kvr(r(5/usr/lib/python3.9/site-packages/requests/sessions.py Jz!merge_setting..) isinstancer rupdateitems)Zrequest_settingZsession_setting dict_classZmerged_settingZ none_keyskeyr(r(r, merge_setting2s r4cCs@|dus|dgkr|S|dus0|dgkr4|St|||S)zProperly merges both requests and session hooks. This is necessary because when request_hooks == {'response': []}, the merge breaks Session hooks entirely. Nresponse)getr4)Z request_hooksZ session_hooksr2r(r(r, merge_hooksQs r7c@s>eZdZddZddZddd Zd d Zd d ZddZdS)SessionRedirectMixincCs,|jr(|jd}tr|d}t|dSdS)z7Receives a Response. Returns a redirect URI or ``None``locationlatin1utf8N)Z is_redirectheadersrencoder)selfrespr9r(r(r,get_redirect_targetbs    z(SessionRedirectMixin.get_redirect_targetcCst|}t|}|j|jkr dS|jdkrL|jdvrL|jdkrL|jdvrLdS|j|jk}|j|jk}t|jddf}|s|j|vr|j|vrdS|p|S)zFDecide whether Authorization header should be removed when redirectingThttp)PNhttps)iNFN)r hostnameschemeportrr6)r>Zold_urlZnew_urlZ old_parsedZ new_parsedZ changed_portZchanged_schemeZ default_portr(r(r,should_strip_authws$   z&SessionRedirectMixin.should_strip_authFNTc  ksFg} ||} t|jj} | rB|} | || dd|_z |jWn&tt t fyp|j j ddYn0t |j|jkrtd|j|d|| drt|j}dt|j| g} t| }|jd kr| r|j| d }n |jr|j} |} |jst|jt| } nt| } t| | _|| ||jtjtjfvrnd }|D]}| j !|dqRd| _"| j }|!d dt#| j$||j t%| j$|j&| '| j$|(| |}|)| || j*duod |vpd|v}|rt+| | }|r|Vq|j,|f|||||dd| }t#|j&| |j ||} |VqdS)zBReceives a Response. Returns a generator of Responses or Requests.rNF)Zdecode_contentzExceeded {} redirects.)r5z//:)fragment)Content-Lengthz Content-TypeTransfer-EncodingZCookierKrL)streamtimeoutverifycertproxiesallow_redirects)-r@r urlrJcopyappendhistorycontentrr RuntimeErrorrawreadlen max_redirectsrformatclose startswithjoinrrE_replacegeturlnetlocrrrebuild_method status_coder$Ztemporary_redirectZpermanent_redirectr<popbodyr Z_cookiesrcookiesZprepare_cookiesrebuild_proxies rebuild_authZ_body_positionr#send)r>r?reqrMrNrOrPrQyield_requestsZadapter_kwargsZhistrSZprevious_fragmentprepared_requestZ parsed_rurlparsedZpurged_headersheaderr<Z rewindabler(r(r,resolve_redirectss~               z&SessionRedirectMixin.resolve_redirectscCsR|j}|j}d|vr*||jj|r*|d=|jr8t|nd}|durN||dS)zWhen being redirected we may want to strip authentication from the request to avoid leaking credentials. This method intelligently removes and reapplies authentication where possible to avoid credential loss. Z AuthorizationN)r<rSrGrequest trust_envr Z prepare_auth)r>rnr5r<rSZnew_authr(r(r,rjsz!SessionRedirectMixin.rebuild_authc Cs|dur |ni}|j}|j}t|j}|}|d}t||d}|jr||s|t||d} | || d} | r|| || d|vr|d=zt ||\} } Wnt yd\} } Yn0| ds| r| rt | | |d<|S)aThis method re-evaluates the proxy configuration by considering the environment variables. If we are redirected to a URL covered by NO_PROXY, we strip the proxy configuration. Otherwise, we set missing proxy keys for this URL (in case they were stripped by a previous redirect). This method also replaces the Proxy-Authorization header where necessary. :rtype: dict Nno_proxyrtallzProxy-Authorization)NNrC)r<rSr rErTr6r!rsr setdefaultr"KeyErrorr_r) r>rnrQr<rSrEZ new_proxiesrtZ bypass_proxyZenviron_proxiesproxyusernamepasswordr(r(r,ris*        z$SessionRedirectMixin.rebuild_proxiescCsX|j}|jtjkr|dkrd}|jtjkr6|dkr6d}|jtjkrN|dkrNd}||_dS)zWhen being redirected we may want to change the method of the request based on certain specs or browser behavior. HEADGETPOSTN)methodrer$Z see_otherfoundZmoved)r>rnr5rr(r(r,rd<sz#SessionRedirectMixin.rebuild_method)FNTNNF) __name__ __module__ __qualname__r@rGrqrjrirdr(r(r(r,r8`s n+r8c@seZdZdZgdZddZddZddZd d Zd+d dZ ddZ ddZ ddZ d,ddZ d-ddZd.ddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd S)/SessionaA Requests session. Provides cookie persistence, connection-pooling, and configuration. Basic Usage:: >>> import requests >>> s = requests.Session() >>> s.get('https://httpbin.org/get') Or as a context manager:: >>> with requests.Session() as s: ... s.get('https://httpbin.org/get') ) r<rhauthrQhooksparamsrOrPadaptersrMrsr\cCsrt|_d|_i|_t|_i|_d|_d|_d|_ t |_ d|_ t i|_t|_|dt|dtdS)NFTzhttps://zhttp://)rr<rrQrrrrMrOrPrr\rsr rhrrmountrr>r(r(r,__init__ls  zSession.__init__cCs|Sr'r(rr(r(r, __enter__szSession.__enter__cGs |dSr')r^)r>argsr(r(r,__exit__szSession.__exit__c Cs|jpi}t|tjst|}ttt|j|}|j}|jrR|sR|jsRt |j }t }|j |j |j |j|j|jt|j|jtdt|j|jt||j|t|j|jd |S)aConstructs a :class:`PreparedRequest ` for transmission and returns it. The :class:`PreparedRequest` has settings merged from the :class:`Request ` instance and those of the :class:`Session`. :param request: :class:`Request` instance to prepare with this session's settings. :rtype: requests.PreparedRequest )r2) rrSfilesdatajsonr<rrrhr)rhr/rZ CookieJarr rr rrsr rSrZpreparerupperrrrr4r<rrr7r)r>rrrhZmerged_cookiesrpr(r(r,prepare_requests.       zSession.prepare_requestNTc Csxt|||||pi||pi||| d }||}| p8i} ||j| | ||}| | d}|||j|fi|}|S)ax Constructs a :class:`Request `, prepares it and sends it. Returns :class:`Response ` object. :param method: method for the new :class:`Request` object. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json to send in the body of the :class:`Request`. :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`. :param files: (optional) Dictionary of ``'filename': file-like-objects`` for multipart encoding upload. :param auth: (optional) Auth tuple or callable to enable Basic/Digest/Custom HTTP Auth. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple :param allow_redirects: (optional) Set to True by default. :type allow_redirects: bool :param proxies: (optional) Dictionary mapping protocol or protocol and hostname to the URL of the proxy. :param stream: (optional) whether to immediately download the response content. Defaults to ``False``. :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. Defaults to ``True``. When set to ``False``, requests will accept any TLS certificate presented by the server, and will ignore hostname mismatches and/or expired certificates, which will make your application vulnerable to man-in-the-middle (MitM) attacks. Setting verify to ``False`` may be useful during local development or testing. :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. :rtype: requests.Response ) rrSr<rrrrrrhr)rNrR)rrrmerge_environment_settingsrSr0rk)r>rrSrrr<rhrrrNrRrQrrMrOrPrrlZprepZsettingsZ send_kwargsr?r(r(r,rrs..   zSession.requestcKs |dd|jd|fi|S)zSends a GET request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response rRTr}rwrrr>rSkwargsr(r(r,r6$s z Session.getcKs |dd|jd|fi|S)zSends a OPTIONS request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response rRTZOPTIONSrrr(r(r,options/s zSession.optionscKs |dd|jd|fi|S)zSends a HEAD request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response rRFr|rrr(r(r,head:s z Session.headcKs|jd|f||d|S)aSends a POST request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response r~)rrrr)r>rSrrrr(r(r,postEs z Session.postcKs|jd|fd|i|S)auSends a PUT request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response ZPUTrrr>rSrrr(r(r,putRs z Session.putcKs|jd|fd|i|S)awSends a PATCH request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response ZPATCHrrrr(r(r,patch^s z Session.patchcKs|jd|fi|S)zSends a DELETE request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response ZDELETErrr(r(r,deletejszSession.deletec Ks|d|j|d|j|d|j|d|jt|trJtd|dd}| d}|j }|j |j d}t }|j|fi|}t |} t| d |_td ||fi|}|jr|jD]} t|j| j| jqt|j||j|r|j||fi|} d d | D} ng} | r8| d || }| |_|svz"t|j||fddi||_WntytYn0|s|j|S)zISend a given PreparedRequest. :rtype: requests.Response rMrOrPrQz#You can only send PreparedRequests.rRT)rS)Zsecondsr5cSsg|]}|qSr(r()r)r?r(r(r,r-r.z Session.send..rrm)rwrMrOrPrQr/r ValueErrorrfr6r get_adapterrSpreferred_clockrkrelapsedrrVr rhrrrYrqinsertnextZ_next StopIterationrW) r>rrrrRrMradapterstartrrr?genrVr(r(r,rktsF       "z Session.sendc Cs|jrn|dur|dnd}t||d}|D]\}} ||| q0|dusV|durntjdpltjd}t||j}t||j }t||j }t||j }||||dS)z^ Check the environment and merge it with some settings. :rtype: dict NrtruTZREQUESTS_CA_BUNDLEZCURL_CA_BUNDLE)rOrQrMrP) rsr6rr1rwosenvironr4rQrMrOrP) r>rSrQrMrOrPrtZ env_proxiesr*r+r(r(r,rs        z"Session.merge_environment_settingscCs@|jD]"\}}||r |Sq td|dS)z~ Returns the appropriate connection adapter for the given URL. :rtype: requests.adapters.BaseAdapter z*No connection adapters were found for {!r}N)rr1lowerr_rr])r>rSprefixrr(r(r,rs zSession.get_adaptercCs|jD] }|q dS)z+Closes all adapters and as such the sessionN)rvaluesr^)r>r+r(r(r,r^sz Session.closecs>||j<fdd|jD}|D]}|j||j|<q"dS)zwRegisters a connection adapter to a prefix. Adapters are sorted in descending order by prefix length. cs g|]}t|tkr|qSr()r[)r)r*rr(r,r-r.z!Session.mount..N)rrf)r>rrZ keys_to_mover3r(rr,rs z Session.mountcsfddjD}|S)Ncsi|]}|t|dqSr')getattr)r)attrrr(r, r.z(Session.__getstate__..) __attrs__)r>stater(rr, __getstate__szSession.__getstate__cCs"|D]\}}t|||qdSr')r1setattr)r>rrvaluer(r(r, __setstate__szSession.__setstate__)NNNNNNNTNNNNNN)NN)N)N)rrr__doc__rrrrrrrr6rrrrrrrkrrr^rrrr(r(r(r,rSs0>) L    K rcCstS)aZ Returns a :class:`Session` for context-management. .. deprecated:: 1.0.0 This method has been deprecated since version 1.0.0 and is only kept for backwards compatibility. New code should use :class:`~requests.sessions.Session` to create a session. This may be removed at a future date. :rtype: Session )rr(r(r(r,sessions r)?rrsystimeZdatetimer collectionsrrrcompatrrrr r rhr r r rZmodelsrrrrrrZ_internal_utilsrZutilsrrr exceptionsrrrrZ structuresrrrrrr r!r"r#Z status_codesr$r%platform perf_counterrAttributeErrorZclockr4r7objectr8rrr(r(r(r,sB             t3status_codes.cpython-39.opt-1.pyc000064400000010137151116515220012635 0ustar00a /h\E@sdaddlmZddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDdEdFdGDZedHdIZdJdKZedLS)Ma The ``codes`` object defines a mapping from common names for HTTP statuses to their numerical codes, accessible either as attributes or as dictionary items. Example:: >>> import requests >>> requests.codes['temporary_redirect'] 307 >>> requests.codes.teapot 418 >>> requests.codes['\o/'] 200 Some codes have multiple names, and both upper- and lower-case versions of the names are allowed. For example, ``codes.ok``, ``codes.OK``, and ``codes.okay`` all correspond to the HTTP status code 200. ) LookupDict)continue)Zswitching_protocols)Z processing)Z checkpoint)Z uri_too_longZrequest_uri_too_long)okZokayZall_okZall_okayZall_goodz\o/u✓)Zcreated)Zaccepted)Znon_authoritative_infoZnon_authoritative_information)Z no_content)Z reset_contentreset)Zpartial_contentpartial)Z multi_statusZmultiple_statusZ multi_statiZmultiple_stati)Zalready_reported)Zim_used)Zmultiple_choices)Zmoved_permanentlyZmovedz\o-)found)Z see_otherother)Z not_modified)Z use_proxy)Z switch_proxy)Ztemporary_redirectZtemporary_movedZ temporary)Zpermanent_redirectZresume_incompleteZresume)Z bad_requestZbad)Z unauthorized)Zpayment_requiredZpayment)Z forbidden)Z not_foundz-o-)Zmethod_not_allowedZ not_allowed)Znot_acceptable)Zproxy_authentication_requiredZ proxy_authZproxy_authentication)Zrequest_timeouttimeout)Zconflict)Zgone)Zlength_required)Zprecondition_failed precondition)Zrequest_entity_too_large)Zrequest_uri_too_large)Zunsupported_media_typeZunsupported_mediaZ media_type)Zrequested_range_not_satisfiableZrequested_rangeZrange_not_satisfiable)Zexpectation_failed)Z im_a_teapotZteapotZ i_am_a_teapot)Zmisdirected_request)Zunprocessable_entityZ unprocessable)locked)Zfailed_dependencyZ dependency)Zunordered_collectionZ unordered)Zupgrade_requiredZupgrade)Zprecondition_requiredr )Ztoo_many_requestsZtoo_many)Zheader_fields_too_largeZfields_too_large)Z no_responseZnone)Z retry_withZretry)Z$blocked_by_windows_parental_controlsZparental_controls)Zunavailable_for_legal_reasonsZ legal_reasons)Zclient_closed_request)Zinternal_server_errorZ server_errorz/o\u✗)Znot_implemented)Z bad_gateway)Zservice_unavailableZ unavailable)Zgateway_timeout)Zhttp_version_not_supportedZ http_version)Zvariant_also_negotiates)Zinsufficient_storage)Zbandwidth_limit_exceededZ bandwidth)Z not_extended)Znetwork_authentication_requiredZ network_authZnetwork_authentication)Ddefgzi,i-i.i/i0i1i2i3i4iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiZ status_codes)namecs~tD]8\}}|D]*}tt|||dstt||qqddtdurvtddfddttDndadS)N)\/cSs$dddt|D}d||fS)Nz, css|]}d|VqdS)z``%s``N).0nrr9/usr/lib/python3.9/site-packages/requests/status_codes.py sz%_init..doc..z* %d: %s)join_codes)codenamesrrr!docrsz_init..doc c3s|]}|VqdS)Nr)rr&r(rr!r"xr#z_init..) r%itemssetattrcodes startswithupper__doc__r$sorted)r&Ztitlestitlerr*r!_initks  r3N)r0Z structuresrr%r-r3rrrr!s P status_codes.cpython-39.pyc000064400000010137151116515220011676 0ustar00a /h\E@sdaddlmZddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDdEdFdGDZedHdIZdJdKZedLS)Ma The ``codes`` object defines a mapping from common names for HTTP statuses to their numerical codes, accessible either as attributes or as dictionary items. Example:: >>> import requests >>> requests.codes['temporary_redirect'] 307 >>> requests.codes.teapot 418 >>> requests.codes['\o/'] 200 Some codes have multiple names, and both upper- and lower-case versions of the names are allowed. For example, ``codes.ok``, ``codes.OK``, and ``codes.okay`` all correspond to the HTTP status code 200. ) LookupDict)continue)Zswitching_protocols)Z processing)Z checkpoint)Z uri_too_longZrequest_uri_too_long)okZokayZall_okZall_okayZall_goodz\o/u✓)Zcreated)Zaccepted)Znon_authoritative_infoZnon_authoritative_information)Z no_content)Z reset_contentreset)Zpartial_contentpartial)Z multi_statusZmultiple_statusZ multi_statiZmultiple_stati)Zalready_reported)Zim_used)Zmultiple_choices)Zmoved_permanentlyZmovedz\o-)found)Z see_otherother)Z not_modified)Z use_proxy)Z switch_proxy)Ztemporary_redirectZtemporary_movedZ temporary)Zpermanent_redirectZresume_incompleteZresume)Z bad_requestZbad)Z unauthorized)Zpayment_requiredZpayment)Z forbidden)Z not_foundz-o-)Zmethod_not_allowedZ not_allowed)Znot_acceptable)Zproxy_authentication_requiredZ proxy_authZproxy_authentication)Zrequest_timeouttimeout)Zconflict)Zgone)Zlength_required)Zprecondition_failed precondition)Zrequest_entity_too_large)Zrequest_uri_too_large)Zunsupported_media_typeZunsupported_mediaZ media_type)Zrequested_range_not_satisfiableZrequested_rangeZrange_not_satisfiable)Zexpectation_failed)Z im_a_teapotZteapotZ i_am_a_teapot)Zmisdirected_request)Zunprocessable_entityZ unprocessable)locked)Zfailed_dependencyZ dependency)Zunordered_collectionZ unordered)Zupgrade_requiredZupgrade)Zprecondition_requiredr )Ztoo_many_requestsZtoo_many)Zheader_fields_too_largeZfields_too_large)Z no_responseZnone)Z retry_withZretry)Z$blocked_by_windows_parental_controlsZparental_controls)Zunavailable_for_legal_reasonsZ legal_reasons)Zclient_closed_request)Zinternal_server_errorZ server_errorz/o\u✗)Znot_implemented)Z bad_gateway)Zservice_unavailableZ unavailable)Zgateway_timeout)Zhttp_version_not_supportedZ http_version)Zvariant_also_negotiates)Zinsufficient_storage)Zbandwidth_limit_exceededZ bandwidth)Z not_extended)Znetwork_authentication_requiredZ network_authZnetwork_authentication)Ddefgzi,i-i.i/i0i1i2i3i4iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiZ status_codes)namecs~tD]8\}}|D]*}tt|||dstt||qqddtdurvtddfddttDndadS)N)\/cSs$dddt|D}d||fS)Nz, css|]}d|VqdS)z``%s``N).0nrr9/usr/lib/python3.9/site-packages/requests/status_codes.py sz%_init..doc..z* %d: %s)join_codes)codenamesrrr!docrsz_init..doc c3s|]}|VqdS)Nr)rr&r(rr!r"xr#z_init..) r%itemssetattrcodes startswithupper__doc__r$sorted)r&Ztitlestitlerr*r!_initks  r3N)r0Z structuresrr%r-r3rrrr!s P structures.cpython-39.opt-1.pyc000064400000010474151116515220012364 0ustar00a /h @sDdZddlmZddlmZmZGdddeZGdddeZd S) zO requests.structures ~~~~~~~~~~~~~~~~~~~ Data structures that power Requests. ) OrderedDict)MappingMutableMappingc@sbeZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ dS)CaseInsensitiveDictaA case-insensitive ``dict``-like object. Implements all methods and operations of ``MutableMapping`` as well as dict's ``copy``. Also provides ``lower_items``. All keys are expected to be strings. The structure remembers the case of the last key to be set, and ``iter(instance)``, ``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()`` will contain case-sensitive keys. However, querying and contains testing is case insensitive:: cid = CaseInsensitiveDict() cid['Accept'] = 'application/json' cid['aCCEPT'] == 'application/json' # True list(cid) == ['Accept'] # True For example, ``headers['content-encoding']`` will return the value of a ``'Content-Encoding'`` response header, regardless of how the header name was originally stored. If the constructor, ``.update``, or equality comparison operations are given keys that have equal ``.lower()``s, the behavior is undefined. NcKs*t|_|duri}|j|fi|dSN)r_storeupdate)selfdatakwargsr 7/usr/lib/python3.9/site-packages/requests/structures.py__init__*szCaseInsensitiveDict.__init__cCs||f|j|<dSrrlower)r keyvaluer r r __setitem__0szCaseInsensitiveDict.__setitem__cCs|j|dS)Nrrr rr r r __getitem__5szCaseInsensitiveDict.__getitem__cCs|j|=dSrrrr r r __delitem__8szCaseInsensitiveDict.__delitem__cCsdd|jDS)Ncss|]\}}|VqdSrr ).0ZcasedkeyZ mappedvaluer r r <z/CaseInsensitiveDict.__iter__..)rvaluesr r r r__iter__;szCaseInsensitiveDict.__iter__cCs t|jSr)lenrrr r r__len__>szCaseInsensitiveDict.__len__cCsdd|jDS)z.Like iteritems(), but with all lowercase keys.css|]\}}||dfVqdS)rNr )rZlowerkeyZkeyvalr r rrCsz2CaseInsensitiveDict.lower_items..)ritemsrr r r lower_itemsAszCaseInsensitiveDict.lower_itemscCs0t|trt|}ntSt|t|kSr) isinstancerrNotImplementeddictr!)r otherr r r__eq__Is  zCaseInsensitiveDict.__eq__cCst|jSr)rrrrr r rcopyRszCaseInsensitiveDict.copycCstt|Sr)strr$r rr r r__repr__UszCaseInsensitiveDict.__repr__)N)__name__ __module__ __qualname____doc__rrrrrrr!r&r'r)r r r rrs  rcs<eZdZdZd fdd ZddZddZd d d ZZS) LookupDictzDictionary lookup object.Ncs||_tt|dSr)namesuperr.r)r r/ __class__r rr\szLookupDict.__init__cCs d|jS)Nz )r/rr r rr)`szLookupDict.__repr__cCs|j|dSr__dict__getrr r rrcszLookupDict.__getitem__cCs|j||Srr3)r rdefaultr r rr5hszLookupDict.get)N)N) r*r+r,r-rr)rr5 __classcell__r r r1rr.Ys r.N) r- collectionsrcompatrrrr$r.r r r rs Jstructures.cpython-39.pyc000064400000010474151116515220011425 0ustar00a /h @sDdZddlmZddlmZmZGdddeZGdddeZd S) zO requests.structures ~~~~~~~~~~~~~~~~~~~ Data structures that power Requests. ) OrderedDict)MappingMutableMappingc@sbeZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ dS)CaseInsensitiveDictaA case-insensitive ``dict``-like object. Implements all methods and operations of ``MutableMapping`` as well as dict's ``copy``. Also provides ``lower_items``. All keys are expected to be strings. The structure remembers the case of the last key to be set, and ``iter(instance)``, ``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()`` will contain case-sensitive keys. However, querying and contains testing is case insensitive:: cid = CaseInsensitiveDict() cid['Accept'] = 'application/json' cid['aCCEPT'] == 'application/json' # True list(cid) == ['Accept'] # True For example, ``headers['content-encoding']`` will return the value of a ``'Content-Encoding'`` response header, regardless of how the header name was originally stored. If the constructor, ``.update``, or equality comparison operations are given keys that have equal ``.lower()``s, the behavior is undefined. NcKs*t|_|duri}|j|fi|dSN)r_storeupdate)selfdatakwargsr 7/usr/lib/python3.9/site-packages/requests/structures.py__init__*szCaseInsensitiveDict.__init__cCs||f|j|<dSrrlower)r keyvaluer r r __setitem__0szCaseInsensitiveDict.__setitem__cCs|j|dS)Nrrr rr r r __getitem__5szCaseInsensitiveDict.__getitem__cCs|j|=dSrrrr r r __delitem__8szCaseInsensitiveDict.__delitem__cCsdd|jDS)Ncss|]\}}|VqdSrr ).0ZcasedkeyZ mappedvaluer r r <z/CaseInsensitiveDict.__iter__..)rvaluesr r r r__iter__;szCaseInsensitiveDict.__iter__cCs t|jSr)lenrrr r r__len__>szCaseInsensitiveDict.__len__cCsdd|jDS)z.Like iteritems(), but with all lowercase keys.css|]\}}||dfVqdS)rNr )rZlowerkeyZkeyvalr r rrCsz2CaseInsensitiveDict.lower_items..)ritemsrr r r lower_itemsAszCaseInsensitiveDict.lower_itemscCs0t|trt|}ntSt|t|kSr) isinstancerrNotImplementeddictr!)r otherr r r__eq__Is  zCaseInsensitiveDict.__eq__cCst|jSr)rrrrr r rcopyRszCaseInsensitiveDict.copycCstt|Sr)strr$r rr r r__repr__UszCaseInsensitiveDict.__repr__)N)__name__ __module__ __qualname____doc__rrrrrrr!r&r'r)r r r rrs  rcs<eZdZdZd fdd ZddZddZd d d ZZS) LookupDictzDictionary lookup object.Ncs||_tt|dSr)namesuperr.r)r r/ __class__r rr\szLookupDict.__init__cCs d|jS)Nz )r/rr r rr)`szLookupDict.__repr__cCs|j|dSr__dict__getrr r rrcszLookupDict.__getitem__cCs|j||Srr3)r rdefaultr r rr5hszLookupDict.get)N)N) r*r+r,r-rr)rr5 __classcell__r r r1rr.Ys r.N) r- collectionsrcompatrrrr$r.r r r rs Jutils.cpython-39.opt-1.pyc000064400000056306151116515220011305 0ustar00a /h|@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z ddlmZddlmZddlmZddlmZdd lmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#dd l$m%Z%dd l&m'Z'dd l(m)Z)m*Z*m+Z+m,Z,d Z-e.Z/dddZ0ej1dkr:ddZ2ddZddZ3ddZ4dpddZ5ddZ6dd Z7d!d"Z8d#d$Z9d%d&Z:d'd(Z;dqd)d*Zd/d0Z?d1d2Z@d3d4ZAd5d6ZBd7d8ZCd9d:ZDeEd;ZFdd?ZHdrdAdBZIdCdDZJdEdFZKdGdHZLdIdJZMdKdLZNdMdNZOejPdOdPZQdQdRZRdsdSdTZSdUdVZTdtdXdYZUdZd[ZVd\d]ZWd^Xd_ZYeYd`ZZeYdaZ[dbdcZ\dddeZ]dfdgZ^e_dhZ`e_diZadjdkZbdldmZcdndoZddS)uz requests.utils ~~~~~~~~~~~~~~ This module provides utility functions that are used within Requests that are also useful for external consumption. N) OrderedDict __version__)certs)to_native_string)parse_http_list)quoteurlparsebytesstrunquote getproxies proxy_bypass urlunparse basestring integer_typesis_py3proxy_bypass_environmentgetproxies_environmentMappingcookiejar_from_dict)CaseInsensitiveDict) InvalidURL InvalidHeaderFileModeWarningUnrewindableBodyError)z.netrc_netrcPi)httphttpswin32cCsztrddl}nddl}Wnty.YdS0z6||jd}t||dd}||dd}WntyzYdS0|r|sdS| d}|D]T}|dkrd|vrd S| dd }| d d }| d d}t ||t j rd SqdS)NrFz;Software\Microsoft\Windows\CurrentVersion\Internet SettingsZ ProxyEnableZ ProxyOverride;z.Tz\.*z.*?)rwinregZ_winreg ImportErrorOpenKeyHKEY_CURRENT_USERintZ QueryValueExOSErrorsplitreplacerematchI)hostr'ZinternetSettingsZ proxyEnableZ proxyOverridetestr42/usr/lib/python3.9/site-packages/requests/utils.pyproxy_bypass_registry0sF        r6cCstrt|St|SdS)zReturn True, if the host should be bypassed. Checks proxy settings gathered from the environment, if specified, or the registry. N)rrr6)r2r4r4r5rWsrcCst|dr|}|S)z/Returns an internal sequence dictionary update.items)hasattrr7)dr4r4r5dict_to_sequencecs r:c Cs.d}d}t|drt|}n`t|dr.|j}nNt|dr|z |}WntjyXYn$0t|j}d|jvr|t dt t|drz | }Wn"t tfy|dur|}Yn\0t|dr|durz&|dd | }||pdWnt tfyd}Yn0|dur d}td||S) Nr__len__lenfilenoba%Requests has determined the content-length for this request using the binary size of the file: however, the file has been opened in text mode (i.e. without the 'b' flag in the mode). This may lead to an incorrect content-length. In Requests 3.0, support will be removed for files in text mode.tellseek)r8r<r=ioUnsupportedOperationosfstatst_sizemodewarningswarnrr?r,IOErrorr@max)oZ total_lengthZcurrent_positionr=r4r4r5 super_lenlsB             rMFc Cstjd}|dur|f}nddtD}zddlm}m}d}|D]B}ztj|}WntypYWdS0tj |rD|}qqD|durWdSt |} | j } z:|| | } | r| drdnd} | | | dfWWSWn|t fy|rYn0WnttfyYn0dS) z;Returns the Requests tuple auth for a given url from netrc.ZNETRCNcss|]}d|VqdS)z~/{}N)format).0fr4r4r5 z!get_netrc_auth..r)netrcNetrcParseErrorrrA)rDenvironget NETRC_FILESrSrTpath expanduserKeyErrorexistsr hostnameZauthenticatorsrJr(AttributeError) urlZ raise_errorsZ netrc_fileZnetrc_locationsrSrTZ netrc_pathrPlocZrir2rZlogin_ir4r4r5get_netrc_auths:     r`cCsBt|dd}|r>t|tr>|ddkr>|ddkr>tj|SdS)z0Tries to guess the filename of the given object.nameNr<>)getattr isinstancerrDrXbasename)objrar4r4r5guess_filenames   ricCstj|r|Stj|\}}|rPtj|sPtj|\}}d||g}q t|s^|St|}||vrx|St }tjj|g|dR}tj|s|j ||d}|S)zReplace nonexistent paths that look like they refer to a member of a zip archive with the location of an extracted copy of the target, or else just return the provided path unchanged. /)rX) rDrXr[r-joinzipfile is_zipfileZipFileZnamelisttempfileZ gettempdirextract)rXarchivememberprefixZzip_filetmpZextracted_pathr4r4r5extract_zipped_pathss      rucCs.|dur dSt|ttttfr&tdt|S)aTake an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g., :: >>> from_key_val_list([('key', 'val')]) OrderedDict([('key', 'val')]) >>> from_key_val_list('string') Traceback (most recent call last): ... ValueError: cannot encode objects that are not 2-tuples >>> from_key_val_list({'key': 'val'}) OrderedDict([('key', 'val')]) :rtype: OrderedDict N+cannot encode objects that are not 2-tuples)rfr r boolr+ ValueErrorrvaluer4r4r5from_key_val_lists r{cCs@|dur dSt|ttttfr&tdt|tr8|}t|S)aTake an object and test to see if it can be represented as a dictionary. If it can be, return a list of tuples, e.g., :: >>> to_key_val_list([('key', 'val')]) [('key', 'val')] >>> to_key_val_list({'key': 'val'}) [('key', 'val')] >>> to_key_val_list('string') Traceback (most recent call last): ... ValueError: cannot encode objects that are not 2-tuples :rtype: list Nrv) rfr r rwr+rxrr7listryr4r4r5to_key_val_lists r}cCsXg}t|D]F}|dd|ddkr4dkrHnnt|dd}||q |S)aParse lists as described by RFC 2068 Section 2. In particular, parse comma-separated lists where the elements of the list may include quoted-strings. A quoted-string could contain a comma. A non-quoted string could have quotes in the middle. Quotes are removed automatically after parsing. It basically works like :func:`parse_set_header` just that items may appear multiple times and case sensitivity is preserved. The return value is a standard :class:`list`: >>> parse_list_header('token, "quoted value"') ['token', 'quoted value'] To create a header from the :class:`list` again, use the :func:`dump_header` function. :param value: a string with a list header. :return: :class:`list` :rtype: list Nrrc")_parse_list_headerunquote_header_valueappend)rzresultitemr4r4r5parse_list_header=s  ( rcCsxi}t|D]f}d|vr"d||<q |dd\}}|dd|ddkrVdkrjnnt|dd}|||<q |S)a^Parse lists of key, value pairs as described by RFC 2068 Section 2 and convert them into a python dict: >>> d = parse_dict_header('foo="is a fish", bar="as well"') >>> type(d) is dict True >>> sorted(d.items()) [('bar', 'as well'), ('foo', 'is a fish')] If there is no value for a key it will be `None`: >>> parse_dict_header('key_without_value') {'key_without_value': None} To create a header from the :class:`dict` again, use the :func:`dump_header` function. :param value: a string with a dict header. :return: :class:`dict` :rtype: dict =Nrrcr~)rr-r)rzrrrar4r4r5parse_dict_header]s ( rcCs\|rX|d|dkr dkrXnn4|dd}|rD|dddkrX|ddd dS|S) zUnquotes a header value. (Reversal of :func:`quote_header_value`). This does not use the real unquoting but what browsers are actually using for quoting. :param value: the header value to unquote. :rtype: str rrcr~rNrAz\\\z\")r.)rzZ is_filenamer4r4r5rs $ rcCsi}|D]}|j||j<q|S)zReturns a key/value dictionary from a CookieJar. :param cj: CookieJar object to extract cookies from. :rtype: dict )rzra)cj cookie_dictZcookier4r4r5dict_from_cookiejarsrcCs t||S)zReturns a CookieJar from a key/value dictionary. :param cj: CookieJar to insert cookies into. :param cookie_dict: Dict of key/values to insert into CookieJar. :rtype: CookieJar r)rrr4r4r5add_dict_to_cookiejarsrcCsTtdttjdtjd}tjdtjd}td}||||||S)zlReturns encodings from given content string. :param content: bytestring to extract encodings from. zIn requests 3.0, get_encodings_from_content will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)z!])flagsz+]z$^<\?xml.*?encoding=["\']*(.+?)["\'>])rHrIDeprecationWarningr/compiler1findall)contentZ charset_reZ pragma_reZxml_rer4r4r5get_encodings_from_contents rc Cs|d}|d|dd}}i}d}|D]`}|}|r0|d}}|d} | dkr|d| |}|| dd|}|||<q0||fS) zReturns content type and parameters from given header :param header: string :return: tuple containing content type and dictionary of parameters r#rrNz"' Trrc)r-stripfindlower) headertokens content_typeparamsZ params_dictZitems_to_stripparamkeyrzZindex_of_equalsr4r4r5_parse_content_type_headers   rcCsP|d}|sdSt|\}}d|vr4|ddSd|vr@dSd|vrLdSdS) z}Returns encodings from given HTTP Header Dict. :param headers: dictionary to extract encoding from. :rtype: str z content-typeNcharsetz'"textz ISO-8859-1zapplication/jsonutf-8)rVrr)headersrrr4r4r5get_encoding_from_headerss  rccsj|jdur|D] }|VqdSt|jdd}|D]}||}|r4|Vq4|jddd}|rf|VdS)zStream decodes a iterator.Nr.errorsrRT)final)encodingcodecsgetincrementaldecoderdecode)iteratorrrdecoderchunkrvr4r4r5stream_decode_response_unicodes  rccsHd}|dus|dkrt|}|t|krD||||V||7}qdS)z Iterate over slices of a string.rN)r<)stringZ slice_lengthposr4r4r5 iter_slices s  rcCsztdtg}t|j}|rJzt|j|WStyH||Yn0zt|j|ddWSt yt|jYS0dS)zReturns the requested content back in unicode. :param r: Response object to get unicode content from. Tried: 1. charset from content-type 2. fall back and replace all unicode characters :rtype: str zIn requests 3.0, get_unicode_from_response will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)r.rN) rHrIrrrr r UnicodeErrorr TypeError)rZtried_encodingsrr4r4r5get_unicode_from_responses    rzBABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~c Cs|d}tdt|D]}||dd}t|dkr|rztt|d}Wntyptd|Yn0|tvr|||dd||<qd||||<qd||||<qd |S) zUn-escape any percent-escape sequences in a URI that are unreserved characters. This leaves all reserved, illegal and non-ASCII bytes encoded. :rtype: str %rrrAz%Invalid percent-escape sequence: '%s'N) r-ranger<isalnumchrr+rxrUNRESERVED_SETrk)uripartsihcr4r4r5unquote_unreserved>s  rcCs>d}d}ztt||dWSty8t||dYS0dS)zRe-quote the given URI. This function passes the given URI through an unquote/quote cycle to ensure that it is fully and consistently quoted. :rtype: str z!#$%&'()*+,/:;=?@[]~z!#$&'()*+,/:;=?@[]~)safeN)r rr)rZsafe_with_percentZsafe_without_percentr4r4r5 requote_uriVs  r cCsd|>d||>}|S)aConverts a mask from /xx format to a int to be used as a mask for IP's in int format Example: if mask is 24 function returns 0xFFFFFF00 if mask is 24 and totalbits=128 function returns 0xFFFFFF00000000000000000000000000 :rtype: int rr4)maskZ totalbitsbitsr4r4r5_get_mask_bitsls rc Cs|d\}}t|rXt|rXtdt|d}tt|}tdt|d}npt|rt|rtdt tj |\}}|d>|A}tt|d}tdt tj |\} } | d>| A}ndS||@||@kS)a3This function allows you to check if an IP belongs to a network subnet Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24 returns False if ip = 192.168.1.1 and net = 192.168.100.0/24 returns True if ip = 1:2:3:4::1 and net = 1:2:3:4::/64 :rtype: bool rjz>Lrz>QQ@F) r-is_ipv4_addressstructunpacksocketZ inet_atonrr+is_ipv6_address inet_ptonAF_INET6) ipnetZnetaddrrZipaddrnetmasknetworkZ ipaddr_msbZ ipaddr_lsbZ network_msbZ network_lsbr4r4r5address_in_networkzs"   rcCs&ddd|>dA}ttd|S)zConverts mask from /xx format to xxx.xxx.xxx.xxx Example: if mask is 24 function returns 255.255.255.0 :rtype: str lrrz>I)rZ inet_ntoarpack)rrr4r4r5dotted_netmasksrcCs.zttj|Wntjy(YdS0dSz :rtype: bool FT)rrZAF_INETerrorZ string_ipr4r4r5rs rcCs.zttj|Wntjy(YdS0dSr)rrrrrr4r4r5rs rcCsD||kr dSzttj|ttj|kWSty>YdS0dS)zW Compare 2 IP's, uses socket.inet_pton to normalize IPv6 IPs :rtype: bool TFN)rrrr,)ar>r4r4r5 compare_ipss rcCs|ddkr|d\}}z t|}Wnty<YdS0t|r\|dksV|dkr~dSqt|rz|dkst|dkr~dSqdSndSdS)zV Very simple check of the cidr format in no_proxy variable. :rtype: bool rjrFrrT)countr-r+rxrr)Zstring_networkaddressrr4r4r5 is_valid_cidrs  rc cst|du}|r"tj|}|tj|<z*dVW|rp|durBtj|=qp|tj|<n"|rn|durdtj|=n |tj|<0dS)zSet the environment variable 'env_name' to 'value' Save previous value, yield, and then restore the previous value stored in the environment variable 'env_name'. If 'value' is None, do nothingN)rDrUrV)Zenv_namerzZ value_changed old_valuer4r4r5 set_environs     rc CsJdd}|}|dur|d}t|}|jdur2dS|rdd|dd d D}t|jsft|jr|D]2}t|rt|j|rdSqjt|j|rjdSqjnB|j}|j r|d |j 7}|D] }|j |s| |rdSqt d|>zt |j}Wnttjfyd }Yn0Wdn1s20Y|rFdSd S) zL Returns whether we should bypass proxies or not. :rtype: bool cSstj|ptj|SN)rDrUrVupper)kr4r4r5rRz'should_bypass_proxies..Nno_proxyTcss|]}|r|VqdSrr4)rOr2r4r4r5rQsz(should_bypass_proxies.. r,z:{}F)r r\r.r-rrrrrportrNendswithrrrrZgaierror) r^rZ get_proxyZ no_proxy_argparsedZproxy_ipZhost_with_portr2Zbypassr4r4r5should_bypass_proxiess@     *rcCst||driStSdS)zA Return a dict of environment proxies. :rtype: dict )rN)rr)r^rr4r4r5get_environ_proxies5s rcCst|pi}t|}|jdur.||j|dS|jd|j|jd|jdg}d}|D]}||vrV||}qpqV|S)zSelect a proxy for the url, if applicable. :param url: The url being for the request :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs Nallz://zall://)r r\rVscheme)r^ZproxiesZurlpartsZ proxy_keysproxyZ proxy_keyr4r4r5 select_proxyAs rpython-requestscCs d|tfS)zO Return a string representing the default user agent. :rtype: str z%s/%sr)rar4r4r5default_user_agent[srcCsttdddddS)z9 :rtype: requests.structures.CaseInsensitiveDict z, )gzipZdeflatez*/*z keep-alive)z User-AgentzAccept-EncodingZAcceptZ Connection)rrrkr4r4r4r5default_headersds rc Csg}d}||}|s|Std|D]}z|dd\}}WntyZ|d}}Yn0d|di}|dD]D}z|d\}}WntyYqYn0|||||<qt||q&|S) zReturn a list of parsed link headers proxies. i.e. Link: ; rel=front; type="image/jpeg",; rel=back;type="image/jpeg" :rtype: list z '"z, * '"r)rr/r-rxr) rzZlinksZ replace_charsvalr^rlinkrrr4r4r5parse_header_linksps&     rasciirAcCs|dd}|tjtjfvr dS|ddtjkr6dS|ddtjtjfvrRdS|t}|dkrhd S|dkr|dddtkrd S|d ddtkrd S|dkr|ddt krd S|d dt krdSdS)z :rtype: str Nzutf-32rz utf-8-sigrAzutf-16rrz utf-16-berz utf-16-lez utf-32-bez utf-32-le) r BOM_UTF32_LE BOM_UTF32_BEBOM_UTF8 BOM_UTF16_LE BOM_UTF16_BEr_null_null2_null3)dataZsampleZ nullcountr4r4r5guess_json_utfs*  rcCs8t||\}}}}}}|s$||}}t||||||fS)zGiven a URL that may or may not have a scheme, prepend the given scheme. Does not replace a present scheme with the one provided as an argument. :rtype: str )r r)r^Z new_schemernetlocrXrqueryfragmentr4r4r5prepend_scheme_if_neededs r c Cs@t|}zt|jt|jf}Wnttfy:d}Yn0|S)z{Given a url with authentication components, extract them into a tuple of username,password. :rtype: (str,str) )rr)r r usernamepasswordr]r)r^rZauthr4r4r5get_auth_from_urls  r s^\S[^\r\n]*$|^$z^\S[^\r\n]*$|^$c Csd|\}}t|trt}nt}z||s4td|Wn(ty^td||t|fYn0dS)zVerifies that header value is a string which doesn't contain leading whitespace or return characters. This prevents unintended header injection. :param header: tuple, in the format (name, value). z7Invalid return character or leading space in header: %sz>Value for header {%s: %s} must be of type str or bytes, not %sN)rfr _CLEAN_HEADER_REGEX_BYTE_CLEAN_HEADER_REGEX_STRr0rrtype)rrarzpatr4r4r5check_header_validitys    rcCsFt|\}}}}}}|s"||}}|ddd}t|||||dfS)zW Given a url remove the fragment and the authentication part. :rtype: str @rrcr)r rsplitr)r^rrrXrrrr4r4r5 urldefragauths  rc Cs^t|jdd}|durRt|jtrRz||jWqZttfyNtdYqZ0ntddS)zfMove file pointer back to its recorded starting position so it can be read again on redirect. r@Nz;An error occurred when rewinding request body for redirect.z+Unable to rewind request body for redirect.)rebodyrfZ_body_positionrrJr,r)Zprepared_requestZ body_seekr4r4r5 rewind_bodysr)F)F)r)N)r)e__doc__r contextlibrBrDr/rrsysrorHrl collectionsrrrrZ_internal_utilsrcompatrrr r r r r rrrrrrrrrZcookiesrZ structuresr exceptionsrrrrrWwhereZDEFAULT_CA_BUNDLE_PATHZ DEFAULT_PORTSplatformr6r:rMr`rirur{r}rrrrrrrrrrr frozensetrrrrrrrrrrcontextmanagerrrrrrrrencoderrrrr r rr rrrrr4r4r4r5s     @    '  = 3  #   %     =   &    utils.cpython-39.pyc000064400000056306151116515220010346 0ustar00a /h|@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z ddlmZddlmZddlmZddlmZdd lmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#dd l$m%Z%dd l&m'Z'dd l(m)Z)m*Z*m+Z+m,Z,d Z-e.Z/dddZ0ej1dkr:ddZ2ddZddZ3ddZ4dpddZ5ddZ6dd Z7d!d"Z8d#d$Z9d%d&Z:d'd(Z;dqd)d*Zd/d0Z?d1d2Z@d3d4ZAd5d6ZBd7d8ZCd9d:ZDeEd;ZFdd?ZHdrdAdBZIdCdDZJdEdFZKdGdHZLdIdJZMdKdLZNdMdNZOejPdOdPZQdQdRZRdsdSdTZSdUdVZTdtdXdYZUdZd[ZVd\d]ZWd^Xd_ZYeYd`ZZeYdaZ[dbdcZ\dddeZ]dfdgZ^e_dhZ`e_diZadjdkZbdldmZcdndoZddS)uz requests.utils ~~~~~~~~~~~~~~ This module provides utility functions that are used within Requests that are also useful for external consumption. N) OrderedDict __version__)certs)to_native_string)parse_http_list)quoteurlparsebytesstrunquote getproxies proxy_bypass urlunparse basestring integer_typesis_py3proxy_bypass_environmentgetproxies_environmentMappingcookiejar_from_dict)CaseInsensitiveDict) InvalidURL InvalidHeaderFileModeWarningUnrewindableBodyError)z.netrc_netrcPi)httphttpswin32cCsztrddl}nddl}Wnty.YdS0z6||jd}t||dd}||dd}WntyzYdS0|r|sdS| d}|D]T}|dkrd|vrd S| dd }| d d }| d d}t ||t j rd SqdS)NrFz;Software\Microsoft\Windows\CurrentVersion\Internet SettingsZ ProxyEnableZ ProxyOverride;z.Tz\.*z.*?)rwinregZ_winreg ImportErrorOpenKeyHKEY_CURRENT_USERintZ QueryValueExOSErrorsplitreplacerematchI)hostr'ZinternetSettingsZ proxyEnableZ proxyOverridetestr42/usr/lib/python3.9/site-packages/requests/utils.pyproxy_bypass_registry0sF        r6cCstrt|St|SdS)zReturn True, if the host should be bypassed. Checks proxy settings gathered from the environment, if specified, or the registry. N)rrr6)r2r4r4r5rWsrcCst|dr|}|S)z/Returns an internal sequence dictionary update.items)hasattrr7)dr4r4r5dict_to_sequencecs r:c Cs.d}d}t|drt|}n`t|dr.|j}nNt|dr|z |}WntjyXYn$0t|j}d|jvr|t dt t|drz | }Wn"t tfy|dur|}Yn\0t|dr|durz&|dd | }||pdWnt tfyd}Yn0|dur d}td||S) Nr__len__lenfilenoba%Requests has determined the content-length for this request using the binary size of the file: however, the file has been opened in text mode (i.e. without the 'b' flag in the mode). This may lead to an incorrect content-length. In Requests 3.0, support will be removed for files in text mode.tellseek)r8r<r=ioUnsupportedOperationosfstatst_sizemodewarningswarnrr?r,IOErrorr@max)oZ total_lengthZcurrent_positionr=r4r4r5 super_lenlsB             rMFc Cstjd}|dur|f}nddtD}zddlm}m}d}|D]B}ztj|}WntypYWdS0tj |rD|}qqD|durWdSt |} | j } z:|| | } | r| drdnd} | | | dfWWSWn|t fy|rYn0WnttfyYn0dS) z;Returns the Requests tuple auth for a given url from netrc.ZNETRCNcss|]}d|VqdS)z~/{}N)format).0fr4r4r5 z!get_netrc_auth..r)netrcNetrcParseErrorrrA)rDenvironget NETRC_FILESrSrTpath expanduserKeyErrorexistsr hostnameZauthenticatorsrJr(AttributeError) urlZ raise_errorsZ netrc_fileZnetrc_locationsrSrTZ netrc_pathrPlocZrir2rZlogin_ir4r4r5get_netrc_auths:     r`cCsBt|dd}|r>t|tr>|ddkr>|ddkr>tj|SdS)z0Tries to guess the filename of the given object.nameNr<>)getattr isinstancerrDrXbasename)objrar4r4r5guess_filenames   ricCstj|r|Stj|\}}|rPtj|sPtj|\}}d||g}q t|s^|St|}||vrx|St }tjj|g|dR}tj|s|j ||d}|S)zReplace nonexistent paths that look like they refer to a member of a zip archive with the location of an extracted copy of the target, or else just return the provided path unchanged. /)rX) rDrXr[r-joinzipfile is_zipfileZipFileZnamelisttempfileZ gettempdirextract)rXarchivememberprefixZzip_filetmpZextracted_pathr4r4r5extract_zipped_pathss      rucCs.|dur dSt|ttttfr&tdt|S)aTake an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g., :: >>> from_key_val_list([('key', 'val')]) OrderedDict([('key', 'val')]) >>> from_key_val_list('string') Traceback (most recent call last): ... ValueError: cannot encode objects that are not 2-tuples >>> from_key_val_list({'key': 'val'}) OrderedDict([('key', 'val')]) :rtype: OrderedDict N+cannot encode objects that are not 2-tuples)rfr r boolr+ ValueErrorrvaluer4r4r5from_key_val_lists r{cCs@|dur dSt|ttttfr&tdt|tr8|}t|S)aTake an object and test to see if it can be represented as a dictionary. If it can be, return a list of tuples, e.g., :: >>> to_key_val_list([('key', 'val')]) [('key', 'val')] >>> to_key_val_list({'key': 'val'}) [('key', 'val')] >>> to_key_val_list('string') Traceback (most recent call last): ... ValueError: cannot encode objects that are not 2-tuples :rtype: list Nrv) rfr r rwr+rxrr7listryr4r4r5to_key_val_lists r}cCsXg}t|D]F}|dd|ddkr4dkrHnnt|dd}||q |S)aParse lists as described by RFC 2068 Section 2. In particular, parse comma-separated lists where the elements of the list may include quoted-strings. A quoted-string could contain a comma. A non-quoted string could have quotes in the middle. Quotes are removed automatically after parsing. It basically works like :func:`parse_set_header` just that items may appear multiple times and case sensitivity is preserved. The return value is a standard :class:`list`: >>> parse_list_header('token, "quoted value"') ['token', 'quoted value'] To create a header from the :class:`list` again, use the :func:`dump_header` function. :param value: a string with a list header. :return: :class:`list` :rtype: list Nrrc")_parse_list_headerunquote_header_valueappend)rzresultitemr4r4r5parse_list_header=s  ( rcCsxi}t|D]f}d|vr"d||<q |dd\}}|dd|ddkrVdkrjnnt|dd}|||<q |S)a^Parse lists of key, value pairs as described by RFC 2068 Section 2 and convert them into a python dict: >>> d = parse_dict_header('foo="is a fish", bar="as well"') >>> type(d) is dict True >>> sorted(d.items()) [('bar', 'as well'), ('foo', 'is a fish')] If there is no value for a key it will be `None`: >>> parse_dict_header('key_without_value') {'key_without_value': None} To create a header from the :class:`dict` again, use the :func:`dump_header` function. :param value: a string with a dict header. :return: :class:`dict` :rtype: dict =Nrrcr~)rr-r)rzrrrar4r4r5parse_dict_header]s ( rcCs\|rX|d|dkr dkrXnn4|dd}|rD|dddkrX|ddd dS|S) zUnquotes a header value. (Reversal of :func:`quote_header_value`). This does not use the real unquoting but what browsers are actually using for quoting. :param value: the header value to unquote. :rtype: str rrcr~rNrAz\\\z\")r.)rzZ is_filenamer4r4r5rs $ rcCsi}|D]}|j||j<q|S)zReturns a key/value dictionary from a CookieJar. :param cj: CookieJar object to extract cookies from. :rtype: dict )rzra)cj cookie_dictZcookier4r4r5dict_from_cookiejarsrcCs t||S)zReturns a CookieJar from a key/value dictionary. :param cj: CookieJar to insert cookies into. :param cookie_dict: Dict of key/values to insert into CookieJar. :rtype: CookieJar r)rrr4r4r5add_dict_to_cookiejarsrcCsTtdttjdtjd}tjdtjd}td}||||||S)zlReturns encodings from given content string. :param content: bytestring to extract encodings from. zIn requests 3.0, get_encodings_from_content will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)z!])flagsz+]z$^<\?xml.*?encoding=["\']*(.+?)["\'>])rHrIDeprecationWarningr/compiler1findall)contentZ charset_reZ pragma_reZxml_rer4r4r5get_encodings_from_contents rc Cs|d}|d|dd}}i}d}|D]`}|}|r0|d}}|d} | dkr|d| |}|| dd|}|||<q0||fS) zReturns content type and parameters from given header :param header: string :return: tuple containing content type and dictionary of parameters r#rrNz"' Trrc)r-stripfindlower) headertokens content_typeparamsZ params_dictZitems_to_stripparamkeyrzZindex_of_equalsr4r4r5_parse_content_type_headers   rcCsP|d}|sdSt|\}}d|vr4|ddSd|vr@dSd|vrLdSdS) z}Returns encodings from given HTTP Header Dict. :param headers: dictionary to extract encoding from. :rtype: str z content-typeNcharsetz'"textz ISO-8859-1zapplication/jsonutf-8)rVrr)headersrrr4r4r5get_encoding_from_headerss  rccsj|jdur|D] }|VqdSt|jdd}|D]}||}|r4|Vq4|jddd}|rf|VdS)zStream decodes a iterator.Nr.errorsrRT)final)encodingcodecsgetincrementaldecoderdecode)iteratorrrdecoderchunkrvr4r4r5stream_decode_response_unicodes  rccsHd}|dus|dkrt|}|t|krD||||V||7}qdS)z Iterate over slices of a string.rN)r<)stringZ slice_lengthposr4r4r5 iter_slices s  rcCsztdtg}t|j}|rJzt|j|WStyH||Yn0zt|j|ddWSt yt|jYS0dS)zReturns the requested content back in unicode. :param r: Response object to get unicode content from. Tried: 1. charset from content-type 2. fall back and replace all unicode characters :rtype: str zIn requests 3.0, get_unicode_from_response will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)r.rN) rHrIrrrr r UnicodeErrorr TypeError)rZtried_encodingsrr4r4r5get_unicode_from_responses    rzBABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~c Cs|d}tdt|D]}||dd}t|dkr|rztt|d}Wntyptd|Yn0|tvr|||dd||<qd||||<qd||||<qd |S) zUn-escape any percent-escape sequences in a URI that are unreserved characters. This leaves all reserved, illegal and non-ASCII bytes encoded. :rtype: str %rrrAz%Invalid percent-escape sequence: '%s'N) r-ranger<isalnumchrr+rxrUNRESERVED_SETrk)uripartsihcr4r4r5unquote_unreserved>s  rcCs>d}d}ztt||dWSty8t||dYS0dS)zRe-quote the given URI. This function passes the given URI through an unquote/quote cycle to ensure that it is fully and consistently quoted. :rtype: str z!#$%&'()*+,/:;=?@[]~z!#$&'()*+,/:;=?@[]~)safeN)r rr)rZsafe_with_percentZsafe_without_percentr4r4r5 requote_uriVs  r cCsd|>d||>}|S)aConverts a mask from /xx format to a int to be used as a mask for IP's in int format Example: if mask is 24 function returns 0xFFFFFF00 if mask is 24 and totalbits=128 function returns 0xFFFFFF00000000000000000000000000 :rtype: int rr4)maskZ totalbitsbitsr4r4r5_get_mask_bitsls rc Cs|d\}}t|rXt|rXtdt|d}tt|}tdt|d}npt|rt|rtdt tj |\}}|d>|A}tt|d}tdt tj |\} } | d>| A}ndS||@||@kS)a3This function allows you to check if an IP belongs to a network subnet Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24 returns False if ip = 192.168.1.1 and net = 192.168.100.0/24 returns True if ip = 1:2:3:4::1 and net = 1:2:3:4::/64 :rtype: bool rjz>Lrz>QQ@F) r-is_ipv4_addressstructunpacksocketZ inet_atonrr+is_ipv6_address inet_ptonAF_INET6) ipnetZnetaddrrZipaddrnetmasknetworkZ ipaddr_msbZ ipaddr_lsbZ network_msbZ network_lsbr4r4r5address_in_networkzs"   rcCs&ddd|>dA}ttd|S)zConverts mask from /xx format to xxx.xxx.xxx.xxx Example: if mask is 24 function returns 255.255.255.0 :rtype: str lrrz>I)rZ inet_ntoarpack)rrr4r4r5dotted_netmasksrcCs.zttj|Wntjy(YdS0dSz :rtype: bool FT)rrZAF_INETerrorZ string_ipr4r4r5rs rcCs.zttj|Wntjy(YdS0dSr)rrrrrr4r4r5rs rcCsD||kr dSzttj|ttj|kWSty>YdS0dS)zW Compare 2 IP's, uses socket.inet_pton to normalize IPv6 IPs :rtype: bool TFN)rrrr,)ar>r4r4r5 compare_ipss rcCs|ddkr|d\}}z t|}Wnty<YdS0t|r\|dksV|dkr~dSqt|rz|dkst|dkr~dSqdSndSdS)zV Very simple check of the cidr format in no_proxy variable. :rtype: bool rjrFrrT)countr-r+rxrr)Zstring_networkaddressrr4r4r5 is_valid_cidrs  rc cst|du}|r"tj|}|tj|<z*dVW|rp|durBtj|=qp|tj|<n"|rn|durdtj|=n |tj|<0dS)zSet the environment variable 'env_name' to 'value' Save previous value, yield, and then restore the previous value stored in the environment variable 'env_name'. If 'value' is None, do nothingN)rDrUrV)Zenv_namerzZ value_changed old_valuer4r4r5 set_environs     rc CsJdd}|}|dur|d}t|}|jdur2dS|rdd|dd d D}t|jsft|jr|D]2}t|rt|j|rdSqjt|j|rjdSqjnB|j}|j r|d |j 7}|D] }|j |s| |rdSqt d|>zt |j}Wnttjfyd }Yn0Wdn1s20Y|rFdSd S) zL Returns whether we should bypass proxies or not. :rtype: bool cSstj|ptj|SN)rDrUrVupper)kr4r4r5rRz'should_bypass_proxies..Nno_proxyTcss|]}|r|VqdSrr4)rOr2r4r4r5rQsz(should_bypass_proxies.. r,z:{}F)r r\r.r-rrrrrportrNendswithrrrrZgaierror) r^rZ get_proxyZ no_proxy_argparsedZproxy_ipZhost_with_portr2Zbypassr4r4r5should_bypass_proxiess@     *rcCst||driStSdS)zA Return a dict of environment proxies. :rtype: dict )rN)rr)r^rr4r4r5get_environ_proxies5s rcCst|pi}t|}|jdur.||j|dS|jd|j|jd|jdg}d}|D]}||vrV||}qpqV|S)zSelect a proxy for the url, if applicable. :param url: The url being for the request :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs Nallz://zall://)r r\rVscheme)r^ZproxiesZurlpartsZ proxy_keysproxyZ proxy_keyr4r4r5 select_proxyAs rpython-requestscCs d|tfS)zO Return a string representing the default user agent. :rtype: str z%s/%sr)rar4r4r5default_user_agent[srcCsttdddddS)z9 :rtype: requests.structures.CaseInsensitiveDict z, )gzipZdeflatez*/*z keep-alive)z User-AgentzAccept-EncodingZAcceptZ Connection)rrrkr4r4r4r5default_headersds rc Csg}d}||}|s|Std|D]}z|dd\}}WntyZ|d}}Yn0d|di}|dD]D}z|d\}}WntyYqYn0|||||<qt||q&|S) zReturn a list of parsed link headers proxies. i.e. Link: ; rel=front; type="image/jpeg",; rel=back;type="image/jpeg" :rtype: list z '"z, * '"r)rr/r-rxr) rzZlinksZ replace_charsvalr^rlinkrrr4r4r5parse_header_linksps&     rasciirAcCs|dd}|tjtjfvr dS|ddtjkr6dS|ddtjtjfvrRdS|t}|dkrhd S|dkr|dddtkrd S|d ddtkrd S|dkr|ddt krd S|d dt krdSdS)z :rtype: str Nzutf-32rz utf-8-sigrAzutf-16rrz utf-16-berz utf-16-lez utf-32-bez utf-32-le) r BOM_UTF32_LE BOM_UTF32_BEBOM_UTF8 BOM_UTF16_LE BOM_UTF16_BEr_null_null2_null3)dataZsampleZ nullcountr4r4r5guess_json_utfs*  rcCs8t||\}}}}}}|s$||}}t||||||fS)zGiven a URL that may or may not have a scheme, prepend the given scheme. Does not replace a present scheme with the one provided as an argument. :rtype: str )r r)r^Z new_schemernetlocrXrqueryfragmentr4r4r5prepend_scheme_if_neededs r c Cs@t|}zt|jt|jf}Wnttfy:d}Yn0|S)z{Given a url with authentication components, extract them into a tuple of username,password. :rtype: (str,str) )rr)r r usernamepasswordr]r)r^rZauthr4r4r5get_auth_from_urls  r s^\S[^\r\n]*$|^$z^\S[^\r\n]*$|^$c Csd|\}}t|trt}nt}z||s4td|Wn(ty^td||t|fYn0dS)zVerifies that header value is a string which doesn't contain leading whitespace or return characters. This prevents unintended header injection. :param header: tuple, in the format (name, value). z7Invalid return character or leading space in header: %sz>Value for header {%s: %s} must be of type str or bytes, not %sN)rfr _CLEAN_HEADER_REGEX_BYTE_CLEAN_HEADER_REGEX_STRr0rrtype)rrarzpatr4r4r5check_header_validitys    rcCsFt|\}}}}}}|s"||}}|ddd}t|||||dfS)zW Given a url remove the fragment and the authentication part. :rtype: str @rrcr)r rsplitr)r^rrrXrrrr4r4r5 urldefragauths  rc Cs^t|jdd}|durRt|jtrRz||jWqZttfyNtdYqZ0ntddS)zfMove file pointer back to its recorded starting position so it can be read again on redirect. r@Nz;An error occurred when rewinding request body for redirect.z+Unable to rewind request body for redirect.)rebodyrfZ_body_positionrrJr,r)Zprepared_requestZ body_seekr4r4r5 rewind_bodysr)F)F)r)N)r)e__doc__r contextlibrBrDr/rrsysrorHrl collectionsrrrrZ_internal_utilsrcompatrrr r r r r rrrrrrrrrZcookiesrZ structuresr exceptionsrrrrrWwhereZDEFAULT_CA_BUNDLE_PATHZ DEFAULT_PORTSplatformr6r:rMr`rirur{r}rrrrrrrrrrr frozensetrrrrrrrrrrcontextmanagerrrrrrrrencoderrrrr r rr rrrrr4r4r4r5s     @    '  = 3  #   %     =   &    __version__.cpython-39.opt-1.pyc000064400000000773151116515220012423 0ustar00a /h@s,dZdZdZdZdZdZdZdZdZd Z d S) ZrequestszPython HTTP for Humans.zhttps://requests.readthedocs.ioz2.25.1i%z Kenneth Reitzzme@kennethreitz.orgz Apache 2.0zCopyright 2020 Kenneth Reitzu ✨ 🍰 ✨N) Z __title__Z__description__Z__url__ __version__Z __build__ __author__Z__author_email__Z __license__Z __copyright__Z__cake__rr8/usr/lib/python3.9/site-packages/requests/__version__.pys__version__.cpython-39.pyc000064400000000773151116515220011464 0ustar00a /h@s,dZdZdZdZdZdZdZdZdZd Z d S) ZrequestszPython HTTP for Humans.zhttps://requests.readthedocs.ioz2.25.1i%z Kenneth Reitzzme@kennethreitz.orgz Apache 2.0zCopyright 2020 Kenneth Reitzu ✨ 🍰 ✨N) Z __title__Z__description__Z__url__ __version__Z __build__ __author__Z__author_email__Z __license__Z __copyright__Z__cake__rr8/usr/lib/python3.9/site-packages/requests/__version__.pys_internal_utils.cpython-39.opt-1.pyc000064400000002314151116515220013326 0ustar00a /hH@s.dZddlmZmZmZd ddZddZdS) z requests._internal_utils ~~~~~~~~~~~~~~ Provides utility functions that are consumed internally by Requests which depend on extremely few external helpers (such as compat) )is_py2 builtin_strstrasciicCs.t|tr|}ntr ||}n ||}|S)zGiven a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise. ) isinstancerrencodedecode)stringencodingoutr s _internal_utils.cpython-39.pyc000064400000002346151116515220012374 0ustar00a /hH@s.dZddlmZmZmZd ddZddZdS) z requests._internal_utils ~~~~~~~~~~~~~~ Provides utility functions that are consumed internally by Requests which depend on extremely few external helpers (such as compat) )is_py2 builtin_strstrasciicCs.t|tr|}ntr ||}n ||}|S)zGiven a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise. ) isinstancerrencodedecode)stringencodingoutr s adapters.cpython-39.opt-1.pyc000064400000054075151116515220011751 0ustar00a /h7q@sNdZddlZddlZddlZddlmZmZddlm Z ddl m Z ddl m Z ddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlm Z ddl!m"Z"ddl#m$Z$m%Z%ddl&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3m4Z4m5Z5mZmZm6Z6m7Z7m8Z8m9Z9ddl:m;Z;zddlyddZ=Yn0dZ?d Z@dZAdZBz ddlCZCeZDeDEe(e'Wne>ydZDYn0d!d"ejFeGejHfeId#d$d%ZJd&d!d"d'd(d)d*d+ZKGd,d-d-eLZMGd.d/d/eMZNdS)0z requests.adapters ~~~~~~~~~~~~~~~~~ This module contains the transport adapters that Requests uses to define and maintain connections. N) PoolManagerproxy_from_url) HTTPResponse) parse_url)Timeout)Retry)create_urllib3_context)ClosedPoolError)ConnectTimeoutError) HTTPError) MaxRetryError)NewConnectionError) ProxyError) ProtocolError)ReadTimeoutError)SSLError) ResponseError)LocationValueError)Response)urlparse basestring)DEFAULT_CA_BUNDLE_PATHextract_zipped_pathsget_encoding_from_headersprepend_scheme_if_neededget_auth_from_url urldefragauth select_proxy)CaseInsensitiveDict)extract_cookies_to_jar) ConnectionErrorConnectTimeout ReadTimeoutrr RetryError InvalidSchemaInvalidProxyURL InvalidURL)_basic_auth_str)SOCKSProxyManagercOs tddS)Nz'Missing dependencies for SOCKS support.)r%)argskwargsr,5/usr/lib/python3.9/site-packages/requests/adapters.pyr)0sr)F zbool | str | Nonez#typing.Tuple[str, str] | str | None)verify client_certpoolmanager_kwargsreturncCs,|d}|duo&tduo&| o&|du}|S)N ssl_contextT)get_preloaded_ssl_context)r/r0r1Zhas_poolmanager_ssl_contextZshould_use_default_ssl_contextr,r,r-_should_use_default_contextEs r6ZPreparedRequestrz<(typing.Dict[str, typing.Any], typing.Dict[str, typing.Any]))requestr/r0 poolmanagerr2c Csi}i}t|j}|j}|j}t|di} d} d} |durDd} n6t||| rZt|d<n |durltt } nt |t rz|} | durt j | s| |d<n| |d<| |d <|durt |trt|d kr|d |d <|d |d<n||d <||j|d}||fS)NZconnection_pool_kw CERT_REQUIREDF CERT_NONEr3Tca_certs ca_cert_dir cert_reqsr cert_filerkey_file)schemehostport)rurlrAlowerrCgetattrr6r5rr isinstancestrospathisdirtuplelenhostname) r7r/r0r8 host_params pool_kwargsZparsed_request_urlrArCr1r=cert_locr,r,r-_urllib3_request_contextVs>          rRcs2eZdZdZfddZd ddZd d ZZS) BaseAdapterzThe Base Transport Adaptercstt|dSN)superrS__init__self __class__r,r-rVszBaseAdapter.__init__FNTcCstdS)aCSends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. NNotImplementedError)rXr7streamtimeoutr/certproxiesr,r,r-sendszBaseAdapter.sendcCstdS)z!Cleans up adapter specific items.Nr[rWr,r,r-closeszBaseAdapter.close)FNTNN)__name__ __module__ __qualname____doc__rVrarb __classcell__r,r,rYr-rSs   rScseZdZdZgdZeeeeffdd ZddZ ddZ efd d Z d d Z d dZ ddZd$ddZd%ddZd&ddZddZddZddZddZd'd"d#ZZS)( HTTPAdapteraThe built-in HTTP Adapter for urllib3. Provides a general-case interface for Requests sessions to contact HTTP and HTTPS urls by implementing the Transport Adapter interface. This class will usually be created by the :class:`Session ` class under the covers. :param pool_connections: The number of urllib3 connection pools to cache. :param pool_maxsize: The maximum number of connections to save in the pool. :param max_retries: The maximum number of retries each connection should attempt. Note, this applies only to failed DNS lookups, socket connections and connection timeouts, never to requests where data has made it to the server. By default, Requests does not retry failed connections. If you need granular control over the conditions under which we retry a request, import urllib3's ``Retry`` class and pass that instead. :param pool_block: Whether the connection pool should block for connections. Usage:: >>> import requests >>> s = requests.Session() >>> a = requests.adapters.HTTPAdapter(max_retries=3) >>> s.mount('http://', a) ) max_retriesconfig_pool_connections _pool_maxsize _pool_blockcsd|tkrtddd|_n t||_i|_i|_tt|||_ ||_ ||_ |j |||ddS)NrF)readblock) DEFAULT_RETRIESrriZfrom_intrj proxy_managerrUrhrVrkrlrminit_poolmanager)rXZpool_connectionsZ pool_maxsizeriZ pool_blockrYr,r-rVs zHTTPAdapter.__init__csfddjDS)Ncsi|]}|t|dqSrT)rF).0attrrWr,r- z,HTTPAdapter.__getstate__..) __attrs__rWr,rWr- __getstate__szHTTPAdapter.__getstate__cCsDi|_i|_|D]\}}t|||q|j|j|j|jddS)Nro)rrrjitemssetattrrsrkrlrm)rXstateruvaluer,r,r- __setstate__s zHTTPAdapter.__setstate__cKs0||_||_||_tf|||dd||_dS)aInitializes a urllib3 PoolManager. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param connections: The number of urllib3 connection pools to cache. :param maxsize: The maximum number of connections to save in the pool. :param block: Block when no free connections are available. :param pool_kwargs: Extra keyword arguments used to initialize the Pool Manager. T) num_poolsmaxsizerpstrictN)rkrlrmrr8)rXZ connectionsrrprPr,r,r-rss zHTTPAdapter.init_poolmanagercKs||jvr|j|}n||dr^t|\}}t|f|||j|j|jd|}|j|<n4||}t |f||j|j|jd|}|j|<|S)aReturn urllib3 ProxyManager for the given proxy. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param proxy: The proxy to return a urllib3 ProxyManager for. :param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager. :returns: ProxyManager :rtype: urllib3.ProxyManager socks)usernamepasswordrrrp) proxy_headersrrrp) rrrE startswithrr)rkrlrmrr)rXproxyZ proxy_kwargsZmanagerrrrr,r,r-proxy_manager_fors6    zHTTPAdapter.proxy_manager_forcCs|drZ|rZd|_|durl|}tj|s>td|tj|sR||_ql||_ nd|_d|_d|_ |rt |t s|d|_ |d|_ n ||_ d|_ |j rtj|j std |j |j rtj|j std |j dS) aAVerify a SSL certificate. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param conn: The urllib3 connection object associated with the cert. :param url: The requested URL. :param verify: Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: The SSL certificate to verify. httpsr9TzCCould not find a suitable TLS CA certificate bundle, invalid path: r:Nrrz9Could not find the TLS certificate file, invalid path: {}z1Could not find the TLS key file, invalid path: {})rErr=rIrJexistsOSErrorrKr;r<rGrr?r@IOErrorformat)rXconnrDr/r_rQr,r,r- cert_verifys<      zHTTPAdapter.cert_verifycCst}t|dd|_tt|di|_t|j|_||_|jj|_t |j t r^|j d|_ n|j |_ t |j||||_||_|S)aBuilds a :class:`Response ` object from a urllib3 response. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter ` :param req: The :class:`PreparedRequest ` used to generate the response. :param resp: The urllib3 response object. :rtype: requests.Response statusNheadersutf-8)rrFZ status_coderrrencodingrawreasonrGrDbytesdecoder cookiesr7 connection)rXZreqrespZresponser,r,r-build_responseLs    zHTTPAdapter.build_responseNcCst||||jS)a Build the PoolKey attributes used by urllib3 to return a connection. This looks at the PreparedRequest, the user-specified verify value, and the value of the cert parameter to determine what PoolKey values to use to select a connection from a given urllib3 Connection Pool. The SSL related pool key arguments are not consistently set. As of this writing, use the following to determine what keys may be in that dictionary: * If ``verify`` is ``True``, ``"ssl_context"`` will be set and will be the default Requests SSL Context * If ``verify`` is ``False``, ``"ssl_context"`` will not be set but ``"cert_reqs"`` will be set * If ``verify`` is a string, (i.e., it is a user-specified trust bundle) ``"ca_certs"`` will be set if the string is not a directory recognized by :py:func:`os.path.isdir`, otherwise ``"ca_certs_dir"`` will be set. * If ``"cert"`` is specified, ``"cert_file"`` will always be set. If ``"cert"`` is a tuple with a second item, ``"key_file"`` will also be present To override these settings, one may subclass this class, call this method and use the above logic to change parameters as desired. For example, if one wishes to use a custom :py:class:`ssl.SSLContext` one must both set ``"ssl_context"`` and based on what else they require, alter the other keys to ensure the desired behaviour. :param request: The PreparedReqest being sent over the connection. :type request: :class:`~requests.models.PreparedRequest` :param verify: Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. :param cert: (optional) Any user-provided SSL certificate for client authentication (a.k.a., mTLS). This may be a string (i.e., just the path to a file which holds both certificate and key) or a tuple of length 2 with the certificate file path and key file path. :returns: A tuple of two dictionaries. The first is the "host parameters" portion of the Pool Key including scheme, hostname, and port. The second is a dictionary of SSLContext related parameters. )rRr8)rXr7r/r_r,r,r-$build_connection_pool_key_attributesqs+z0HTTPAdapter.build_connection_pool_key_attributesc Cst|j|}z||||\}}Wn0tyR}zt||dWYd}~n d}~00|rt|d}t|} | jsxtd| |} | j fi|d|i} n|j j fi|d|i} | S)apReturns a urllib3 connection for the given request and TLS settings. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param request: The :class:`PreparedRequest ` object to be sent over the connection. :param verify: Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. :param proxies: (optional) The proxies dictionary to apply to the request. :param cert: (optional) Any user-provided SSL certificate to be used for client authentication (a.k.a., mTLS). :rtype: urllib3.ConnectionPool r7NhttpFPlease check proxy URL. It is malformed and could be missing the host.rP) rrDr ValueErrorr'rrrBr&rZconnection_from_hostr8) rXr7r/r`r_rrOrPe proxy_urlrrrr,r,r-get_connection_with_tls_contexts8  "    z+HTTPAdapter.get_connection_with_tls_contextcCsdt||}|rDt|d}t|}|js.td||}||}nt|}|}|j |}|S)aDEPRECATED: Users should move to `get_connection_with_tls_context` for all subclasses of HTTPAdapter using Requests>=2.32.2. Returns a urllib3 connection for the given URL. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param url: The URL to connect to. :param proxies: (optional) A Requests-style dictionary of proxies used on this request. :rtype: urllib3.ConnectionPool rr) rrrrBr&rZconnection_from_urlrgeturlr8)rXrDr`rrrrrparsedr,r,r-get_connections     zHTTPAdapter.get_connectioncCs&|j|jD] }|qdS)zDisposes of any internal state. Currently, this closes the PoolManager and any active ProxyManager, which closes any pooled connections. N)r8clearrrvalues)rXrr,r,r-rbs zHTTPAdapter.closec Cs`t|j|}t|jj}|o"|dk}d}|rDt|j}|d}|j}|r\|s\t|j}|S)a?Obtain the url to use when making the final request. If the message is being sent through a HTTP proxy, the full URL has to be used. Otherwise, we should only use the path portion of the URL. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param request: The :class:`PreparedRequest ` being sent. :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs. :rtype: str rFr)rrDrrArErZpath_urlr) rXr7r`rrAZis_proxied_http_requestZusing_socks_proxyZ proxy_schemerDr,r,r- request_urls     zHTTPAdapter.request_urlcKsdS)a"Add any headers needed by the connection. As of v2.0 this does nothing by default, but is left for overriding by users that subclass the :class:`HTTPAdapter `. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param request: The :class:`PreparedRequest ` to add headers to. :param kwargs: The keyword arguments from the call to send(). Nr,)rXr7r+r,r,r- add_headerss zHTTPAdapter.add_headerscCs&i}t|\}}|r"t|||d<|S)aReturns a dictionary of the headers to add to any request sent through a proxy. This works with urllib3 magic to ensure that they are correctly sent to the proxy, rather than in a tunnelled request if CONNECT is being used. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param proxy: The url of the proxy being used for this request. :rtype: dict zProxy-Authorization)rr()rXrrrrr,r,r-rs  zHTTPAdapter.proxy_headersFTc Csz|j||||d}Wn0tyF}zt||dWYd}~n d}~00|||j|||||} |j||||||d|jdupd|jv } t |t rz|\} } t | | d}Wn6t y}zd |} t | WYd}~n d}~00nt |t rn t ||d}zD| s:|j|j| |j|jdddd|j|d }nt|d rL|j}|jtd }z|j|j| d d |jD]\}}|||qv||jD]D}|tt|ddd|d|||dq|dz|jd d}Wnty|}Yn0tj |||ddd}Wn|!Yn0Wnt"t#j$fy} zt%| |dWYd} ~ njd} ~ 0t&y,}zt |j't(rt |j't)st*||dt |j't+rt,||dt |j't-rt.||dt |j't/r t0||dt%||dWYd}~nd}~0t1y\}zt%||dWYd}~nd}~0t-y}zt.|WYd}~nhd}~0t/t2fy}zBt |t/rt0||dnt |t3rt4||dnWYd}~n d}~00|5||S)aSends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response )r`r_rN)r]r^r/r_r`zContent-Length)connectrnzrInvalid timeout {}. Pass a (connect, read) timeout tuple, or a single float to set both timeouts to the same valueF) methodrDbodyrZredirectZassert_same_hostpreload_contentdecode_contentZretriesr^ proxy_pool)r^T)Zskip_accept_encodingr>rs s0 ) buffering)Zpoolrrr)6rrr'rrDrrrrrGrL TimeoutSaucerrZurlopenrrihasattrrZ _get_connDEFAULT_POOL_TIMEOUTZ putrequestrzZ putheaderZ endheadersrahexrMencodeZ getresponse TypeErrorrZ from_httplibrbrsocketerrorr!r rr r r"rr$ _ProxyErrorr _SSLErrorrr _HTTPErrorrr#r)rXr7r]r^r/r_r`rrrDZchunkedrrnerrrZlow_connheaderr}irr,r,r-ra5s "              "        zHTTPAdapter.send)N)NN)N)FNTNN)rcrdrerfrxDEFAULT_POOLSIZErqDEFAULT_POOLBLOCKrVryr~rsrrrrrrrbrrrrargr,r,rYr-rhs( %3% - /  rh)OrfZos.pathrIrtypingZurllib3.poolmanagerrrZurllib3.responserZ urllib3.utilrrrZurllib3.util.retryrZurllib3.util.ssl_rZurllib3.exceptionsr r r rr r rrrrrrrrZmodelsrcompatrrZutilsrrrrrrrZ structuresrrr exceptionsr!r"r#r$r%r&r'Zauthr(Zurllib3.contrib.socksr) ImportErrorrrrqrZsslr5Zload_verify_locationsDictrHAnyboolr6rRobjectrSrhr,r,r,r-sp                 $  ,    /adapters.cpython-39.pyc000064400000054075151116515220011012 0ustar00a /h7q@sNdZddlZddlZddlZddlmZmZddlm Z ddl m Z ddl m Z ddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlm Z ddl!m"Z"ddl#m$Z$m%Z%ddl&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3m4Z4m5Z5mZmZm6Z6m7Z7m8Z8m9Z9ddl:m;Z;zddlyddZ=Yn0dZ?d Z@dZAdZBz ddlCZCeZDeDEe(e'Wne>ydZDYn0d!d"ejFeGejHfeId#d$d%ZJd&d!d"d'd(d)d*d+ZKGd,d-d-eLZMGd.d/d/eMZNdS)0z requests.adapters ~~~~~~~~~~~~~~~~~ This module contains the transport adapters that Requests uses to define and maintain connections. N) PoolManagerproxy_from_url) HTTPResponse) parse_url)Timeout)Retry)create_urllib3_context)ClosedPoolError)ConnectTimeoutError) HTTPError) MaxRetryError)NewConnectionError) ProxyError) ProtocolError)ReadTimeoutError)SSLError) ResponseError)LocationValueError)Response)urlparse basestring)DEFAULT_CA_BUNDLE_PATHextract_zipped_pathsget_encoding_from_headersprepend_scheme_if_neededget_auth_from_url urldefragauth select_proxy)CaseInsensitiveDict)extract_cookies_to_jar) ConnectionErrorConnectTimeout ReadTimeoutrr RetryError InvalidSchemaInvalidProxyURL InvalidURL)_basic_auth_str)SOCKSProxyManagercOs tddS)Nz'Missing dependencies for SOCKS support.)r%)argskwargsr,5/usr/lib/python3.9/site-packages/requests/adapters.pyr)0sr)F zbool | str | Nonez#typing.Tuple[str, str] | str | None)verify client_certpoolmanager_kwargsreturncCs,|d}|duo&tduo&| o&|du}|S)N ssl_contextT)get_preloaded_ssl_context)r/r0r1Zhas_poolmanager_ssl_contextZshould_use_default_ssl_contextr,r,r-_should_use_default_contextEs r6ZPreparedRequestrz<(typing.Dict[str, typing.Any], typing.Dict[str, typing.Any]))requestr/r0 poolmanagerr2c Csi}i}t|j}|j}|j}t|di} d} d} |durDd} n6t||| rZt|d<n |durltt } nt |t rz|} | durt j | s| |d<n| |d<| |d <|durt |trt|d kr|d |d <|d |d<n||d <||j|d}||fS)NZconnection_pool_kw CERT_REQUIREDF CERT_NONEr3Tca_certs ca_cert_dir cert_reqsr cert_filerkey_file)schemehostport)rurlrAlowerrCgetattrr6r5rr isinstancestrospathisdirtuplelenhostname) r7r/r0r8 host_params pool_kwargsZparsed_request_urlrArCr1r=cert_locr,r,r-_urllib3_request_contextVs>          rRcs2eZdZdZfddZd ddZd d ZZS) BaseAdapterzThe Base Transport Adaptercstt|dSN)superrS__init__self __class__r,r-rVszBaseAdapter.__init__FNTcCstdS)aCSends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. NNotImplementedError)rXr7streamtimeoutr/certproxiesr,r,r-sendszBaseAdapter.sendcCstdS)z!Cleans up adapter specific items.Nr[rWr,r,r-closeszBaseAdapter.close)FNTNN)__name__ __module__ __qualname____doc__rVrarb __classcell__r,r,rYr-rSs   rScseZdZdZgdZeeeeffdd ZddZ ddZ efd d Z d d Z d dZ ddZd$ddZd%ddZd&ddZddZddZddZddZd'd"d#ZZS)( HTTPAdapteraThe built-in HTTP Adapter for urllib3. Provides a general-case interface for Requests sessions to contact HTTP and HTTPS urls by implementing the Transport Adapter interface. This class will usually be created by the :class:`Session ` class under the covers. :param pool_connections: The number of urllib3 connection pools to cache. :param pool_maxsize: The maximum number of connections to save in the pool. :param max_retries: The maximum number of retries each connection should attempt. Note, this applies only to failed DNS lookups, socket connections and connection timeouts, never to requests where data has made it to the server. By default, Requests does not retry failed connections. If you need granular control over the conditions under which we retry a request, import urllib3's ``Retry`` class and pass that instead. :param pool_block: Whether the connection pool should block for connections. Usage:: >>> import requests >>> s = requests.Session() >>> a = requests.adapters.HTTPAdapter(max_retries=3) >>> s.mount('http://', a) ) max_retriesconfig_pool_connections _pool_maxsize _pool_blockcsd|tkrtddd|_n t||_i|_i|_tt|||_ ||_ ||_ |j |||ddS)NrF)readblock) DEFAULT_RETRIESrriZfrom_intrj proxy_managerrUrhrVrkrlrminit_poolmanager)rXZpool_connectionsZ pool_maxsizeriZ pool_blockrYr,r-rVs zHTTPAdapter.__init__csfddjDS)Ncsi|]}|t|dqSrT)rF).0attrrWr,r- z,HTTPAdapter.__getstate__..) __attrs__rWr,rWr- __getstate__szHTTPAdapter.__getstate__cCsDi|_i|_|D]\}}t|||q|j|j|j|jddS)Nro)rrrjitemssetattrrsrkrlrm)rXstateruvaluer,r,r- __setstate__s zHTTPAdapter.__setstate__cKs0||_||_||_tf|||dd||_dS)aInitializes a urllib3 PoolManager. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param connections: The number of urllib3 connection pools to cache. :param maxsize: The maximum number of connections to save in the pool. :param block: Block when no free connections are available. :param pool_kwargs: Extra keyword arguments used to initialize the Pool Manager. T) num_poolsmaxsizerpstrictN)rkrlrmrr8)rXZ connectionsrrprPr,r,r-rss zHTTPAdapter.init_poolmanagercKs||jvr|j|}n||dr^t|\}}t|f|||j|j|jd|}|j|<n4||}t |f||j|j|jd|}|j|<|S)aReturn urllib3 ProxyManager for the given proxy. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param proxy: The proxy to return a urllib3 ProxyManager for. :param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager. :returns: ProxyManager :rtype: urllib3.ProxyManager socks)usernamepasswordrrrp) proxy_headersrrrp) rrrE startswithrr)rkrlrmrr)rXproxyZ proxy_kwargsZmanagerrrrr,r,r-proxy_manager_fors6    zHTTPAdapter.proxy_manager_forcCs|drZ|rZd|_|durl|}tj|s>td|tj|sR||_ql||_ nd|_d|_d|_ |rt |t s|d|_ |d|_ n ||_ d|_ |j rtj|j std |j |j rtj|j std |j dS) aAVerify a SSL certificate. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param conn: The urllib3 connection object associated with the cert. :param url: The requested URL. :param verify: Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: The SSL certificate to verify. httpsr9TzCCould not find a suitable TLS CA certificate bundle, invalid path: r:Nrrz9Could not find the TLS certificate file, invalid path: {}z1Could not find the TLS key file, invalid path: {})rErr=rIrJexistsOSErrorrKr;r<rGrr?r@IOErrorformat)rXconnrDr/r_rQr,r,r- cert_verifys<      zHTTPAdapter.cert_verifycCst}t|dd|_tt|di|_t|j|_||_|jj|_t |j t r^|j d|_ n|j |_ t |j||||_||_|S)aBuilds a :class:`Response ` object from a urllib3 response. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter ` :param req: The :class:`PreparedRequest ` used to generate the response. :param resp: The urllib3 response object. :rtype: requests.Response statusNheadersutf-8)rrFZ status_coderrrencodingrawreasonrGrDbytesdecoder cookiesr7 connection)rXZreqrespZresponser,r,r-build_responseLs    zHTTPAdapter.build_responseNcCst||||jS)a Build the PoolKey attributes used by urllib3 to return a connection. This looks at the PreparedRequest, the user-specified verify value, and the value of the cert parameter to determine what PoolKey values to use to select a connection from a given urllib3 Connection Pool. The SSL related pool key arguments are not consistently set. As of this writing, use the following to determine what keys may be in that dictionary: * If ``verify`` is ``True``, ``"ssl_context"`` will be set and will be the default Requests SSL Context * If ``verify`` is ``False``, ``"ssl_context"`` will not be set but ``"cert_reqs"`` will be set * If ``verify`` is a string, (i.e., it is a user-specified trust bundle) ``"ca_certs"`` will be set if the string is not a directory recognized by :py:func:`os.path.isdir`, otherwise ``"ca_certs_dir"`` will be set. * If ``"cert"`` is specified, ``"cert_file"`` will always be set. If ``"cert"`` is a tuple with a second item, ``"key_file"`` will also be present To override these settings, one may subclass this class, call this method and use the above logic to change parameters as desired. For example, if one wishes to use a custom :py:class:`ssl.SSLContext` one must both set ``"ssl_context"`` and based on what else they require, alter the other keys to ensure the desired behaviour. :param request: The PreparedReqest being sent over the connection. :type request: :class:`~requests.models.PreparedRequest` :param verify: Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. :param cert: (optional) Any user-provided SSL certificate for client authentication (a.k.a., mTLS). This may be a string (i.e., just the path to a file which holds both certificate and key) or a tuple of length 2 with the certificate file path and key file path. :returns: A tuple of two dictionaries. The first is the "host parameters" portion of the Pool Key including scheme, hostname, and port. The second is a dictionary of SSLContext related parameters. )rRr8)rXr7r/r_r,r,r-$build_connection_pool_key_attributesqs+z0HTTPAdapter.build_connection_pool_key_attributesc Cst|j|}z||||\}}Wn0tyR}zt||dWYd}~n d}~00|rt|d}t|} | jsxtd| |} | j fi|d|i} n|j j fi|d|i} | S)apReturns a urllib3 connection for the given request and TLS settings. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param request: The :class:`PreparedRequest ` object to be sent over the connection. :param verify: Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. :param proxies: (optional) The proxies dictionary to apply to the request. :param cert: (optional) Any user-provided SSL certificate to be used for client authentication (a.k.a., mTLS). :rtype: urllib3.ConnectionPool r7NhttpFPlease check proxy URL. It is malformed and could be missing the host.rP) rrDr ValueErrorr'rrrBr&rZconnection_from_hostr8) rXr7r/r`r_rrOrPe proxy_urlrrrr,r,r-get_connection_with_tls_contexts8  "    z+HTTPAdapter.get_connection_with_tls_contextcCsdt||}|rDt|d}t|}|js.td||}||}nt|}|}|j |}|S)aDEPRECATED: Users should move to `get_connection_with_tls_context` for all subclasses of HTTPAdapter using Requests>=2.32.2. Returns a urllib3 connection for the given URL. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param url: The URL to connect to. :param proxies: (optional) A Requests-style dictionary of proxies used on this request. :rtype: urllib3.ConnectionPool rr) rrrrBr&rZconnection_from_urlrgeturlr8)rXrDr`rrrrrparsedr,r,r-get_connections     zHTTPAdapter.get_connectioncCs&|j|jD] }|qdS)zDisposes of any internal state. Currently, this closes the PoolManager and any active ProxyManager, which closes any pooled connections. N)r8clearrrvalues)rXrr,r,r-rbs zHTTPAdapter.closec Cs`t|j|}t|jj}|o"|dk}d}|rDt|j}|d}|j}|r\|s\t|j}|S)a?Obtain the url to use when making the final request. If the message is being sent through a HTTP proxy, the full URL has to be used. Otherwise, we should only use the path portion of the URL. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param request: The :class:`PreparedRequest ` being sent. :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs. :rtype: str rFr)rrDrrArErZpath_urlr) rXr7r`rrAZis_proxied_http_requestZusing_socks_proxyZ proxy_schemerDr,r,r- request_urls     zHTTPAdapter.request_urlcKsdS)a"Add any headers needed by the connection. As of v2.0 this does nothing by default, but is left for overriding by users that subclass the :class:`HTTPAdapter `. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param request: The :class:`PreparedRequest ` to add headers to. :param kwargs: The keyword arguments from the call to send(). Nr,)rXr7r+r,r,r- add_headerss zHTTPAdapter.add_headerscCs&i}t|\}}|r"t|||d<|S)aReturns a dictionary of the headers to add to any request sent through a proxy. This works with urllib3 magic to ensure that they are correctly sent to the proxy, rather than in a tunnelled request if CONNECT is being used. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param proxy: The url of the proxy being used for this request. :rtype: dict zProxy-Authorization)rr()rXrrrrr,r,r-rs  zHTTPAdapter.proxy_headersFTc Csz|j||||d}Wn0tyF}zt||dWYd}~n d}~00|||j|||||} |j||||||d|jdupd|jv } t |t rz|\} } t | | d}Wn6t y}zd |} t | WYd}~n d}~00nt |t rn t ||d}zD| s:|j|j| |j|jdddd|j|d }nt|d rL|j}|jtd }z|j|j| d d |jD]\}}|||qv||jD]D}|tt|ddd|d|||dq|dz|jd d}Wnty|}Yn0tj |||ddd}Wn|!Yn0Wnt"t#j$fy} zt%| |dWYd} ~ njd} ~ 0t&y,}zt |j't(rt |j't)st*||dt |j't+rt,||dt |j't-rt.||dt |j't/r t0||dt%||dWYd}~nd}~0t1y\}zt%||dWYd}~nd}~0t-y}zt.|WYd}~nhd}~0t/t2fy}zBt |t/rt0||dnt |t3rt4||dnWYd}~n d}~00|5||S)aSends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response )r`r_rN)r]r^r/r_r`zContent-Length)connectrnzrInvalid timeout {}. Pass a (connect, read) timeout tuple, or a single float to set both timeouts to the same valueF) methodrDbodyrZredirectZassert_same_hostpreload_contentdecode_contentZretriesr^ proxy_pool)r^T)Zskip_accept_encodingr>rs s0 ) buffering)Zpoolrrr)6rrr'rrDrrrrrGrL TimeoutSaucerrZurlopenrrihasattrrZ _get_connDEFAULT_POOL_TIMEOUTZ putrequestrzZ putheaderZ endheadersrahexrMencodeZ getresponse TypeErrorrZ from_httplibrbrsocketerrorr!r rr r r"rr$ _ProxyErrorr _SSLErrorrr _HTTPErrorrr#r)rXr7r]r^r/r_r`rrrDZchunkedrrnerrrZlow_connheaderr}irr,r,r-ra5s "              "        zHTTPAdapter.send)N)NN)N)FNTNN)rcrdrerfrxDEFAULT_POOLSIZErqDEFAULT_POOLBLOCKrVryr~rsrrrrrrrbrrrrargr,r,rYr-rhs( %3% - /  rh)OrfZos.pathrIrtypingZurllib3.poolmanagerrrZurllib3.responserZ urllib3.utilrrrZurllib3.util.retryrZurllib3.util.ssl_rZurllib3.exceptionsr r r rr r rrrrrrrrZmodelsrcompatrrZutilsrrrrrrrZ structuresrrr exceptionsr!r"r#r$r%r&r'Zauthr(Zurllib3.contrib.socksr) ImportErrorrrrqrZsslr5Zload_verify_locationsDictrHAnyboolr6rRobjectrSrhr,r,r,r-sp                 $  ,    /api.cpython-39.opt-1.pyc000064400000015067151116515220010715 0ustar00a /h`@s\dZddlmZddZdddZdd Zd d Zdd d ZdddZdddZ ddZ dS)z requests.api ~~~~~~~~~~~~ This module implements the Requests API. :copyright: (c) 2012 by Kenneth Reitz. :license: Apache2, see LICENSE for more details. )sessionscKsBt&}|jf||d|WdS1s40YdS)a Constructs and sends a :class:`Request `. :param method: method for the new :class:`Request` object: ``GET``, ``OPTIONS``, ``HEAD``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary, list of tuples or bytes to send in the query string for the :class:`Request`. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`. :param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload. ``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')`` or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content-type'`` is a string defining the content type of the given file and ``custom_headers`` a dict-like object containing additional headers to add for the file. :param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth. :param timeout: (optional) How many seconds to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple :param allow_redirects: (optional) Boolean. Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection. Defaults to ``True``. :type allow_redirects: bool :param proxies: (optional) Dictionary mapping protocol to the URL of the proxy. :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. Defaults to ``True``. :param stream: (optional) if ``False``, the response content will be immediately downloaded. :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. :return: :class:`Response ` object :rtype: requests.Response Usage:: >>> import requests >>> req = requests.request('GET', 'https://httpbin.org/get') >>> req )methodurlN)rZSessionrequest)rrkwargsZsessionr0/usr/lib/python3.9/site-packages/requests/api.pyrs, rNcKs"|ddtd|fd|i|S)adSends a GET request. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary, list of tuples or bytes to send in the query string for the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response allow_redirectsTgetparams setdefaultr)rr rrrrr @s r cKs|ddtd|fi|S)zSends an OPTIONS request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response r Toptionsr rrrrrrOs rcKs|ddtd|fi|S)akSends a HEAD request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. If `allow_redirects` is not provided, it will be set to `False` (as opposed to the default :meth:`request` behavior). :return: :class:`Response ` object :rtype: requests.Response r Fheadr rrrrr\s rcKstd|f||d|S)aSends a POST request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json data to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response post)datajsonr)rrrrrrrrks rcKstd|fd|i|S)aSends a PUT request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json data to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response putrrrrrrrrrzs rcKstd|fd|i|S)aSends a PATCH request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json data to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response patchrrrrrrrs rcKstd|fi|S)zSends a DELETE request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response deleterrrrrrs r)N)NN)N)N) __doc__rrr rrrrrrrrrrs 0     api.cpython-39.pyc000064400000015067151116515220007756 0ustar00a /h`@s\dZddlmZddZdddZdd Zd d Zdd d ZdddZdddZ ddZ dS)z requests.api ~~~~~~~~~~~~ This module implements the Requests API. :copyright: (c) 2012 by Kenneth Reitz. :license: Apache2, see LICENSE for more details. )sessionscKsBt&}|jf||d|WdS1s40YdS)a Constructs and sends a :class:`Request `. :param method: method for the new :class:`Request` object: ``GET``, ``OPTIONS``, ``HEAD``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary, list of tuples or bytes to send in the query string for the :class:`Request`. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`. :param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload. ``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')`` or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content-type'`` is a string defining the content type of the given file and ``custom_headers`` a dict-like object containing additional headers to add for the file. :param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth. :param timeout: (optional) How many seconds to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple :param allow_redirects: (optional) Boolean. Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection. Defaults to ``True``. :type allow_redirects: bool :param proxies: (optional) Dictionary mapping protocol to the URL of the proxy. :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. Defaults to ``True``. :param stream: (optional) if ``False``, the response content will be immediately downloaded. :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. :return: :class:`Response ` object :rtype: requests.Response Usage:: >>> import requests >>> req = requests.request('GET', 'https://httpbin.org/get') >>> req )methodurlN)rZSessionrequest)rrkwargsZsessionr0/usr/lib/python3.9/site-packages/requests/api.pyrs, rNcKs"|ddtd|fd|i|S)adSends a GET request. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary, list of tuples or bytes to send in the query string for the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response allow_redirectsTgetparams setdefaultr)rr rrrrr @s r cKs|ddtd|fi|S)zSends an OPTIONS request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response r Toptionsr rrrrrrOs rcKs|ddtd|fi|S)akSends a HEAD request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. If `allow_redirects` is not provided, it will be set to `False` (as opposed to the default :meth:`request` behavior). :return: :class:`Response ` object :rtype: requests.Response r Fheadr rrrrr\s rcKstd|f||d|S)aSends a POST request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json data to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response post)datajsonr)rrrrrrrrks rcKstd|fd|i|S)aSends a PUT request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json data to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response putrrrrrrrrrzs rcKstd|fd|i|S)aSends a PATCH request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json data to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response patchrrrrrrrs rcKstd|fi|S)zSends a DELETE request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response deleterrrrrrs r)N)NN)N)N) __doc__rrr rrrrrrrrrrs 0     auth.cpython-39.opt-1.pyc000064400000020133151116515220011073 0ustar00a /h'@sdZddlZddlZddlZddlZddlZddlZddlmZddl m Z m Z m Z ddl mZddlmZddlmZd Zd Zd d ZGd ddeZGdddeZGdddeZGdddeZdS)z] requests.auth ~~~~~~~~~~~~~ This module contains the authentication handlers for Requests. N) b64encode)urlparsestr basestring)extract_cookies_to_jar)to_native_string)parse_dict_headerz!application/x-www-form-urlencodedzmultipart/form-datacCst|ts&tjd|tdt|}t|tsPtjdt|tdt|}t|trd|d}t|trx|d}dt t d ||f }|S)zReturns a Basic Auth string.zNon-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in ({!r}) to a string or bytes object in the near future to avoid problems.)categoryzNon-string passwords will no longer be supported in Requests 3.0.0. Please convert the object you've passed in ({!r}) to a string or bytes object in the near future to avoid problems.latin1zBasic :) isinstancerwarningswarnformatDeprecationWarningrtypeencoderrjoinstrip)usernamepasswordZauthstrr1/usr/lib/python3.9/site-packages/requests/auth.py_basic_auth_strs0      rc@seZdZdZddZdS)AuthBasez4Base class that all auth implementations derive fromcCs tddS)NzAuth hooks must be callable.)NotImplementedErrorselfrrrr__call__KszAuthBase.__call__N__name__ __module__ __qualname____doc__r rrrrrHsrc@s0eZdZdZddZddZddZdd Zd S) HTTPBasicAuthz?Attaches HTTP Basic Authentication to the given Request object.cCs||_||_dSN)rrrrrrrr__init__RszHTTPBasicAuth.__init__cCs(t|jt|ddk|jt|ddkgSNrrallrgetattrrrotherrrr__eq__VszHTTPBasicAuth.__eq__cCs ||k Sr'rr.rrr__ne__\szHTTPBasicAuth.__ne__cCst|j|j|jd<|S)N Authorizationrrrheadersrrrrr _szHTTPBasicAuth.__call__N)r"r#r$r%r)r0r1r rrrrr&Os r&c@seZdZdZddZdS) HTTPProxyAuthz=Attaches HTTP Proxy Authentication to a given Request object.cCst|j|j|jd<|S)NzProxy-Authorizationr3rrrrr gszHTTPProxyAuth.__call__Nr!rrrrr5dsr5c@sPeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ dS)HTTPDigestAuthz@Attaches HTTP Digest Authentication to the given Request object.cCs||_||_t|_dSr')rr threadinglocal _thread_localr(rrrr)oszHTTPDigestAuth.__init__cCs@t|jds.md5_utf8ZSHAcSs"t|tr|d}t|SrH)r rrrJsha1rKrLrrrsha_utf8s  z4HTTPDigestAuth.build_digest_header..sha_utf8zSHA-256cSs"t|tr|d}t|SrH)r rrrJZsha256rKrLrrr sha256_utf8s  z7HTTPDigestAuth.build_digest_header..sha256_utf8zSHA-512cSs"t|tr|d}t|SrH)r rrrJZsha512rKrLrrr sha512_utf8s  z7HTTPDigestAuth.build_digest_header..sha512_utf8csd||fS)N%s:%sr)sdZ hash_utf8rrz4HTTPDigestAuth.build_digest_header../?z%s:%s:%srSrz%08xrIZauth,z%s:%s:%s:%s:%sz>username="%s", realm="%s", nonce="%s", uri="%s", response="%s"z , opaque="%s"z, algorithm="%s"z , digest="%s"z , qop="auth", nc=%s, cnonce="%s"z Digest %s)r9r?getupperrpathqueryrrr=r>rrtimectimeosurandomrJrOrKsplit)rmethodurlrCrDrErFrGZ _algorithmrNrPrQrRZKDZentdigZp_parsedr`ZA1ZA2ZHA1ZHA2ZncvaluerTZcnonceZrespdigZnoncebitbaserrVrbuild_digest_headers            z"HTTPDigestAuth.build_digest_headercKs|jrd|j_dS)z)Reset num_401_calls counter on redirects.rN)Z is_redirectr9rA)rrkwargsrrrhandle_redirectszHTTPDigestAuth.handle_redirectcKs&d|jkrdks$nd|j_|S|jjdurB|jj|jj|jdd}d| vr|jjdkr|jjd7_t j d t j d }t |jd|dd |j_|j||j}t|j|j|j||j||j|j|jd <|jj|fi|}|j|||_|Sd|j_|S) zo Takes the given response and tries digest-auth, if needed. :rtype: requests.Response iirNzwww-authenticater;Zdigestzdigest )flags)countr2)Z status_coder9rAr@Zrequestbodyseekr4r^lowerrecompile IGNORECASEr subr?ZcontentclosecopyrZ_cookiesrawZprepare_cookiesrjrgrhZ connectionsendhistoryappend)rrrkZs_authpatZprepZ_rrrr handle_401s0      zHTTPDigestAuth.handle_401cCs|||jjr&||j|j|jd<z|j|j_ Wnt yRd|j_ Yn0| d|j | d|j d|j_|S)Nr2Zresponser)rBr9r=rjrgrhr4rptellr@AttributeErrorZ register_hookr~rlrArrrrr s zHTTPDigestAuth.__call__cCs(t|jt|ddk|jt|ddkgSr*r+r.rrrr0*szHTTPDigestAuth.__eq__cCs ||k Sr'rr.rrrr10szHTTPDigestAuth.__ne__N) r"r#r$r%r)rBrjrlr~r r0r1rrrrr6ls f,r6)r%rdrsrbrJr7rbase64rcompatrrrZcookiesrZ_internal_utilsrZutilsr ZCONTENT_TYPE_FORM_URLENCODEDZCONTENT_TYPE_MULTI_PARTrobjectrr&r5r6rrrrs$    ,auth.cpython-39.pyc000064400000020133151116515220010134 0ustar00a /h'@sdZddlZddlZddlZddlZddlZddlZddlmZddl m Z m Z m Z ddl mZddlmZddlmZd Zd Zd d ZGd ddeZGdddeZGdddeZGdddeZdS)z] requests.auth ~~~~~~~~~~~~~ This module contains the authentication handlers for Requests. N) b64encode)urlparsestr basestring)extract_cookies_to_jar)to_native_string)parse_dict_headerz!application/x-www-form-urlencodedzmultipart/form-datacCst|ts&tjd|tdt|}t|tsPtjdt|tdt|}t|trd|d}t|trx|d}dt t d ||f }|S)zReturns a Basic Auth string.zNon-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in ({!r}) to a string or bytes object in the near future to avoid problems.)categoryzNon-string passwords will no longer be supported in Requests 3.0.0. Please convert the object you've passed in ({!r}) to a string or bytes object in the near future to avoid problems.latin1zBasic :) isinstancerwarningswarnformatDeprecationWarningrtypeencoderrjoinstrip)usernamepasswordZauthstrr1/usr/lib/python3.9/site-packages/requests/auth.py_basic_auth_strs0      rc@seZdZdZddZdS)AuthBasez4Base class that all auth implementations derive fromcCs tddS)NzAuth hooks must be callable.)NotImplementedErrorselfrrrr__call__KszAuthBase.__call__N__name__ __module__ __qualname____doc__r rrrrrHsrc@s0eZdZdZddZddZddZdd Zd S) HTTPBasicAuthz?Attaches HTTP Basic Authentication to the given Request object.cCs||_||_dSN)rrrrrrrr__init__RszHTTPBasicAuth.__init__cCs(t|jt|ddk|jt|ddkgSNrrallrgetattrrrotherrrr__eq__VszHTTPBasicAuth.__eq__cCs ||k Sr'rr.rrr__ne__\szHTTPBasicAuth.__ne__cCst|j|j|jd<|S)N Authorizationrrrheadersrrrrr _szHTTPBasicAuth.__call__N)r"r#r$r%r)r0r1r rrrrr&Os r&c@seZdZdZddZdS) HTTPProxyAuthz=Attaches HTTP Proxy Authentication to a given Request object.cCst|j|j|jd<|S)NzProxy-Authorizationr3rrrrr gszHTTPProxyAuth.__call__Nr!rrrrr5dsr5c@sPeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ dS)HTTPDigestAuthz@Attaches HTTP Digest Authentication to the given Request object.cCs||_||_t|_dSr')rr threadinglocal _thread_localr(rrrr)oszHTTPDigestAuth.__init__cCs@t|jds.md5_utf8ZSHAcSs"t|tr|d}t|SrH)r rrrJsha1rKrLrrrsha_utf8s  z4HTTPDigestAuth.build_digest_header..sha_utf8zSHA-256cSs"t|tr|d}t|SrH)r rrrJZsha256rKrLrrr sha256_utf8s  z7HTTPDigestAuth.build_digest_header..sha256_utf8zSHA-512cSs"t|tr|d}t|SrH)r rrrJZsha512rKrLrrr sha512_utf8s  z7HTTPDigestAuth.build_digest_header..sha512_utf8csd||fS)N%s:%sr)sdZ hash_utf8rrz4HTTPDigestAuth.build_digest_header../?z%s:%s:%srSrz%08xrIZauth,z%s:%s:%s:%s:%sz>username="%s", realm="%s", nonce="%s", uri="%s", response="%s"z , opaque="%s"z, algorithm="%s"z , digest="%s"z , qop="auth", nc=%s, cnonce="%s"z Digest %s)r9r?getupperrpathqueryrrr=r>rrtimectimeosurandomrJrOrKsplit)rmethodurlrCrDrErFrGZ _algorithmrNrPrQrRZKDZentdigZp_parsedr`ZA1ZA2ZHA1ZHA2ZncvaluerTZcnonceZrespdigZnoncebitbaserrVrbuild_digest_headers            z"HTTPDigestAuth.build_digest_headercKs|jrd|j_dS)z)Reset num_401_calls counter on redirects.rN)Z is_redirectr9rA)rrkwargsrrrhandle_redirectszHTTPDigestAuth.handle_redirectcKs&d|jkrdks$nd|j_|S|jjdurB|jj|jj|jdd}d| vr|jjdkr|jjd7_t j d t j d }t |jd|dd |j_|j||j}t|j|j|j||j||j|j|jd <|jj|fi|}|j|||_|Sd|j_|S) zo Takes the given response and tries digest-auth, if needed. :rtype: requests.Response iirNzwww-authenticater;Zdigestzdigest )flags)countr2)Z status_coder9rAr@Zrequestbodyseekr4r^lowerrecompile IGNORECASEr subr?ZcontentclosecopyrZ_cookiesrawZprepare_cookiesrjrgrhZ connectionsendhistoryappend)rrrkZs_authpatZprepZ_rrrr handle_401s0      zHTTPDigestAuth.handle_401cCs|||jjr&||j|j|jd<z|j|j_ Wnt yRd|j_ Yn0| d|j | d|j d|j_|S)Nr2Zresponser)rBr9r=rjrgrhr4rptellr@AttributeErrorZ register_hookr~rlrArrrrr s zHTTPDigestAuth.__call__cCs(t|jt|ddk|jt|ddkgSr*r+r.rrrr0*szHTTPDigestAuth.__eq__cCs ||k Sr'rr.rrrr10szHTTPDigestAuth.__ne__N) r"r#r$r%r)rBrjrlr~r r0r1rrrrr6ls f,r6)r%rdrsrbrJr7rbase64rcompatrrrZcookiesrZ_internal_utilsrZutilsr ZCONTENT_TYPE_FORM_URLENCODEDZCONTENT_TYPE_MULTI_PARTrobjectrr&r5r6rrrrs$    ,certs.cpython-39.opt-1.pyc000064400000001500151116515220011247 0ustar00a /h@s"dZddZedkreedS)u requests.certs ~~~~~~~~~~~~~~ This module returns the preferred default CA certificate bundle. There is only one — the one from the certifi package. If you are packaging Requests, e.g., for a Linux distribution or a managed environment, you can change the definition of where() to return a separately packaged CA bundle. This Fedora-patched package returns "/etc/pki/tls/certs/ca-bundle.crt" provided by the ca-certificates RPM package. cCsdS)z1Return the absolute path to the system CA bundle.z /etc/pki/tls/certs/ca-bundle.crtrrr2/usr/lib/python3.9/site-packages/requests/certs.pywheresr__main__N)__doc__r__name__printrrrrscerts.cpython-39.pyc000064400000001500151116515220010310 0ustar00a /h@s"dZddZedkreedS)u requests.certs ~~~~~~~~~~~~~~ This module returns the preferred default CA certificate bundle. There is only one — the one from the certifi package. If you are packaging Requests, e.g., for a Linux distribution or a managed environment, you can change the definition of where() to return a separately packaged CA bundle. This Fedora-patched package returns "/etc/pki/tls/certs/ca-bundle.crt" provided by the ca-certificates RPM package. cCsdS)z1Return the absolute path to the system CA bundle.z /etc/pki/tls/certs/ca-bundle.crtrrr2/usr/lib/python3.9/site-packages/requests/certs.pywheresr__main__N)__doc__r__name__printrrrrscompat.cpython-39.opt-1.pyc000064400000003105151116515220011415 0ustar00a /h@sdZddlZddlZejZeddkZeddkZz ddlZWne yXddlZYn0erddl m Z m Z m Z mZmZmZmZmZmZddlmZmZmZmZmZddlmZddlZddlmZdd lmZdd lm Z m!Z!m"Z"m#Z#e$Z%e$Z&e'Z$e(Z(e)e*e+fZ,e)e*fZ-nerdd l.mZmZmZmZmZm Z m Z m Z mZmZdd l/mZmZmZmZmZdd l0m1Zddl2mZdd l3mZddlm#Z#ddl4m Z m!Z!m"Z"e$Z%e$Z$e&Z&e$e&fZ(e)e+fZ,e)fZ-dS)zq requests.compat ~~~~~~~~~~~~~~~ This module handles import compatibility issues between Python 2 and Python 3. N) quoteunquote quote_plus unquote_plus urlencode getproxies proxy_bypassproxy_bypass_environmentgetproxies_environment)urlparse urlunparseurljoinurlsplit urldefrag)parse_http_list)Morsel)StringIO)CallableMappingMutableMapping OrderedDict) r rrrrrrrrr)rr r r r ) cookiejar)r)rrr)5__doc__Zchardetsys version_infoZ_verZis_py2Zis_py3Z simplejsonZjson ImportErrorZurllibrrrrrr r r r r rrrrZurllib2rZ cookielibZCookierr collectionsrrrrstrZ builtin_strbytesZunicodeZ basestringintZlongfloatZ numeric_typesZ integer_types urllib.parseZurllib.requesthttprZ http.cookiesiocollections.abcr'r'3/usr/lib/python3.9/site-packages/requests/compat.pysJ    ,     0    compat.cpython-39.pyc000064400000003105151116515220010456 0ustar00a /h@sdZddlZddlZejZeddkZeddkZz ddlZWne yXddlZYn0erddl m Z m Z m Z mZmZmZmZmZmZddlmZmZmZmZmZddlmZddlZddlmZdd lmZdd lm Z m!Z!m"Z"m#Z#e$Z%e$Z&e'Z$e(Z(e)e*e+fZ,e)e*fZ-nerdd l.mZmZmZmZmZm Z m Z m Z mZmZdd l/mZmZmZmZmZdd l0m1Zddl2mZdd l3mZddlm#Z#ddl4m Z m!Z!m"Z"e$Z%e$Z$e&Z&e$e&fZ(e)e+fZ,e)fZ-dS)zq requests.compat ~~~~~~~~~~~~~~~ This module handles import compatibility issues between Python 2 and Python 3. N) quoteunquote quote_plus unquote_plus urlencode getproxies proxy_bypassproxy_bypass_environmentgetproxies_environment)urlparse urlunparseurljoinurlsplit urldefrag)parse_http_list)Morsel)StringIO)CallableMappingMutableMapping OrderedDict) r rrrrrrrrr)rr r r r ) cookiejar)r)rrr)5__doc__Zchardetsys version_infoZ_verZis_py2Zis_py3Z simplejsonZjson ImportErrorZurllibrrrrrr r r r r rrrrZurllib2rZ cookielibZCookierr collectionsrrrrstrZ builtin_strbytesZunicodeZ basestringintZlongfloatZ numeric_typesZ integer_types urllib.parseZurllib.requesthttprZ http.cookiesiocollections.abcr'r'3/usr/lib/python3.9/site-packages/requests/compat.pysJ    ,     0    cookies.cpython-39.opt-1.pyc000064400000044526151116515220011602 0ustar00a /hG@sdZddlZddlZddlZddlmZddlmZmZm Z m Z m Z z ddl Z Wne yjddlZ Yn0GdddeZGdd d eZd d Zd d ZdddZGdddeZGdddeje ZddZddZddZd ddZddZdS)!z requests.cookies ~~~~~~~~~~~~~~~~ Compatibility code to be able to use `cookielib.CookieJar` with requests. requests.utils imports from here, so be careful with imports. N)to_native_string) cookieliburlparse urlunparseMorselMutableMappingc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ dddZ ddZ ddZ ddZeddZeddZeddZdS) MockRequestaWraps a `requests.Request` to mimic a `urllib2.Request`. The code in `cookielib.CookieJar` expects this interface in order to correctly manage cookie policies, i.e., determine whether a cookie can be set, given the domains of the request and the cookie. The original request object is read-only. The client is responsible for collecting the new headers via `get_new_headers()` and interpreting them appropriately. You probably want `get_cookie_header`, defined below. cCs ||_i|_t|jjj|_dSN)_r _new_headersrurlschemetype)selfrequestr4/usr/lib/python3.9/site-packages/requests/cookies.py__init__%szMockRequest.__init__cCs|jSr )rrrrrget_type*szMockRequest.get_typecCst|jjjSr )rr r netlocrrrrget_host-szMockRequest.get_hostcCs|Sr rrrrrget_origin_req_host0szMockRequest.get_origin_req_hostcCsT|jjds|jjSt|jjddd}t|jj}t|j||j|j |j |j gS)NZHostzutf-8)encoding) r headersgetr rrrrpathparamsqueryfragment)rhostparsedrrr get_full_url3s zMockRequest.get_full_urlcCsdSNTrrrrris_unverifiableAszMockRequest.is_unverifiablecCs||jjvp||jvSr )r rr rnamerrr has_headerDszMockRequest.has_headerNcCs|jj||j||Sr )r rrr )rr(defaultrrr get_headerGszMockRequest.get_headercCs tddS)zMcookielib has no legitimate use for this method; add it back if you find one.z=Cookie headers should be added with add_unredirected_header()N)NotImplementedError)rkeyvalrrr add_headerJszMockRequest.add_headercCs||j|<dSr r rr(valuerrradd_unredirected_headerNsz#MockRequest.add_unredirected_headercCs|jSr r0rrrrget_new_headersQszMockRequest.get_new_headerscCs|Sr )r&rrrr unverifiableTszMockRequest.unverifiablecCs|Sr )rrrrrorigin_req_hostXszMockRequest.origin_req_hostcCs|Sr rrrrrr"\szMockRequest.host)N)__name__ __module__ __qualname____doc__rrrrr$r&r)r+r/r3r4propertyr5r6r"rrrrr s$    r c@s(eZdZdZddZddZddZdS) MockResponsezWraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`. ...what? Basically, expose the parsed HTTP headers from the server response the way `cookielib` expects to see them. cCs ||_dS)zMake a MockResponse for `cookielib` to read. :param headers: a httplib.HTTPMessage or analogous carrying the headers N_headers)rrrrrrhszMockResponse.__init__cCs|jSr r=rrrrinfooszMockResponse.infocCs|j|dSr )r> getheadersr'rrrr@rszMockResponse.getheadersN)r7r8r9r:rr?r@rrrrr<asr<cCs8t|dr|jsdSt|}t|jj}|||dS)zExtract the cookies from the response into a CookieJar. :param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar) :param request: our own requests.Request object :param response: urllib3.HTTPResponse object _original_responseN)hasattrrAr r<msgZextract_cookies)jarrZresponseZreqresrrrextract_cookies_to_jarvs  rFcCs t|}|||dS)zj Produce an appropriate Cookie header string to be sent with `request`, or None. :rtype: str Cookie)r Zadd_cookie_headerr4r)rDrrrrrget_cookie_headers rIcCszg}|D]N}|j|krq|dur,||jkr,q|dur@||jkr@q||j|j|jfq|D]\}}}||||q\dS)zkUnsets a cookie by name, by default over all domains and paths. Wraps CookieJar.clear(), is O(n). N)r(domainrappendclear) cookiejarr(rJrZ clearablescookierrrremove_cookie_by_names rOc@seZdZdZdS)CookieConflictErrorzThere are two cookies that meet the criteria specified in the cookie jar. Use .get and .set and include domain and path args in order to be more specific. N)r7r8r9r:rrrrrPsrPcseZdZdZd3ddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZd4ddZfddZddZdd Zd!d"Zfd#d$Zfd%d&Zd5d'd(Zd6d)d*Zd+d,Zd-d.Zd/d0Zd1d2ZZS)7RequestsCookieJaraCompatibility class; is a cookielib.CookieJar, but exposes a dict interface. This is the CookieJar we create by default for requests and sessions that don't specify one, since some clients may expect response.cookies and session.cookies to support dict operations. Requests does not use the dict interface internally; it's just for compatibility with external client code. All requests code should work out of the box with externally provided instances of ``CookieJar``, e.g. ``LWPCookieJar`` and ``FileCookieJar``. Unlike a regular CookieJar, this class is pickleable. .. warning:: dictionary operations that are normally O(1) may be O(n). NcCs,z||||WSty&|YS0dS)zDict-like get() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains. .. warning:: operation is O(n), not O(1). N)_find_no_duplicatesKeyError)rr(r*rJrrrrrs zRequestsCookieJar.getcKs\|dur(t|||d|dddSt|tr|j|kr |durRtd||j}q |rb|Std|||fdS)aBoth ``__get_item__`` and ``get`` call this function: it's never used elsewhere in Requests. :param name: a string containing name of cookie :param domain: (optional) string containing domain of cookie :param path: (optional) string containing path of cookie :raises KeyError: if cookie is not found :raises CookieConflictError: if there are multiple cookies that match name and optionally domain and path :return: cookie.value Nz(There are multiple cookies with name, %rr|)r[r(rJrrPr2rS)rr(rJrZtoReturnrNrrrrRxs    z%RequestsCookieJar._find_no_duplicatescCs|j}|d|S)4Unlike a normal CookieJar, this class is pickleable. _cookies_lock)__dict__rypoprstaterrr __getstate__s  zRequestsCookieJar.__getstate__cCs$|j|d|jvr t|_dS)r~rN)rrz threadingRLockrrrrr __setstate__s  zRequestsCookieJar.__setstate__cCs"t}|||||S)z(Return a copy of this RequestsCookieJar.)rQZ set_policy get_policyrz)rZnew_cjrrrrys zRequestsCookieJar.copycCs|jS)z&Return the CookiePolicy instance used.)Z_policyrrrrrszRequestsCookieJar.get_policy)NNN)NN)NN)NN)r7r8r9r:rrZr]r_r`rarbrcrfrhrirjrlrorprqrWrzr}rRrrryr __classcell__rrrmrrQs2            rQcCsN|dur dSt|dr|St|}||D]}|t|q4|S)Nry)rBryrLrW)rDZnew_jarrNrrr_copy_cookie_jars  rcKsd||ddddddddddidd }t|t|}|rLd }t|t|||t|d |d <t|d |d <|d d|d<t|d|d<tjfi|S)zMake a cookie from underspecified parameters. By default, the pair of `name` and `value` will be set for the domain '' and sent on every request (this is sometimes called a "supercookie"). rNrt/FTHttpOnly) versionr(r2portrJrsecureexpiresdiscardcomment comment_urlrestrfc2109z4create_cookie() got unexpected keyword arguments: %srZport_specifiedrJZdomain_specified.Zdomain_initial_dotrZpath_specified)rZ TypeErrorr^rzboolrrrrG)r(r2rXresultZbadargserrrrrrVs0 rVcCsd}|drNzttt|d}WqptyJtd|dYqp0n"|drpd}tt|d|}t|dt|dd|d||j |d dd |d idt|d |j |d pdd S)zBConvert a Morsel object into a Cookie containing the one k/v pair.Nzmax-agezmax-age: %s must be integerrz%a, %d-%b-%Y %H:%M:%S GMTrFrJrrZhttponlyrrr) rrrrJrr(rrrrrr2r) inttime ValueErrorrcalendarZtimegmstrptimerVrr-r2)ZmorselrZ time_templaterrrrUs4     rUTcCsR|durt}|durNdd|D}|D]$}|s8||vr(|t|||q(|S)aCReturns a CookieJar from a key/value dictionary. :param cookie_dict: Dict of key/values to insert into CookieJar. :param cookiejar: (optional) A cookiejar to add the cookies to. :param overwrite: (optional) If False, will not replace cookies already in the jar with new ones. :rtype: CookieJar NcSsg|] }|jqSr)r().0rNrrr z'cookiejar_from_dict..)rQrWrV)Z cookie_dictrM overwriteZnames_from_jarr(rrrcookiejar_from_dicts  rcCstt|tjstdt|tr.t||dd}nBt|tjrpz||Wn&tyn|D]}||qZYn0|S)zAdd cookies to cookiejar and returns a merged CookieJar. :param cookiejar: CookieJar object to add the cookies to. :param cookies: Dictionary or CookieJar object to be added. :rtype: CookieJar z!You can only merge into CookieJarF)rMr) rTrrxrdictrrzAttributeErrorrW)rMZcookiesZ cookie_in_jarrrr merge_cookiess    r)NN)NT)r:ryrrZ_internal_utilsrcompatrrrrrr ImportErrorZdummy_threadingobjectr r<rFrIrO RuntimeErrorrPrxrQrrVrUrrrrrrs.    H $ cookies.cpython-39.pyc000064400000044526151116515220010643 0ustar00a /hG@sdZddlZddlZddlZddlmZddlmZmZm Z m Z m Z z ddl Z Wne yjddlZ Yn0GdddeZGdd d eZd d Zd d ZdddZGdddeZGdddeje ZddZddZddZd ddZddZdS)!z requests.cookies ~~~~~~~~~~~~~~~~ Compatibility code to be able to use `cookielib.CookieJar` with requests. requests.utils imports from here, so be careful with imports. N)to_native_string) cookieliburlparse urlunparseMorselMutableMappingc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ dddZ ddZ ddZ ddZeddZeddZeddZdS) MockRequestaWraps a `requests.Request` to mimic a `urllib2.Request`. The code in `cookielib.CookieJar` expects this interface in order to correctly manage cookie policies, i.e., determine whether a cookie can be set, given the domains of the request and the cookie. The original request object is read-only. The client is responsible for collecting the new headers via `get_new_headers()` and interpreting them appropriately. You probably want `get_cookie_header`, defined below. cCs ||_i|_t|jjj|_dSN)_r _new_headersrurlschemetype)selfrequestr4/usr/lib/python3.9/site-packages/requests/cookies.py__init__%szMockRequest.__init__cCs|jSr )rrrrrget_type*szMockRequest.get_typecCst|jjjSr )rr r netlocrrrrget_host-szMockRequest.get_hostcCs|Sr rrrrrget_origin_req_host0szMockRequest.get_origin_req_hostcCsT|jjds|jjSt|jjddd}t|jj}t|j||j|j |j |j gS)NZHostzutf-8)encoding) r headersgetr rrrrpathparamsqueryfragment)rhostparsedrrr get_full_url3s zMockRequest.get_full_urlcCsdSNTrrrrris_unverifiableAszMockRequest.is_unverifiablecCs||jjvp||jvSr )r rr rnamerrr has_headerDszMockRequest.has_headerNcCs|jj||j||Sr )r rrr )rr(defaultrrr get_headerGszMockRequest.get_headercCs tddS)zMcookielib has no legitimate use for this method; add it back if you find one.z=Cookie headers should be added with add_unredirected_header()N)NotImplementedError)rkeyvalrrr add_headerJszMockRequest.add_headercCs||j|<dSr r rr(valuerrradd_unredirected_headerNsz#MockRequest.add_unredirected_headercCs|jSr r0rrrrget_new_headersQszMockRequest.get_new_headerscCs|Sr )r&rrrr unverifiableTszMockRequest.unverifiablecCs|Sr )rrrrrorigin_req_hostXszMockRequest.origin_req_hostcCs|Sr rrrrrr"\szMockRequest.host)N)__name__ __module__ __qualname____doc__rrrrr$r&r)r+r/r3r4propertyr5r6r"rrrrr s$    r c@s(eZdZdZddZddZddZdS) MockResponsezWraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`. ...what? Basically, expose the parsed HTTP headers from the server response the way `cookielib` expects to see them. cCs ||_dS)zMake a MockResponse for `cookielib` to read. :param headers: a httplib.HTTPMessage or analogous carrying the headers N_headers)rrrrrrhszMockResponse.__init__cCs|jSr r=rrrrinfooszMockResponse.infocCs|j|dSr )r> getheadersr'rrrr@rszMockResponse.getheadersN)r7r8r9r:rr?r@rrrrr<asr<cCs8t|dr|jsdSt|}t|jj}|||dS)zExtract the cookies from the response into a CookieJar. :param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar) :param request: our own requests.Request object :param response: urllib3.HTTPResponse object _original_responseN)hasattrrAr r<msgZextract_cookies)jarrZresponseZreqresrrrextract_cookies_to_jarvs  rFcCs t|}|||dS)zj Produce an appropriate Cookie header string to be sent with `request`, or None. :rtype: str Cookie)r Zadd_cookie_headerr4r)rDrrrrrget_cookie_headers rIcCszg}|D]N}|j|krq|dur,||jkr,q|dur@||jkr@q||j|j|jfq|D]\}}}||||q\dS)zkUnsets a cookie by name, by default over all domains and paths. Wraps CookieJar.clear(), is O(n). N)r(domainrappendclear) cookiejarr(rJrZ clearablescookierrrremove_cookie_by_names rOc@seZdZdZdS)CookieConflictErrorzThere are two cookies that meet the criteria specified in the cookie jar. Use .get and .set and include domain and path args in order to be more specific. N)r7r8r9r:rrrrrPsrPcseZdZdZd3ddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZd4ddZfddZddZdd Zd!d"Zfd#d$Zfd%d&Zd5d'd(Zd6d)d*Zd+d,Zd-d.Zd/d0Zd1d2ZZS)7RequestsCookieJaraCompatibility class; is a cookielib.CookieJar, but exposes a dict interface. This is the CookieJar we create by default for requests and sessions that don't specify one, since some clients may expect response.cookies and session.cookies to support dict operations. Requests does not use the dict interface internally; it's just for compatibility with external client code. All requests code should work out of the box with externally provided instances of ``CookieJar``, e.g. ``LWPCookieJar`` and ``FileCookieJar``. Unlike a regular CookieJar, this class is pickleable. .. warning:: dictionary operations that are normally O(1) may be O(n). NcCs,z||||WSty&|YS0dS)zDict-like get() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains. .. warning:: operation is O(n), not O(1). N)_find_no_duplicatesKeyError)rr(r*rJrrrrrs zRequestsCookieJar.getcKs\|dur(t|||d|dddSt|tr|j|kr |durRtd||j}q |rb|Std|||fdS)aBoth ``__get_item__`` and ``get`` call this function: it's never used elsewhere in Requests. :param name: a string containing name of cookie :param domain: (optional) string containing domain of cookie :param path: (optional) string containing path of cookie :raises KeyError: if cookie is not found :raises CookieConflictError: if there are multiple cookies that match name and optionally domain and path :return: cookie.value Nz(There are multiple cookies with name, %rr|)r[r(rJrrPr2rS)rr(rJrZtoReturnrNrrrrRxs    z%RequestsCookieJar._find_no_duplicatescCs|j}|d|S)4Unlike a normal CookieJar, this class is pickleable. _cookies_lock)__dict__rypoprstaterrr __getstate__s  zRequestsCookieJar.__getstate__cCs$|j|d|jvr t|_dS)r~rN)rrz threadingRLockrrrrr __setstate__s  zRequestsCookieJar.__setstate__cCs"t}|||||S)z(Return a copy of this RequestsCookieJar.)rQZ set_policy get_policyrz)rZnew_cjrrrrys zRequestsCookieJar.copycCs|jS)z&Return the CookiePolicy instance used.)Z_policyrrrrrszRequestsCookieJar.get_policy)NNN)NN)NN)NN)r7r8r9r:rrZr]r_r`rarbrcrfrhrirjrlrorprqrWrzr}rRrrryr __classcell__rrrmrrQs2            rQcCsN|dur dSt|dr|St|}||D]}|t|q4|S)Nry)rBryrLrW)rDZnew_jarrNrrr_copy_cookie_jars  rcKsd||ddddddddddidd }t|t|}|rLd }t|t|||t|d |d <t|d |d <|d d|d<t|d|d<tjfi|S)zMake a cookie from underspecified parameters. By default, the pair of `name` and `value` will be set for the domain '' and sent on every request (this is sometimes called a "supercookie"). rNrt/FTHttpOnly) versionr(r2portrJrsecureexpiresdiscardcomment comment_urlrestrfc2109z4create_cookie() got unexpected keyword arguments: %srZport_specifiedrJZdomain_specified.Zdomain_initial_dotrZpath_specified)rZ TypeErrorr^rzboolrrrrG)r(r2rXresultZbadargserrrrrrVs0 rVcCsd}|drNzttt|d}WqptyJtd|dYqp0n"|drpd}tt|d|}t|dt|dd|d||j |d dd |d idt|d |j |d pdd S)zBConvert a Morsel object into a Cookie containing the one k/v pair.Nzmax-agezmax-age: %s must be integerrz%a, %d-%b-%Y %H:%M:%S GMTrFrJrrZhttponlyrrr) rrrrJrr(rrrrrr2r) inttime ValueErrorrcalendarZtimegmstrptimerVrr-r2)ZmorselrZ time_templaterrrrUs4     rUTcCsR|durt}|durNdd|D}|D]$}|s8||vr(|t|||q(|S)aCReturns a CookieJar from a key/value dictionary. :param cookie_dict: Dict of key/values to insert into CookieJar. :param cookiejar: (optional) A cookiejar to add the cookies to. :param overwrite: (optional) If False, will not replace cookies already in the jar with new ones. :rtype: CookieJar NcSsg|] }|jqSr)r().0rNrrr z'cookiejar_from_dict..)rQrWrV)Z cookie_dictrM overwriteZnames_from_jarr(rrrcookiejar_from_dicts  rcCstt|tjstdt|tr.t||dd}nBt|tjrpz||Wn&tyn|D]}||qZYn0|S)zAdd cookies to cookiejar and returns a merged CookieJar. :param cookiejar: CookieJar object to add the cookies to. :param cookies: Dictionary or CookieJar object to be added. :rtype: CookieJar z!You can only merge into CookieJarF)rMr) rTrrxrdictrrzAttributeErrorrW)rMZcookiesZ cookie_in_jarrrr merge_cookiess    r)NN)NT)r:ryrrZ_internal_utilsrcompatrrrrrr ImportErrorZdummy_threadingobjectr r<rFrIrO RuntimeErrorrPrxrQrrVrUrrrrrrs.    H $ exceptions.cpython-39.opt-1.pyc000064400000012101151116515220012307 0ustar00a /hY @sdZddlmZGdddeZGdddeZGdddeZGd d d eZGd d d eZGd ddeZ Gdddee Z Gddde Z GdddeZ GdddeZ GdddeeZGdddeeZGdddeeZGdddeeZGdd d eZGd!d"d"eZGd#d$d$eeZGd%d&d&eeZGd'd(d(eZGd)d*d*eZGd+d,d,eZGd-d.d.eeZGd/d0d0eZd1S)2z` requests.exceptions ~~~~~~~~~~~~~~~~~~~ This module contains the set of Requests' exceptions. ) HTTPErrorcs eZdZdZfddZZS)RequestExceptionzTThere was an ambiguous exception that occurred while handling your request. cs\|dd}||_|dd|_|durB|jsBt|drB|jj|_tt|j|i|dS)zBInitialize RequestException with `request` and `response` objects.responseNrequest)poprrhasattrsuperr__init__)selfargskwargsr __class__7/usr/lib/python3.9/site-packages/requests/exceptions.pyr s  zRequestException.__init__)__name__ __module__ __qualname____doc__r __classcell__rrr rr src@seZdZdZdS)rzAn HTTP error occurred.Nrrrrrrrrrsrc@seZdZdZdS)ConnectionErrorzA Connection error occurred.Nrrrrrr src@seZdZdZdS) ProxyErrorzA proxy error occurred.Nrrrrrr$src@seZdZdZdS)SSLErrorzAn SSL error occurred.Nrrrrrr(src@seZdZdZdS)TimeoutzThe request timed out. Catching this error will catch both :exc:`~requests.exceptions.ConnectTimeout` and :exc:`~requests.exceptions.ReadTimeout` errors. Nrrrrrr,src@seZdZdZdS)ConnectTimeoutzThe request timed out while trying to connect to the remote server. Requests that produced this error are safe to retry. Nrrrrrr5src@seZdZdZdS) ReadTimeoutz@The server did not send any data in the allotted amount of time.Nrrrrrr<src@seZdZdZdS) URLRequiredz*A valid URL is required to make a request.Nrrrrrr@src@seZdZdZdS)TooManyRedirectszToo many redirects.NrrrrrrDsrc@seZdZdZdS) MissingSchemaz/The URL schema (e.g. http or https) is missing.NrrrrrrHsrc@seZdZdZdS) InvalidSchemaz"See defaults.py for valid schemas.Nrrrrrr Lsr c@seZdZdZdS) InvalidURLz%The URL provided was somehow invalid.Nrrrrrr!Psr!c@seZdZdZdS) InvalidHeaderz.The header value provided was somehow invalid.Nrrrrrr"Tsr"c@seZdZdZdS)InvalidProxyURLz"The proxy URL provided is invalid.Nrrrrrr#Xsr#c@seZdZdZdS)ChunkedEncodingErrorz?The server declared chunked encoding but sent an invalid chunk.Nrrrrrr$\sr$c@seZdZdZdS)ContentDecodingErrorz"Failed to decode response content.Nrrrrrr%`sr%c@seZdZdZdS)StreamConsumedErrorz3The content for this response was already consumed.Nrrrrrr&dsr&c@seZdZdZdS) RetryErrorzCustom retries logic failedNrrrrrr'hsr'c@seZdZdZdS)UnrewindableBodyErrorz;Requests encountered an error when trying to rewind a body.Nrrrrrr(lsr(c@seZdZdZdS)RequestsWarningzBase warning for Requests.Nrrrrrr)rsr)c@seZdZdZdS)FileModeWarningzJA file was opened in text mode, but Requests determined its binary length.Nrrrrrr*vsr*c@seZdZdZdS)RequestsDependencyWarningz@An imported dependency doesn't match the expected version range.Nrrrrrr+zsr+N)rZurllib3.exceptionsrZ BaseHTTPErrorIOErrorrrrrrrrrr ValueErrorrr r!r"r#r$r% TypeErrorr&r'r(Warningr)DeprecationWarningr*r+rrrrs0  exceptions.cpython-39.pyc000064400000012101151116515220011350 0ustar00a /hY @sdZddlmZGdddeZGdddeZGdddeZGd d d eZGd d d eZGd ddeZ Gdddee Z Gddde Z GdddeZ GdddeZ GdddeeZGdddeeZGdddeeZGdddeeZGdd d eZGd!d"d"eZGd#d$d$eeZGd%d&d&eeZGd'd(d(eZGd)d*d*eZGd+d,d,eZGd-d.d.eeZGd/d0d0eZd1S)2z` requests.exceptions ~~~~~~~~~~~~~~~~~~~ This module contains the set of Requests' exceptions. ) HTTPErrorcs eZdZdZfddZZS)RequestExceptionzTThere was an ambiguous exception that occurred while handling your request. cs\|dd}||_|dd|_|durB|jsBt|drB|jj|_tt|j|i|dS)zBInitialize RequestException with `request` and `response` objects.responseNrequest)poprrhasattrsuperr__init__)selfargskwargsr __class__7/usr/lib/python3.9/site-packages/requests/exceptions.pyr s  zRequestException.__init__)__name__ __module__ __qualname____doc__r __classcell__rrr rr src@seZdZdZdS)rzAn HTTP error occurred.Nrrrrrrrrrsrc@seZdZdZdS)ConnectionErrorzA Connection error occurred.Nrrrrrr src@seZdZdZdS) ProxyErrorzA proxy error occurred.Nrrrrrr$src@seZdZdZdS)SSLErrorzAn SSL error occurred.Nrrrrrr(src@seZdZdZdS)TimeoutzThe request timed out. Catching this error will catch both :exc:`~requests.exceptions.ConnectTimeout` and :exc:`~requests.exceptions.ReadTimeout` errors. Nrrrrrr,src@seZdZdZdS)ConnectTimeoutzThe request timed out while trying to connect to the remote server. Requests that produced this error are safe to retry. Nrrrrrr5src@seZdZdZdS) ReadTimeoutz@The server did not send any data in the allotted amount of time.Nrrrrrr<src@seZdZdZdS) URLRequiredz*A valid URL is required to make a request.Nrrrrrr@src@seZdZdZdS)TooManyRedirectszToo many redirects.NrrrrrrDsrc@seZdZdZdS) MissingSchemaz/The URL schema (e.g. http or https) is missing.NrrrrrrHsrc@seZdZdZdS) InvalidSchemaz"See defaults.py for valid schemas.Nrrrrrr Lsr c@seZdZdZdS) InvalidURLz%The URL provided was somehow invalid.Nrrrrrr!Psr!c@seZdZdZdS) InvalidHeaderz.The header value provided was somehow invalid.Nrrrrrr"Tsr"c@seZdZdZdS)InvalidProxyURLz"The proxy URL provided is invalid.Nrrrrrr#Xsr#c@seZdZdZdS)ChunkedEncodingErrorz?The server declared chunked encoding but sent an invalid chunk.Nrrrrrr$\sr$c@seZdZdZdS)ContentDecodingErrorz"Failed to decode response content.Nrrrrrr%`sr%c@seZdZdZdS)StreamConsumedErrorz3The content for this response was already consumed.Nrrrrrr&dsr&c@seZdZdZdS) RetryErrorzCustom retries logic failedNrrrrrr'hsr'c@seZdZdZdS)UnrewindableBodyErrorz;Requests encountered an error when trying to rewind a body.Nrrrrrr(lsr(c@seZdZdZdS)RequestsWarningzBase warning for Requests.Nrrrrrr)rsr)c@seZdZdZdS)FileModeWarningzJA file was opened in text mode, but Requests determined its binary length.Nrrrrrr*vsr*c@seZdZdZdS)RequestsDependencyWarningz@An imported dependency doesn't match the expected version range.Nrrrrrr+zsr+N)rZurllib3.exceptionsrZ BaseHTTPErrorIOErrorrrrrrrrrr ValueErrorrr r!r"r#r$r% TypeErrorr&r'r(Warningr)DeprecationWarningr*r+rrrrs0  help.cpython-39.opt-1.pyc000064400000005062151116515220011066 0ustar00a /h @sdZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl m Z zddl mZWneydZdZdZYn0ddlZddlZddZd d Zd d Zed kredS)z'Module containing bug report helper(s).)print_functionN) __version__) pyopensslcCst}|dkrt}nj|dkr\dtjjtjjtjjf}tjjdkrd |tjjg}n(|dkrnt}n|dkrt}nd}||d S) aReturn a dict with the Python implementation and version. Provide both the name and the version of the Python implementation currently running. For example, on CPython 2.7.5 it will return {'name': 'CPython', 'version': '2.7.5'}. This function works best on CPython and PyPy: in particular, it probably doesn't work for Jython or IronPython. Future investigation should be done to work out the correct shape of the code for those platforms. ZCPythonZPyPyz%s.%s.%sfinalZJythonZ IronPythonUnknown)nameversion) platformZpython_implementationZpython_versionsysZpypy_version_infomajorminormicro releaseleveljoin)implementationZimplementation_versionr1/usr/lib/python3.9/site-packages/requests/help.py_implementations$     rc Cszttd}Wnty2ddd}Yn0t}dtji}dtji}ddd}trptjdtj j d}dt t ddi}dt t ddi}tj }d|durd|ndi}|||tdu|||||dtid S) z&Generate information for a bug report.)systemreleaserr Nr)r Zopenssl_versionz%xr) r r system_sslZusing_pyopensslZ pyOpenSSLurllib3chardet cryptographyidnaZrequests)r rrIOErrorrrrrOpenSSLZSSLZOPENSSL_VERSION_NUMBERgetattrrrsslrrequests_version) Z platform_infoZimplementation_infoZ urllib3_infoZ chardet_infoZpyopenssl_infoZcryptography_infoZ idna_inforZsystem_ssl_inforrrinfo;sJ        r"cCsttjtddddS)z)Pretty-print the bug information as JSON.T)Z sort_keysindentN)printjsondumpsr"rrrrmainqsr(__main__)__doc__Z __future__rr&r r r rrrrrr!Zurllib3.contribr ImportErrorrrrr"r(__name__rrrrs,    !6test_lang.cpython-39.pyc000064400000001251151121475330011156 0ustar00a "e@sHddlTddlmmZddlZGdddejZedkrDe dS))*Nc@seZdZddZdS)TestLangcCs|ttddS)N_)Z assertTruehasattrlang)selfr :/usr/lib/python3.9/site-packages/tracer/tests/test_lang.py test_provide_underscore_functionsz)TestLang.test_provide_underscore_functionN)__name__ __module__ __qualname__r r r r r rsr__main__) Z__meta__Ztracer.resources.langZ resourcesrosZunittestZTestCaserr mainr r r r s test_package.cpython-39.opt-1.pyc000064400000001550151121475330012571 0ustar00a "es@s*ddlTddlmZGdddejZdS))*)Packagec@seZdZddZddZdS) TestPackagecCs4td}td}td}||||||dS)NfooZbar)r assertEqualZassertNotEqual)selfZp1Zp2Zp3r =/usr/lib/python3.9/site-packages/tracer/tests/test_package.py test_equalitys  zTestPackage.test_equalitycCstd}|t|ddS)Nrz )rrrepr)rpackager r r test_representationszTestPackage.test_representationN)__name__ __module__ __qualname__r rr r r r rsrN)Z__meta__Ztracer.resources.packagerZunittestZTestCaserr r r r s test_package.cpython-39.pyc000064400000001550151121475330011632 0ustar00a "es@s*ddlTddlmZGdddejZdS))*)Packagec@seZdZddZddZdS) TestPackagecCs4td}td}td}||||||dS)NfooZbar)r assertEqualZassertNotEqual)selfZp1Zp2Zp3r =/usr/lib/python3.9/site-packages/tracer/tests/test_package.py test_equalitys  zTestPackage.test_equalitycCstd}|t|ddS)Nrz )rrrepr)rpackager r r test_representationszTestPackage.test_representationN)__name__ __module__ __qualname__r rr r r r rsrN)Z__meta__Ztracer.resources.packagerZunittestZTestCaserr r r r s test_portage.cpython-39.opt-1.pyc000064400000004414151121475330012641 0ustar00a "e@snddlTzddlmZddlmZWney6Yn0eedkdGdddej Z e d krje d S) )*)IPackageManager)PortageZgentooz/Skipping tests because they are distro-specificc@s<eZdZddZddZddZddZd d Zd d Zd S) TestPortagecCs t|_dS)N)rmanagerselfr =/usr/lib/python3.9/site-packages/tracer/tests/test_portage.pysetUp szTestPortage.setUpcCs||jtddS)Nz9Every package manager should inherit from IPackageManager)ZassertIsInstancerrrr r r )test_implements_package_manager_interface sz5TestPortage.test_implements_package_manager_interfacecCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz)packages_newer_than() is not implemented!)rZpackages_newer_thanNotImplementedErrorfail Exceptionrr r r #test_package_newer_than_implementedsz/TestPortage.test_package_newer_than_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nz'load_package_info() is not implemented!)rZload_package_inforrrrr r r test_load_package_infosz"TestPortage.test_load_package_infocCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz$packages_files() is not implemented!)rZ package_filesrrrrr r r test_package_files_implementedsz*TestPortage.test_package_files_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz!provided_by() is not implemented!)rZ provided_byrrrrr r r test_provided_byszTestPortage.test_provided_byN) __name__ __module__ __qualname__r r rrrrr r r r rs r__main__N) Z__meta__Z&tracer.packageManagers.ipackageManagerrZtracer.packageManagers.portager ImportErrorZunittestZskipIfZDISTROZTestCaserrmainr r r r s test_portage.cpython-39.pyc000064400000004414151121475330011702 0ustar00a "e@snddlTzddlmZddlmZWney6Yn0eedkdGdddej Z e d krje d S) )*)IPackageManager)PortageZgentooz/Skipping tests because they are distro-specificc@s<eZdZddZddZddZddZd d Zd d Zd S) TestPortagecCs t|_dS)N)rmanagerselfr =/usr/lib/python3.9/site-packages/tracer/tests/test_portage.pysetUp szTestPortage.setUpcCs||jtddS)Nz9Every package manager should inherit from IPackageManager)ZassertIsInstancerrrr r r )test_implements_package_manager_interface sz5TestPortage.test_implements_package_manager_interfacecCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz)packages_newer_than() is not implemented!)rZpackages_newer_thanNotImplementedErrorfail Exceptionrr r r #test_package_newer_than_implementedsz/TestPortage.test_package_newer_than_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nz'load_package_info() is not implemented!)rZload_package_inforrrrr r r test_load_package_infosz"TestPortage.test_load_package_infocCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz$packages_files() is not implemented!)rZ package_filesrrrrr r r test_package_files_implementedsz*TestPortage.test_package_files_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz!provided_by() is not implemented!)rZ provided_byrrrrr r r test_provided_byszTestPortage.test_provided_byN) __name__ __module__ __qualname__r r rrrrr r r r rs r__main__N) Z__meta__Z&tracer.packageManagers.ipackageManagerrZtracer.packageManagers.portager ImportErrorZunittestZskipIfZDISTROZTestCaserrmainr r r r s test_processes.cpython-39.opt-1.pyc000064400000005320151121475330013203 0ustar00a "e @sjddlTddlmZmZmZddlmZddlmZddl Z ddl Z Gddde j Z Gd d d eZdS) )*) ProcessesProcessProcessWrapper) SystemdDbus)ProcessesCollectionNc@sdeZdZeddddZeddddZeddddZd d Zeddd d Z d S) TestProcessesTz%@TODO Create Mock for Processes classcCs:td}|}||t|D]}||tq$dS)Nr)rallchildrenZassertIsInstancerr)selfprocessr childr?/usr/lib/python3.9/site-packages/tracer/tests/test_processes.py test_children s   zTestProcesses.test_childrencCs|tt}tt}||tt||||||ttt}| ||| ||dSN) rosgetpidgetppidZassertIsparentZassertInr Z reset_cache assertEqualZ assertIsNot)r r rZprocess2rrrtest_unique_processs    z!TestProcesses.test_unique_processcCsdtt}|tjtjjtjd}| dt || | dt || dS)N)stdinrr) rrrr subprocessPopensys executablePIPErlenZ rebuild_cacheZ terminate)r r rrrrtest_process_caching"s z"TestProcesses.test_process_cachingcCsJt}ddgdd|_t}ddgdd|_t}dddgd|_dS)NZsshd/usr/sbin/sshd)r!z-DZfooZbar)nameZexeZcmdline)ZsomethingandZ argumentsZidkZwhatZ withoutparams) ProcessMockdata)r Zp1Zp2Zp3rrrtest_name_sshd1szTestProcesses.test_name_sshdcCst}t}t|d}dS)Ni)rrpidsmax)r Zdbusr(Z nonexistingrrr test_dbusDs zTestProcesses.test_dbusN) __name__ __module__ __qualname__unittestZskipIfrrr r'r*rrrrr s      r c@seZdZddZddZdS)r%cCs i|_dSrr&)r rrr__init__NszProcessMock.__init__cCs |j|Srr/)r r"rrr_attrQszProcessMock._attrN)r+r,r-r0r1rrrrr%Msr%)Z__meta__Ztracer.resources.processesrrrZtracer.resources.SystemdDbusrZtracer.resources.collectionsrrrr.ZTestCaser r%rrrrs  Dtest_processes.cpython-39.pyc000064400000005564151121475330012256 0ustar00a "e @sjddlTddlmZmZmZddlmZddlmZddl Z ddl Z Gddde j Z Gd d d eZdS) )*) ProcessesProcessProcessWrapper) SystemdDbus)ProcessesCollectionNc@sdeZdZeddddZeddddZeddddZd d Zeddd d Z d S) TestProcessesTz%@TODO Create Mock for Processes classcCs:td}|}||t|D]}||tq$dS)Nr)rallchildrenZassertIsInstancerr)selfprocessr childr?/usr/lib/python3.9/site-packages/tracer/tests/test_processes.py test_children s   zTestProcesses.test_childrencCs|tt}tt}||tt||||||ttt}| ||| ||dSN) rosgetpidgetppidZassertIsparentZassertInr Z reset_cache assertEqualZ assertIsNot)r r rZprocess2rrrtest_unique_processs    z!TestProcesses.test_unique_processcCsdtt}|tjtjjtjd}| dt || | dt || dS)N)stdinrr) rrrr subprocessPopensys executablePIPErlenZ rebuild_cacheZ terminate)r r rrrrtest_process_caching"s z"TestProcesses.test_process_cachingcCszt}ddgdd|_|dks(Jt}ddgdd|_|dksPJt}dddgd|_|dksvJdS)NZsshd/usr/sbin/sshd)r!z-DZfooZbar)nameZexeZcmdline)ZsomethingandZ argumentsZidkZwhatzssh-thing-sessionZ withoutparams) ProcessMockdatar")r Zp1Zp2Zp3rrrtest_name_sshd1s"zTestProcesses.test_name_sshdcCsFt}t}t|d}|dddus.J||ddusBJdS)NirZPAMNameF)rrpidsmaxZhas_service_property_from_pid)r Zdbusr(Z nonexistingrrr test_dbusDs  zTestProcesses.test_dbusN) __name__ __module__ __qualname__unittestZskipIfrrr r'r*rrrrr s      r c@seZdZddZddZdS)r%cCs i|_dSrr&)r rrr__init__NszProcessMock.__init__cCs |j|Srr/)r r"rrr_attrQszProcessMock._attrN)r+r,r-r0r1rrrrr%Msr%)Z__meta__Ztracer.resources.processesrrrZtracer.resources.SystemdDbusrZtracer.resources.collectionsrrrr.ZTestCaser r%rrrrs  Dtest_query.cpython-39.pyc000064400000002544151121475330011410 0ustar00a "e>@sNddlTddlmZmZGdddejZGdddeZe dkrJe d S) )*)QueryLazyc@seZdZddZddZdS) TestQuerycCsttd|_dS)N)Ztracer)r TracerMockquery)selfr ;/usr/lib/python3.9/site-packages/tracer/tests/test_query.pysetUpszTestQuery.setUpcCsB|j}||t|t|d|t|gddS)NgetABC) rZaffected_applicationsZassertIsInstancerZ assertTruehasattrZassertListEquallistr )r Z apps_queryr r r test_affected_applications s  z$TestQuery.test_affected_applicationsN)__name__ __module__ __qualname__r rr r r r rsrc@seZdZddZdddZdS)rcGsdS)Nr )r argsr r r __init__szTracerMock.__init__NcCsgdS)Nrr )r userr r r trace_affectedszTracerMock.trace_affected)N)rrrrrr r r r rsr__main__N) Z__meta__Z tracer.queryrrZunittestZTestCaserobjectrrmainr r r r s   test_rules.cpython-39.opt-1.pyc000064400000007143151121475330012334 0ustar00a "e@sddlTddlmZddlmZmZzddlmZmZdZ Wn ddl mZmZdZ Yn0Gdd d e j Z ed kre d S) )*)DATA_DIR)RulesRule)patch mock_openz builtins.openz__builtin__.openc@s`eZdZeddZddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ dS) TestRulescCsddtjD|_dS)NcSsg|]}|tr|qS) startswithr.0xr r ;/usr/lib/python3.9/site-packages/tracer/tests/test_rules.py s z(TestRules.setUpClass..)r DEFINITIONS)clsr r r setUpClassszTestRules.setUpClasscCs|jt_dt_dSN)rrZ_rulesselfr r rsetUpszTestRules.setUpcCstD]}||tqdSr)rallZassertIsInstancerrZruler r rtest_rules_typess zTestRules.test_rules_typescCs|d}tD]j}d|vs d|vr2|dt||jtjvrR|d|jt|dkrn|d|j|d7}q dS)NrnameactionzMissing attributes in rule #zUnknown action in rule: z Unsupported attributes in rule: ) rrfailstrrZACTIONSvaluesrlen)rirr r rtest_rules_attributess  zTestRules.test_rules_attributescCs4t}|D]"}||dkr |d|jq dS)NrzDuplicate rules for: )rrcountrr)rrulesr#r r rtest_rules_duplicity*szTestRules.test_rules_duplicitycCs|tddS)NZNON_EXISTING_APPLICATION)Z assertIsNonerfindrr r rtest_app_with_no_rule0szTestRules.test_app_with_no_rulecCs0tddi}|t|d|t|ddS)Nrfooz )r assertEqualrreprrr r rtest_representations3s zTestRules.test_representationscCs8tddd}tddd}||||jddS)Nr*bar)rrZbaz)rupdater+r)rZr1Zr2r r r test_update8s zTestRules.test_updatecCsdgt_d}ttt|dvt}|t|d|tdd|D||dj d||dj d ||d j d Wd n1s0Yd S) z/ Test parsing a single XML file with rules zwhatever-file.xmlzM )Z read_datarcSsg|]}t|tqSr ) isinstancerr r r rrMz'TestRules.test_load..rr*returnrr.N) rrr builtins_openrrr+r!Z assertTruerr)rdatar&r r r test_load?szTestRules.test_loadcCs$d}|D]}|j|kr|d7}q|S)Nrr)r)rZapp_nameZappsr%ar r r_countRs   zTestRules._countN)__name__ __module__ __qualname__ classmethodrrrr$r'r)r-r0r6r8r r r rr s r __main__N)Z__meta__Z tracer.pathsrZtracer.resources.rulesrrZ unittest.mockrrr4ZmockZunittestZTestCaser r9mainr r r rs  Mtest_rules.cpython-39.pyc000064400000007143151121475330011375 0ustar00a "e@sddlTddlmZddlmZmZzddlmZmZdZ Wn ddl mZmZdZ Yn0Gdd d e j Z ed kre d S) )*)DATA_DIR)RulesRule)patch mock_openz builtins.openz__builtin__.openc@s`eZdZeddZddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ dS) TestRulescCsddtjD|_dS)NcSsg|]}|tr|qS) startswithr.0xr r ;/usr/lib/python3.9/site-packages/tracer/tests/test_rules.py s z(TestRules.setUpClass..)r DEFINITIONS)clsr r r setUpClassszTestRules.setUpClasscCs|jt_dt_dSN)rrZ_rulesselfr r rsetUpszTestRules.setUpcCstD]}||tqdSr)rallZassertIsInstancerrZruler r rtest_rules_typess zTestRules.test_rules_typescCs|d}tD]j}d|vs d|vr2|dt||jtjvrR|d|jt|dkrn|d|j|d7}q dS)NrnameactionzMissing attributes in rule #zUnknown action in rule: z Unsupported attributes in rule: ) rrfailstrrZACTIONSvaluesrlen)rirr r rtest_rules_attributess  zTestRules.test_rules_attributescCs4t}|D]"}||dkr |d|jq dS)NrzDuplicate rules for: )rrcountrr)rrulesr#r r rtest_rules_duplicity*szTestRules.test_rules_duplicitycCs|tddS)NZNON_EXISTING_APPLICATION)Z assertIsNonerfindrr r rtest_app_with_no_rule0szTestRules.test_app_with_no_rulecCs0tddi}|t|d|t|ddS)Nrfooz )r assertEqualrreprrr r rtest_representations3s zTestRules.test_representationscCs8tddd}tddd}||||jddS)Nr*bar)rrZbaz)rupdater+r)rZr1Zr2r r r test_update8s zTestRules.test_updatecCsdgt_d}ttt|dvt}|t|d|tdd|D||dj d||dj d ||d j d Wd n1s0Yd S) z/ Test parsing a single XML file with rules zwhatever-file.xmlzM )Z read_datarcSsg|]}t|tqSr ) isinstancerr r r rrMz'TestRules.test_load..rr*returnrr.N) rrr builtins_openrrr+r!Z assertTruerr)rdatar&r r r test_load?szTestRules.test_loadcCs$d}|D]}|j|kr|d7}q|S)Nrr)r)rZapp_nameZappsr%ar r r_countRs   zTestRules._countN)__name__ __module__ __qualname__ classmethodrrrr$r'r)r-r0r6r8r r r rr s r __main__N)Z__meta__Z tracer.pathsrZtracer.resources.rulesrrZ unittest.mockrrr4ZmockZunittestZTestCaser r9mainr r r rs  Mtest_tracer.cpython-39.opt-1.pyc000064400000012526151121475330012463 0ustar00a "e @sddlTddlmZddlmZddlmZmZddlm Z ddl m Z m Z m Z mZzddlmZWnddlmZYn0Gd d d ejZGd d d eZGd dde ZGdddeZGdddeZGdddeZdddZedkredS))*)Tracer)Rules) Applications Application)AffectedProcess)ProcessesCollectionPackagesCollectionApplicationsCollectionAffectedProcessesCollection)patchc@s0eZdZddZedddddZdd Zd S) TestRulescCs>tt_tttttd|_d|j_t dddt t _ dS)N)memoryiZkernelT)nameignore) r rZ_appsrPackageManagerMockrdump_memory_mocktracerZ timestampZ_append_application ProcessesMockrZprocesses_factoryselfr|j}|t|ttdtdg||tdS)Nbazqux)rZtrace_affectedZassertSetEqualsetrfindassertIsInstancer )rZ init_systemaffectedrrrtest_trace_affecteds $zTestRules.test_trace_affectedcCsV|jtdt}||t|t|d|d}||t ||j ddS)Nrrr) rZtrace_applicationrrAffectedProcessMockrr Z assertEquallenrpid)rr processrrrtest_trace_application s   z TestRules.test_trace_applicationN)__name__ __module__ __qualname__rr r!r'rrrrrs  rc@sXeZdZddZddZeddZeddZed d Zd d Z d dZ ddZ dS) ProcessMockcCs||_||_||_||_dSN)r%files_name _create_time)rr%r create_timer-rrr__init__+szProcessMock.__init__cCs|jSr,r.rrrrr1szProcessMock.namecCs|jSr,r2rrrr real_name4szProcessMock.real_namecCsdSNFrrrrris_interpreted8szProcessMock.is_interpretedcCsdSr4rrrrr is_session<szProcessMock.is_sessioncCs|jSr,)r/rrrrr0@szProcessMock.create_timecCsgSr,rrrrrchildrenCszProcessMock.childrencCsdSr,rrrrrparentFszProcessMock.parentN) r(r)r*r1rpropertyr3r5r6r0r7r8rrrrr+*s   r+c@seZdZdddZdS)r#NcCs||_t|_t|_dSr,)r%rZpackagesr-)rr%rrrr1KszAffectedProcessMock.__init__)Nr(r)r*r1rrrrr#Jsr#c@seZdZeddZdS)rc CsHttdddgdtdddgdtd d d gd td ddddggS)NZfooiWfile1Zfile2file3Zbari'Zfile10Zfile11Zfile12r"ri )file7r=r>rafile4file9)r r+rrrrallSs zProcessesMock.allN)r(r)r* staticmethodrFrrrrrRsrc@seZdZddZdS) PackageMockcCs||_||_||_dSr,)rmodifiedr-)rrrIr-rrrr1^szPackageMock.__init__Nr:rrrrrH]srHc@sXeZdZeddgdeddgdeddgd ed d gd gZd dZddZdS)rAi r<Bi\)rDZfile5Zfile6CrC)rAZfile8rEDi"r@csttfdd|jS)Ncs |jkSr,)rI)p unix_timerrmz8PackageManagerMock.packages_newer_than..)r filter _packages)rrPrrOrpackages_newer_thanlsz&PackageManagerMock.packages_newer_thancCs$|jD]}|j|kr|jSqdSr,)rTrr-)rpkg_namepackagerrr package_filesos  z PackageManagerMock.package_filesN)r(r)r*rHrTrUrXrrrrrdsrNcCsDi}tD]2}|jD]&}||vr2|||q|g||<qq |Sr,)rrFr-append)userrr&filerrrrus  r__main__)N)Z__meta__Ztracer.resources.tracerrZtracer.resources.rulesrZtracer.resources.applicationsrrZtracer.resources.processesrZtracer.resources.collectionsr r r r Z unittest.mockr ZmockZunittestZTestCaserobjectr+r#rrHrrr(mainrrrrs$      test_tracer.cpython-39.pyc000064400000012526151121475330011524 0ustar00a "e @sddlTddlmZddlmZddlmZmZddlm Z ddl m Z m Z m Z mZzddlmZWnddlmZYn0Gd d d ejZGd d d eZGd dde ZGdddeZGdddeZGdddeZdddZedkredS))*)Tracer)Rules) Applications Application)AffectedProcess)ProcessesCollectionPackagesCollectionApplicationsCollectionAffectedProcessesCollection)patchc@s0eZdZddZedddddZdd Zd S) TestRulescCs>tt_tttttd|_d|j_t dddt t _ dS)N)memoryiZkernelT)nameignore) r rZ_appsrPackageManagerMockrdump_memory_mocktracerZ timestampZ_append_application ProcessesMockrZprocesses_factoryselfr|j}|t|ttdtdg||tdS)Nbazqux)rZtrace_affectedZassertSetEqualsetrfindassertIsInstancer )rZ init_systemaffectedrrrtest_trace_affecteds $zTestRules.test_trace_affectedcCsV|jtdt}||t|t|d|d}||t ||j ddS)Nrrr) rZtrace_applicationrrAffectedProcessMockrr Z assertEquallenrpid)rr processrrrtest_trace_application s   z TestRules.test_trace_applicationN)__name__ __module__ __qualname__rr r!r'rrrrrs  rc@sXeZdZddZddZeddZeddZed d Zd d Z d dZ ddZ dS) ProcessMockcCs||_||_||_||_dSN)r%files_name _create_time)rr%r create_timer-rrr__init__+szProcessMock.__init__cCs|jSr,r.rrrrr1szProcessMock.namecCs|jSr,r2rrrr real_name4szProcessMock.real_namecCsdSNFrrrrris_interpreted8szProcessMock.is_interpretedcCsdSr4rrrrr is_session<szProcessMock.is_sessioncCs|jSr,)r/rrrrr0@szProcessMock.create_timecCsgSr,rrrrrchildrenCszProcessMock.childrencCsdSr,rrrrrparentFszProcessMock.parentN) r(r)r*r1rpropertyr3r5r6r0r7r8rrrrr+*s   r+c@seZdZdddZdS)r#NcCs||_t|_t|_dSr,)r%rZpackagesr-)rr%rrrr1KszAffectedProcessMock.__init__)Nr(r)r*r1rrrrr#Jsr#c@seZdZeddZdS)rc CsHttdddgdtdddgdtd d d gd td ddddggS)NZfooiWfile1Zfile2file3Zbari'Zfile10Zfile11Zfile12r"ri )file7r=r>rafile4file9)r r+rrrrallSs zProcessesMock.allN)r(r)r* staticmethodrFrrrrrRsrc@seZdZddZdS) PackageMockcCs||_||_||_dSr,)rmodifiedr-)rrrIr-rrrr1^szPackageMock.__init__Nr:rrrrrH]srHc@sXeZdZeddgdeddgdeddgd ed d gd gZd dZddZdS)rAi r<Bi\)rDZfile5Zfile6CrC)rAZfile8rEDi"r@csttfdd|jS)Ncs |jkSr,)rI)p unix_timerrmz8PackageManagerMock.packages_newer_than..)r filter _packages)rrPrrOrpackages_newer_thanlsz&PackageManagerMock.packages_newer_thancCs$|jD]}|j|kr|jSqdSr,)rTrr-)rpkg_namepackagerrr package_filesos  z PackageManagerMock.package_filesN)r(r)r*rHrTrUrXrrrrrdsrNcCsDi}tD]2}|jD]&}||vr2|||q|g||<qq |Sr,)rrFr-append)userrr&filerrrrus  r__main__)N)Z__meta__Ztracer.resources.tracerrZtracer.resources.rulesrZtracer.resources.applicationsrrZtracer.resources.processesrZtracer.resources.collectionsr r r r Z unittest.mockr ZmockZunittestZTestCaserobjectr+r#rrHrrr(mainrrrrs$      test_views.cpython-39.opt-1.pyc000064400000021337151121475330012340 0ustar00a "e@'@s&ddlmZddlTddlmZddlmZddlmZddl m Z m Z ddl m Z dd lmZdd lmZmZdd lZdd lZdd lZdd lZejd d dgdZejZzddlmZWnddlmZYn0eejj_eejj_eejj _Gddde!j"Z#Gddde$Z%Gddde$Zd S))unicode_literals)*)StringIO) DefaultView) HelperView) Applications Application)ApplicationsCollection)Package) ProcessMockAffectedProcessMockNtracerTen)fallback languages)patchc@sxeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ edddddZdS) TestViewscCs t|_dSN)routselfr;/usr/lib/python3.9/site-packages/tracer/tests/test_views.pysetUp#szTestViews.setUpcCsFt|j}|dt|dtg|||jddS)Nargs applications)rrassignArgsMockr render assertEqualgetvaluerviewrrrtest_default_none&s  zTestViews.test_default_nonec Cspt|j}|dt|dttddddtddddtdd d dg|||jd dS) Nrr application first helperfirsttypehelpername second helpersecond third helperthirdzkYou should restart: * Some applications using: first helper second helper third helper rrrrr r r r!r"r#rrrtest_default_with_helpers-s  z#TestViews.test_default_with_helpersc Cspt|j}|dt|dttddddtddddtddddg|||jddS) Nrrr&foor*r,r+barbazzSYou should restart: * These applications manually: bar baz foo r1r#rrrtest_default_without_helpers>s  z&TestViews.test_default_without_helperscCst|j}|dt|dttddddtddddtdd d dtdd dd tdd dd tdddd g|||jddS)Nrrr&r'r(r)r-r.r/r0r3r4r5r6zYou should restart: * Some applications using: first helper second helper third helper * These applications manually: bar baz foo r1r#rrr!test_default_with_without_helpersOs  z+TestViews.test_default_with_without_helpersc Cstt|j}|dtdd|dttddddtdd d dtdd d dg|||jd dS)NrTallrsessionr3h1r4r5h2r6h3zbYou should restart: * These applications restarting your session: bar baz foo r1r#rrrtest_default_all_sessionhs  z"TestViews.test_default_all_sessionc Cstt|j}|dtdd|dttddddtdd d dtdd d dg|||jd dS)NrTr9rstaticr3r<r4r5r=r6r>zbYou should restart: * These applications rebooting your computer: bar baz foo r1r#rrrtest_default_all_staticys  z!TestViews.test_default_all_staticcCst|j}|dtdd|dttddddtdd d dtdd d dtd dddtd dddtd dddg|||jddS)NrTr9rr;r3r<r4r5r=r6r>r@aaah4bbbZh5ZcccZh6zYou should restart: * These applications restarting your session: bar baz foo * These applications rebooting your computer: aaa bbb ccc r1r#rrrtest_default_all_session_statics  z)TestViews.test_default_all_session_staticcCst|j}|dtdd|dttddddtdd d dtdd dd tdd dd tdddd tdddd tdddd tdddd g|||jddS)NrTr9rr&r'r(r)r-r.r3r4r5r;r6r<quxr=r@rBr>rDrCaYou should restart: * Some applications using: first helper second helper * These applications manually: bar foo * These applications restarting your session: baz qux * These applications rebooting your computer: aaa bbb r1r#rrrtest_default_alls    zTestViews.test_default_allcCst|j}|dt|dttddddtddddtdd dd tdd dd td d dd td ddd tdddd g|||jddS)Nrrr&r'r(r)r-r.r3r4r5r;r6r<rFr=r@rBr>a!You should restart: * Some applications using: first helper second helper * These applications manually: bar foo Additionally, there are: - 2 processes requiring restart of your session (i.e. Logging out & Logging in again) - 1 processes requiring reboot r1r#rrrtest_default_not_alls   zTestViews.test_default_not_allc Cspt|j}|dt|dttddddtddddtd d d dg|||jd dS) Nrrr;r3r<r4r5r=r@r6r>zThere are: - 2 processes requiring restart of your session (i.e. Logging out & Logging in again) - 1 processes requiring reboot r1r#rrrtest_default_note_onlys  z TestViews.test_default_note_onlyz0tracer.resources.applications.System.init_systemZdummy)Z return_valuecCstdddddgtdddddgg}td }d|_d |_d |_ddg|_td}t|g|_|g}t |j }| d t dd | d|| dt d| d|| d|| dd|||j ddS)Nr3iZfile1Zfile2i.Zfile3Z foopackagezFoo package descriptionZcategr)verbose processesr&package affected_byZaffectsa;* foo Package: foopackage Description: Foo package description Type: Application State: foo has been started by None some-time ago. PID - 2 foo has been started by None some-time ago. PID - 3 Affected by: foopackage file1 file2 )r r Zmodified descriptioncategoryfilesr setZpackagesrrrrrfindr r!r")rZ init_systemrMrNZa1rOr$rrr test_helpers,        zTestViews.test_helperN)__name__ __module__ __qualname__rr%r2r7r8r?rArErGrHrIrrUrrrrr!s! rc@seZdZdZZdddZdS)rNFcCs||_||_||_||_dSr)r:quietuserrL)rr:rYrZrLrrr__init__szArgsMock.__init__)FFFF)rVrWrXr:rYr[rrrrrsrc@s4eZdZddZddZddZddZd d Zd S) r cCs(d|_||_||_||_||_d|_dS)Nz some-time)parentpidrR_name _create_timeZstr_started_ago)rr]r, create_timerRrrrr["s zProcessMock.__init__cCs|jSr)r^rrrrr,*szProcessMock.namecCs|jSr)r_rrrrr`-szProcessMock.create_timecCsgSrrrrrrchildren0szProcessMock.childrencCsdSrrrrrrusername3szProcessMock.usernameN)rVrWrXr[r,r`rarbrrrrr !s r )&Z __future__rZ__meta__Ztracer.resources.pycomprZtracer.views.defaultrZtracer.views.helperrZtracer.resources.applicationsrr Ztracer.resources.collectionsr Ztracer.resources.packager Z test_tracerr r rZtracer.views.note_for_hiddengettext translationtZugettext_Z unittest.mockrZmockZviewsdefaultr+Znote_for_hiddenZunittestZTestCaserobjectrrrrrs2         w test_views.cpython-39.pyc000064400000021337151121475330011401 0ustar00a "e@'@s&ddlmZddlTddlmZddlmZddlmZddl m Z m Z ddl m Z dd lmZdd lmZmZdd lZdd lZdd lZdd lZejd d dgdZejZzddlmZWnddlmZYn0eejj_eejj_eejj _Gddde!j"Z#Gddde$Z%Gddde$Zd S))unicode_literals)*)StringIO) DefaultView) HelperView) Applications Application)ApplicationsCollection)Package) ProcessMockAffectedProcessMockNtracerTen)fallback languages)patchc@sxeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ edddddZdS) TestViewscCs t|_dSN)routselfr;/usr/lib/python3.9/site-packages/tracer/tests/test_views.pysetUp#szTestViews.setUpcCsFt|j}|dt|dtg|||jddS)Nargs applications)rrassignArgsMockr render assertEqualgetvaluerviewrrrtest_default_none&s  zTestViews.test_default_nonec Cspt|j}|dt|dttddddtddddtdd d dg|||jd dS) Nrr application first helperfirsttypehelpername second helpersecond third helperthirdzkYou should restart: * Some applications using: first helper second helper third helper rrrrr r r r!r"r#rrrtest_default_with_helpers-s  z#TestViews.test_default_with_helpersc Cspt|j}|dt|dttddddtddddtddddg|||jddS) Nrrr&foor*r,r+barbazzSYou should restart: * These applications manually: bar baz foo r1r#rrrtest_default_without_helpers>s  z&TestViews.test_default_without_helperscCst|j}|dt|dttddddtddddtdd d dtdd dd tdd dd tdddd g|||jddS)Nrrr&r'r(r)r-r.r/r0r3r4r5r6zYou should restart: * Some applications using: first helper second helper third helper * These applications manually: bar baz foo r1r#rrr!test_default_with_without_helpersOs  z+TestViews.test_default_with_without_helpersc Cstt|j}|dtdd|dttddddtdd d dtdd d dg|||jd dS)NrTallrsessionr3h1r4r5h2r6h3zbYou should restart: * These applications restarting your session: bar baz foo r1r#rrrtest_default_all_sessionhs  z"TestViews.test_default_all_sessionc Cstt|j}|dtdd|dttddddtdd d dtdd d dg|||jd dS)NrTr9rstaticr3r<r4r5r=r6r>zbYou should restart: * These applications rebooting your computer: bar baz foo r1r#rrrtest_default_all_staticys  z!TestViews.test_default_all_staticcCst|j}|dtdd|dttddddtdd d dtdd d dtd dddtd dddtd dddg|||jddS)NrTr9rr;r3r<r4r5r=r6r>r@aaah4bbbZh5ZcccZh6zYou should restart: * These applications restarting your session: bar baz foo * These applications rebooting your computer: aaa bbb ccc r1r#rrrtest_default_all_session_statics  z)TestViews.test_default_all_session_staticcCst|j}|dtdd|dttddddtdd d dtdd dd tdd dd tdddd tdddd tdddd tdddd g|||jddS)NrTr9rr&r'r(r)r-r.r3r4r5r;r6r<quxr=r@rBr>rDrCaYou should restart: * Some applications using: first helper second helper * These applications manually: bar foo * These applications restarting your session: baz qux * These applications rebooting your computer: aaa bbb r1r#rrrtest_default_alls    zTestViews.test_default_allcCst|j}|dt|dttddddtddddtdd dd tdd dd td d dd td ddd tdddd g|||jddS)Nrrr&r'r(r)r-r.r3r4r5r;r6r<rFr=r@rBr>a!You should restart: * Some applications using: first helper second helper * These applications manually: bar foo Additionally, there are: - 2 processes requiring restart of your session (i.e. Logging out & Logging in again) - 1 processes requiring reboot r1r#rrrtest_default_not_alls   zTestViews.test_default_not_allc Cspt|j}|dt|dttddddtddddtd d d dg|||jd dS) Nrrr;r3r<r4r5r=r@r6r>zThere are: - 2 processes requiring restart of your session (i.e. Logging out & Logging in again) - 1 processes requiring reboot r1r#rrrtest_default_note_onlys  z TestViews.test_default_note_onlyz0tracer.resources.applications.System.init_systemZdummy)Z return_valuecCstdddddgtdddddgg}td }d|_d |_d |_ddg|_td}t|g|_|g}t |j }| d t dd | d|| dt d| d|| d|| dd|||j ddS)Nr3iZfile1Zfile2i.Zfile3Z foopackagezFoo package descriptionZcategr)verbose processesr&package affected_byZaffectsa;* foo Package: foopackage Description: Foo package description Type: Application State: foo has been started by None some-time ago. PID - 2 foo has been started by None some-time ago. PID - 3 Affected by: foopackage file1 file2 )r r Zmodified descriptioncategoryfilesr setZpackagesrrrrrfindr r!r")rZ init_systemrMrNZa1rOr$rrr test_helpers,        zTestViews.test_helperN)__name__ __module__ __qualname__rr%r2r7r8r?rArErGrHrIrrUrrrrr!s! rc@seZdZdZZdddZdS)rNFcCs||_||_||_||_dSr)r:quietuserrL)rr:rYrZrLrrr__init__szArgsMock.__init__)FFFF)rVrWrXr:rYr[rrrrrsrc@s4eZdZddZddZddZddZd d Zd S) r cCs(d|_||_||_||_||_d|_dS)Nz some-time)parentpidrR_name _create_timeZstr_started_ago)rr]r, create_timerRrrrr["s zProcessMock.__init__cCs|jSr)r^rrrrr,*szProcessMock.namecCs|jSr)r_rrrrr`-szProcessMock.create_timecCsgSrrrrrrchildren0szProcessMock.childrencCsdSrrrrrrusername3szProcessMock.usernameN)rVrWrXr[r,r`rarbrrrrr !s r )&Z __future__rZ__meta__Ztracer.resources.pycomprZtracer.views.defaultrZtracer.views.helperrZtracer.resources.applicationsrr Ztracer.resources.collectionsr Ztracer.resources.packager Z test_tracerr r rZtracer.views.note_for_hiddengettext translationtZugettext_Z unittest.mockrZmockZviewsdefaultr+Znote_for_hiddenZunittestZTestCaserobjectrrrrrs2         w test_yum.cpython-39.opt-1.pyc000064400000004344151121475330012014 0ustar00a "e @snddlTzddlmZddlmZWney6Yn0eedkdGdddej Z e d krje d S) )*)IPackageManager)YumZfedoraz/Skipping tests because they are distro-specificc@s<eZdZddZddZddZddZd d Zd d Zd S)TestYumcCs t|_dS)N)rmanagerselfr 9/usr/lib/python3.9/site-packages/tracer/tests/test_yum.pysetUp sz TestYum.setUpcCs||jtddS)Nz9Every package manager should inherit from IPackageManager)ZassertIsInstancerrrr r r )test_implements_package_manager_interface sz1TestYum.test_implements_package_manager_interfacecCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz)packages_newer_than() is not implemented!)rZpackages_newer_thanNotImplementedErrorfail Exceptionrr r r #test_package_newer_than_implementedsz+TestYum.test_package_newer_than_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nz'load_package_info() is not implemented!)rZload_package_inforrrrr r r test_load_package_infoszTestYum.test_load_package_infocCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz$packages_files() is not implemented!)rZ package_filesrrrrr r r test_package_files_implementedsz&TestYum.test_package_files_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz!provided_by() is not implemented!)rZ provided_byrrrrr r r test_provided_byszTestYum.test_provided_byN) __name__ __module__ __qualname__r r rrrrr r r r rs r__main__N) Z__meta__Z&tracer.packageManagers.ipackageManagerrZtracer.packageManagers.yumr ImportErrorZunittestZskipIfZDISTROZTestCaserrmainr r r r s test_yum.cpython-39.pyc000064400000004344151121475330011055 0ustar00a "e @snddlTzddlmZddlmZWney6Yn0eedkdGdddej Z e d krje d S) )*)IPackageManager)YumZfedoraz/Skipping tests because they are distro-specificc@s<eZdZddZddZddZddZd d Zd d Zd S)TestYumcCs t|_dS)N)rmanagerselfr 9/usr/lib/python3.9/site-packages/tracer/tests/test_yum.pysetUp sz TestYum.setUpcCs||jtddS)Nz9Every package manager should inherit from IPackageManager)ZassertIsInstancerrrr r r )test_implements_package_manager_interface sz1TestYum.test_implements_package_manager_interfacecCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz)packages_newer_than() is not implemented!)rZpackages_newer_thanNotImplementedErrorfail Exceptionrr r r #test_package_newer_than_implementedsz+TestYum.test_package_newer_than_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nz'load_package_info() is not implemented!)rZload_package_inforrrrr r r test_load_package_infoszTestYum.test_load_package_infocCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz$packages_files() is not implemented!)rZ package_filesrrrrr r r test_package_files_implementedsz&TestYum.test_package_files_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz!provided_by() is not implemented!)rZ provided_byrrrrr r r test_provided_byszTestYum.test_provided_byN) __name__ __module__ __qualname__r r rrrrr r r r rs r__main__N) Z__meta__Z&tracer.packageManagers.ipackageManagerrZtracer.packageManagers.yumr ImportErrorZunittestZskipIfZDISTROZTestCaserrmainr r r r s __meta__.cpython-39.opt-1.pyc000064400000000601151121475330011655 0ustar00a "e&@s\ddlZejejejeZejjdeddlZddlZddl m Z e Z dS)N)System) ospathdirnamerealpath__file__Z parentdirsysinsertZunittestZtracer.resources.systemrZ distributionZDISTROr r 9/usr/lib/python3.9/site-packages/tracer/tests/__meta__.pys  __meta__.cpython-39.pyc000064400000000601151121475330010716 0ustar00a "e&@s\ddlZejejejeZejjdeddlZddlZddl m Z e Z dS)N)System) ospathdirnamerealpath__file__Z parentdirsysinsertZunittestZtracer.resources.systemrZ distributionZDISTROr r 9/usr/lib/python3.9/site-packages/tracer/tests/__meta__.pys  test_FilenameCleaner.cpython-39.opt-1.pyc000064400000002362151121475330014212 0ustar00a "e@s,ddlmZddlmZGdddeZdS))TestCase)FilenameCleanerc@seZdZddZddZdS)TestFilenameCleanercCs t|_dS)N)rcleanerselfrE/usr/lib/python3.9/site-packages/tracer/tests/test_FilenameCleaner.pysetUpszTestFilenameCleaner.setUpcCs|d|jd|d|jd|d|jd|d|jd|d|jd|d |jd |d |jd dS) Nz /lib/libdl.soz/lib/libdl-2.19.soz/lib/libncurses.soz/lib/libncurses.so.5.9z /bin/bashz%/usr/share/wicd/curses/wicd-curses.pyz /usr/bin/gvimz/usr/bin/gvim#new (deleted)z)/usr/lib64/kde4/kded_networkmanagement.soz2/usr/lib64/kde4/kded_networkmanagement.so;53c7cd86z#/usr/lib64/firefox/plugin-containerz>/usr/lib64/firefox/plugin-container.#prelink#.N3n7Rk (deleted))Z assertEqualrstriprrrr test_strip s  zTestFilenameCleaner.test_stripN)__name__ __module__ __qualname__r r rrrr rsrN)ZunittestrZ tracer.resources.FilenameCleanerrrrrrr s  test_FilenameCleaner.cpython-39.pyc000064400000002362151121475330013253 0ustar00a "e@s,ddlmZddlmZGdddeZdS))TestCase)FilenameCleanerc@seZdZddZddZdS)TestFilenameCleanercCs t|_dS)N)rcleanerselfrE/usr/lib/python3.9/site-packages/tracer/tests/test_FilenameCleaner.pysetUpszTestFilenameCleaner.setUpcCs|d|jd|d|jd|d|jd|d|jd|d|jd|d |jd |d |jd dS) Nz /lib/libdl.soz/lib/libdl-2.19.soz/lib/libncurses.soz/lib/libncurses.so.5.9z /bin/bashz%/usr/share/wicd/curses/wicd-curses.pyz /usr/bin/gvimz/usr/bin/gvim#new (deleted)z)/usr/lib64/kde4/kded_networkmanagement.soz2/usr/lib64/kde4/kded_networkmanagement.so;53c7cd86z#/usr/lib64/firefox/plugin-containerz>/usr/lib64/firefox/plugin-container.#prelink#.N3n7Rk (deleted))Z assertEqualrstriprrrr test_strip s  zTestFilenameCleaner.test_stripN)__name__ __module__ __qualname__r r rrrr rsrN)ZunittestrZ tracer.resources.FilenameCleanerrrrrrr s  test_alpm.cpython-39.opt-1.pyc000064400000004375151121475330012137 0ustar00a "e&@svddlTzddlmZddlmZWney6Yn0eedkoJedkdGdd d ej Z e d krre d S) )*)IPackageManager)AlpmZarchZarcharmz/Skipping tests because they are distro-specificc@s<eZdZddZddZddZddZd d Zd d Zd S)TestAlpmcCs t|_dS)N)rmanagerselfr :/usr/lib/python3.9/site-packages/tracer/tests/test_alpm.pysetUp szTestAlpm.setUpcCs||jtddS)Nz9Every package manager should inherit from IPackageManager)ZassertIsInstancerrrr r r )test_implements_package_manager_interface sz2TestAlpm.test_implements_package_manager_interfacecCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz)packages_newer_than() is not implemented!)rZpackages_newer_thanNotImplementedErrorfail Exceptionrr r r #test_package_newer_than_implementedsz,TestAlpm.test_package_newer_than_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nz'load_package_info() is not implemented!)rZload_package_inforrrrr r r test_load_package_infoszTestAlpm.test_load_package_infocCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz$packages_files() is not implemented!)rZ package_filesrrrrr r r test_package_files_implementedsz'TestAlpm.test_package_files_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz!provided_by() is not implemented!)rZ provided_byrrrrr r r test_provided_byszTestAlpm.test_provided_byN) __name__ __module__ __qualname__r r rrrrr r r r rs r__main__N) Z__meta__Z&tracer.packageManagers.ipackageManagerrZtracer.packageManagers.alpmr ImportErrorZunittestZskipIfZDISTROZTestCaserrmainr r r r s test_alpm.cpython-39.pyc000064400000004375151121475330011200 0ustar00a "e&@svddlTzddlmZddlmZWney6Yn0eedkoJedkdGdd d ej Z e d krre d S) )*)IPackageManager)AlpmZarchZarcharmz/Skipping tests because they are distro-specificc@s<eZdZddZddZddZddZd d Zd d Zd S)TestAlpmcCs t|_dS)N)rmanagerselfr :/usr/lib/python3.9/site-packages/tracer/tests/test_alpm.pysetUp szTestAlpm.setUpcCs||jtddS)Nz9Every package manager should inherit from IPackageManager)ZassertIsInstancerrrr r r )test_implements_package_manager_interface sz2TestAlpm.test_implements_package_manager_interfacecCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz)packages_newer_than() is not implemented!)rZpackages_newer_thanNotImplementedErrorfail Exceptionrr r r #test_package_newer_than_implementedsz,TestAlpm.test_package_newer_than_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nz'load_package_info() is not implemented!)rZload_package_inforrrrr r r test_load_package_infoszTestAlpm.test_load_package_infocCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz$packages_files() is not implemented!)rZ package_filesrrrrr r r test_package_files_implementedsz'TestAlpm.test_package_files_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz!provided_by() is not implemented!)rZ provided_byrrrrr r r test_provided_byszTestAlpm.test_provided_byN) __name__ __module__ __qualname__r r rrrrr r r r rs r__main__N) Z__meta__Z&tracer.packageManagers.ipackageManagerrZtracer.packageManagers.alpmr ImportErrorZunittestZskipIfZDISTROZTestCaserrmainr r r r s test_applications.cpython-39.opt-1.pyc000064400000012500151121475330013661 0ustar00a "e@sddlTddlmZddlmZmZddlmZmZzddl m Z m Z dZ Wn ddl m Z m Z dZ Yn0Gd d d ejZed kred S) )*)DATA_DIR) Applications Application)ApplicationsCollectionProcessesCollection)patch mock_openz builtins.openz__builtin__.openc@seZdZeddZddZddZddZd d Zd d Z e d ddddZ ddZ ddZ ddZddZe dddddZddZd S)!TestApplicationscCsddtjD|_dS)NcSsg|]}|tr|qS) startswithr.0xr r B/usr/lib/python3.9/site-packages/tracer/tests/test_applications.py s z/TestApplications.setUpClass..)r DEFINITIONS)clsr r r setUpClassszTestApplications.setUpClasscCs|jt_dt_dSN)rrZ_appsselfr r rsetUpszTestApplications.setUpcCs|ttdSr)assertIsInstancerallrrr r rtest_apps_typessz TestApplications.test_apps_typescCstd}||jtdS)Nr)rrrZ instancesr)r applicationr r rtest_application_processess z+TestApplications.test_application_processescCsd}tD]}d|vs$t|dkr6|dt|d|vr^|jtjvr^|d|jd|vrjdnd}|t||d |j |d7}q dS) NrnamezMissing name in definition #typezUnknown type in application: rename)Application {0} has unsupported attribute) rrlenfailstrr ZTYPESvalues assertEqualformatr)rianr r rtest_apps_attributes s z%TestApplications.test_apps_attributescCs8t}|D]&}||j|dkr |d|jq dS)NrzDuplicate definitions for: )rr_countrr&)rappsr,r r rtest_apps_duplicity.sz$TestApplications.test_apps_duplicityz0tracer.resources.applications.System.init_systemZdummy)Z return_valuecCsfd}t|}||j|||jtj||jd||jd|t|dd |jdS)NZNON_EXISTING_APPLICATIONr#r$) rfindr)rr Z DEFAULT_TYPEhelperZnoter%r*)rZ init_systemapp_nameZappr r rtest_app_with_no_definition4s z,TestApplications.test_app_with_no_definitioncCs0tddi}|t|d|t|ddS)Nrfooz)rr)r'repr)rZruler r rtest_representations>s z%TestApplications.test_representationscCs<tdddd}tdddd}||j||jdS)Nr6 applicaiton some helperrr r3rz some helper with {NAME} argument)r assertFalsehelper_contains_name assertTrue)ra1Za2r r rtest_contains_nameCs z#TestApplications.test_contains_namecCs<tdddd}tdddd}||j||jdS)Nr6r9r:r;rzsome helper with {FOO} argument)rr<helper_contains_formatingr>)rr?a3r r rtest_contains_formatingIs z(TestApplications.test_contains_formatingcCs,tdddd}||j||jdS)Nr6r9r;)rr<rAr=)rr?r r rtest_helper_contains_when_noneOs z/TestApplications.test_helper_contains_when_nonez*tracer.resources.system.System.init_systemZsystemdcCsdgt_d}ttt|dt}|t|d|tdd|D||dj d||dj d ||d j d | d |d j Wd n1s0Yd S)z6 Test parsing a single XML file with applications zwhatever-file.xmlz )Z read_datacSsg|]}t|tqSr ) isinstancerrr r rrfz.TestApplications.test_load..rr6zsystemctl restart fooZsessionzkill itN)rrr builtins_openr rr)r%r>rr3endswithr ZassertIn)rZ _init_systemdatar0r r r test_loadTs zTestApplications.test_loadcCs$d}|D]}|j|kr|d7}q|S)Nrr)r)rr4r0countr,r r rr/ls   zTestApplications._countN)__name__ __module__ __qualname__ classmethodrrrrr.r1r r5r8r@rCrDrLr/r r r rr s      r __main__N)Z__meta__Z tracer.pathsrZtracer.resources.applicationsrrZtracer.resources.collectionsrrZ unittest.mockr r rIZmockZunittestZTestCaser rNmainr r r rs  ftest_applications.cpython-39.pyc000064400000012500151121475330012722 0ustar00a "e@sddlTddlmZddlmZmZddlmZmZzddl m Z m Z dZ Wn ddl m Z m Z dZ Yn0Gd d d ejZed kred S) )*)DATA_DIR) Applications Application)ApplicationsCollectionProcessesCollection)patch mock_openz builtins.openz__builtin__.openc@seZdZeddZddZddZddZd d Zd d Z e d ddddZ ddZ ddZ ddZddZe dddddZddZd S)!TestApplicationscCsddtjD|_dS)NcSsg|]}|tr|qS) startswithr.0xr r B/usr/lib/python3.9/site-packages/tracer/tests/test_applications.py s z/TestApplications.setUpClass..)r DEFINITIONS)clsr r r setUpClassszTestApplications.setUpClasscCs|jt_dt_dSN)rrZ_appsselfr r rsetUpszTestApplications.setUpcCs|ttdSr)assertIsInstancerallrrr r rtest_apps_typessz TestApplications.test_apps_typescCstd}||jtdS)Nr)rrrZ instancesr)r applicationr r rtest_application_processess z+TestApplications.test_application_processescCsd}tD]}d|vs$t|dkr6|dt|d|vr^|jtjvr^|d|jd|vrjdnd}|t||d |j |d7}q dS) NrnamezMissing name in definition #typezUnknown type in application: rename)Application {0} has unsupported attribute) rrlenfailstrr ZTYPESvalues assertEqualformatr)rianr r rtest_apps_attributes s z%TestApplications.test_apps_attributescCs8t}|D]&}||j|dkr |d|jq dS)NrzDuplicate definitions for: )rr_countrr&)rappsr,r r rtest_apps_duplicity.sz$TestApplications.test_apps_duplicityz0tracer.resources.applications.System.init_systemZdummy)Z return_valuecCsfd}t|}||j|||jtj||jd||jd|t|dd |jdS)NZNON_EXISTING_APPLICATIONr#r$) rfindr)rr Z DEFAULT_TYPEhelperZnoter%r*)rZ init_systemapp_nameZappr r rtest_app_with_no_definition4s z,TestApplications.test_app_with_no_definitioncCs0tddi}|t|d|t|ddS)Nrfooz)rr)r'repr)rZruler r rtest_representations>s z%TestApplications.test_representationscCs<tdddd}tdddd}||j||jdS)Nr6 applicaiton some helperrr r3rz some helper with {NAME} argument)r assertFalsehelper_contains_name assertTrue)ra1Za2r r rtest_contains_nameCs z#TestApplications.test_contains_namecCs<tdddd}tdddd}||j||jdS)Nr6r9r:r;rzsome helper with {FOO} argument)rr<helper_contains_formatingr>)rr?a3r r rtest_contains_formatingIs z(TestApplications.test_contains_formatingcCs,tdddd}||j||jdS)Nr6r9r;)rr<rAr=)rr?r r rtest_helper_contains_when_noneOs z/TestApplications.test_helper_contains_when_nonez*tracer.resources.system.System.init_systemZsystemdcCsdgt_d}ttt|dt}|t|d|tdd|D||dj d||dj d ||d j d | d |d j Wd n1s0Yd S)z6 Test parsing a single XML file with applications zwhatever-file.xmlz )Z read_datacSsg|]}t|tqSr ) isinstancerrr r rrfz.TestApplications.test_load..rr6zsystemctl restart fooZsessionzkill itN)rrr builtins_openr rr)r%r>rr3endswithr ZassertIn)rZ _init_systemdatar0r r r test_loadTs zTestApplications.test_loadcCs$d}|D]}|j|kr|d7}q|S)Nrr)r)rr4r0countr,r r rr/ls   zTestApplications._countN)__name__ __module__ __qualname__ classmethodrrrrr.r1r r5r8r@rCrDrLr/r r r rr s      r __main__N)Z__meta__Z tracer.pathsrZtracer.resources.applicationsrrZtracer.resources.collectionsrrZ unittest.mockr r rIZmockZunittestZTestCaser rNmainr r r rs  ftest_collections.cpython-39.opt-1.pyc000064400000007473151121475330013526 0ustar00a "e @sbddlTddlmZmZddlmZmZddlmZddl m Z m Z m Z m Z GdddejZd S) )*) Applications Application) ProcessesAffectedProcess)Package)ApplicationsCollectionProcessesCollectionPackagesCollectionAffectedProcessesCollectionc@sXeZdZddZddZddZeddd d Zd d Z d dZ ddZ ddZ dS)TestCollectionscCstj}tdd|d}tdd|d}tdd|d}t|||g}||dt|||g||d t|||g||tdS) NfoobarnamehelpertypebazquxZquuxZcorgerr)r DEFAULT_TYPErr assertEqualsortedassertIsInstance)self default_typea1a2a3 collectionr A/usr/lib/python3.9/site-packages/tracer/tests/test_collections.pytest_applications_sorted sz(TestCollections.test_applications_sortedcCs<t}||t||dt||dtdS)NusergffA)rallrr owned_byZ newer_thanrrr r r!test_processes_typess z$TestCollections.test_processes_typescCs"td}|t|ddS)Nr)rr$r%Z assertGreaterlenr&r r r!test_processes_none_usersz(TestCollections.test_processes_none_userTz%@TODO Create Mock for Processes classcCsdtd}td}tgd|_t}||g||g||||d|||jdS)Ni)rrrr)rsetfilesr updateZassertInindex)rp1p2cr r r!test_processes_updates   z%TestCollections.test_processes_updatecCstd}td}td}tdd}td}t||||g}||||gdt||gd||d||||gdjdS)Nrrrr{rr)rr r intersectionrZassertIsNotNoneZmodified)rr.r/Zp3Zp4Zp5c1r r r!test_packages_intersection,s *z*TestCollections.test_packages_intersectioncCsDtddi}tddi}tddi}t|||g}|ddddS)Nrrrrr)rr Zreplace_values)rrrrr4r r r!test_replace_values7s    z#TestCollections.test_replace_valuescCsPt}|d}tt|dD](}||||dkr"tdq"dS)N create_timerz$The collection isn't sorted properly)rr$rranger(r7 Exception)rr4Zc2ir r r!test_collection_sorted_callableAs  z/TestCollections.test_collection_sorted_callablecCsZtj}tdd|d}tdd|d}t||g}|d}|dd|DddgdS) za https://github.com/FrostyX/tracer/issues/151 https://github.com/FrostyX/tracer/issues/156 rNrrrrcSsg|] }|jqSr )r).0Zappr r r! SzGTestCollections.test_application_sorted_none_helper..)rrrr rr)rrrrrZcollection_sortedr r r!#test_application_sorted_none_helperIs  z3TestCollections.test_application_sorted_none_helperN) __name__ __module__ __qualname__r"r'r)unittestZskipIfr1r5r6r;r?r r r r!r s     r N)Z__meta__Ztracer.resources.applicationsrrZtracer.resources.processesrrZtracer.resources.packagerZtracer.resources.collectionsr r r r rCZTestCaser r r r r!s  test_collections.cpython-39.pyc000064400000010226151121475330012555 0ustar00a "e @sbddlTddlmZmZddlmZmZddlmZddl m Z m Z m Z m Z GdddejZd S) )*) Applications Application) ProcessesAffectedProcess)Package)ApplicationsCollectionProcessesCollectionPackagesCollectionAffectedProcessesCollectionc@sXeZdZddZddZddZeddd d Zd d Z d dZ ddZ ddZ dS)TestCollectionscCstj}tdd|d}tdd|d}tdd|d}t|||g}||dt|||g||d t|||g||tdS) NfoobarnamehelpertypebazquxZquuxZcorgerr)r DEFAULT_TYPErr assertEqualsortedassertIsInstance)self default_typea1a2a3 collectionr A/usr/lib/python3.9/site-packages/tracer/tests/test_collections.pytest_applications_sorted sz(TestCollections.test_applications_sortedcCs<t}||t||dt||dtdS)NusergffA)rallrr owned_byZ newer_thanrrr r r!test_processes_typess z$TestCollections.test_processes_typescCs"td}|t|ddS)Nr)rr$r%Z assertGreaterlenr&r r r!test_processes_none_usersz(TestCollections.test_processes_none_userTz%@TODO Create Mock for Processes classcCsdtd}td}tgd|_t}||g||g||||d|||jdS)Ni)rrrr)rsetfilesr updateZassertInindex)rp1p2cr r r!test_processes_updates   z%TestCollections.test_processes_updatecCstd}td}td}tdd}td}t||||g}||||gdt||gd||d||||gdjdS)Nrrrr{rr)rr r intersectionrZassertIsNotNoneZmodified)rr.r/Zp3Zp4Zp5c1r r r!test_packages_intersection,s *z*TestCollections.test_packages_intersectioncCsxtddi}tddi}tddi}t|||g}dd|DhdksLJ|dddd d|Dhd kstJdS) NrrrrcSsh|] }|jqSr r.0ar r r! =z6TestCollections.test_replace_values..>rrrrcSsh|] }|jqSr r6r7r r r!r:?r;>rrr)rr Zreplace_values)rrrrr4r r r!test_replace_values7s   z#TestCollections.test_replace_valuescCsPt}|d}tt|dD](}||||dkr"tdq"dS)N create_timerz$The collection isn't sorted properly)rr$rranger(r= Exception)rr4Zc2ir r r!test_collection_sorted_callableAs  z/TestCollections.test_collection_sorted_callablecCsZtj}tdd|d}tdd|d}t||g}|d}|dd|DddgdS) za https://github.com/FrostyX/tracer/issues/151 https://github.com/FrostyX/tracer/issues/156 rNrrrrcSsg|] }|jqSr )r)r8Zappr r r! Sr;zGTestCollections.test_application_sorted_none_helper..)rrrr rr)rrrrrZcollection_sortedr r r!#test_application_sorted_none_helperIs  z3TestCollections.test_application_sorted_none_helperN) __name__ __module__ __qualname__r"r'r)unittestZskipIfr1r5r<rArCr r r r!r s     r N)Z__meta__Ztracer.resources.applicationsrrZtracer.resources.processesrrZtracer.resources.packagerZtracer.resources.collectionsr r r r rGZTestCaser r r r r!s  test_dnf.cpython-39.opt-1.pyc000064400000004364151121475330011753 0ustar00a "e%@svddlTzddlmZddlmZWney6Yn0eedkoJedkdGdd d ej Z e d krre d S) )*)IPackageManager)DnfZfedoraZmageiaz/Skipping tests because they are distro-specificc@s<eZdZddZddZddZddZd d Zd d Zd S)TestDnfcCs t|_dS)N)rmanagerselfr 9/usr/lib/python3.9/site-packages/tracer/tests/test_dnf.pysetUp sz TestDnf.setUpcCs||jtddS)Nz9Every package manager should inherit from IPackageManager)ZassertIsInstancerrrr r r )test_implements_package_manager_interface sz1TestDnf.test_implements_package_manager_interfacecCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz)packages_newer_than() is not implemented!)rZpackages_newer_thanNotImplementedErrorfail Exceptionrr r r #test_package_newer_than_implementedsz+TestDnf.test_package_newer_than_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nz'load_package_info() is not implemented!)rZload_package_inforrrrr r r test_load_package_infoszTestDnf.test_load_package_infocCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz$packages_files() is not implemented!)rZ package_filesrrrrr r r test_package_files_implementedsz&TestDnf.test_package_files_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz!provided_by() is not implemented!)rZ provided_byrrrrr r r test_provided_byszTestDnf.test_provided_byN) __name__ __module__ __qualname__r r rrrrr r r r rs r__main__N) Z__meta__Z&tracer.packageManagers.ipackageManagerrZtracer.packageManagers.dnfr ImportErrorZunittestZskipIfZDISTROZTestCaserrmainr r r r s test_dnf.cpython-39.pyc000064400000004364151121475330011014 0ustar00a "e%@svddlTzddlmZddlmZWney6Yn0eedkoJedkdGdd d ej Z e d krre d S) )*)IPackageManager)DnfZfedoraZmageiaz/Skipping tests because they are distro-specificc@s<eZdZddZddZddZddZd d Zd d Zd S)TestDnfcCs t|_dS)N)rmanagerselfr 9/usr/lib/python3.9/site-packages/tracer/tests/test_dnf.pysetUp sz TestDnf.setUpcCs||jtddS)Nz9Every package manager should inherit from IPackageManager)ZassertIsInstancerrrr r r )test_implements_package_manager_interface sz1TestDnf.test_implements_package_manager_interfacecCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz)packages_newer_than() is not implemented!)rZpackages_newer_thanNotImplementedErrorfail Exceptionrr r r #test_package_newer_than_implementedsz+TestDnf.test_package_newer_than_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nz'load_package_info() is not implemented!)rZload_package_inforrrrr r r test_load_package_infoszTestDnf.test_load_package_infocCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz$packages_files() is not implemented!)rZ package_filesrrrrr r r test_package_files_implementedsz&TestDnf.test_package_files_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz!provided_by() is not implemented!)rZ provided_byrrrrr r r test_provided_byszTestDnf.test_provided_byN) __name__ __module__ __qualname__r r rrrrr r r r rs r__main__N) Z__meta__Z&tracer.packageManagers.ipackageManagerrZtracer.packageManagers.dnfr ImportErrorZunittestZskipIfZDISTROZTestCaserrmainr r r r s test_dpkg.cpython-39.opt-1.pyc000064400000004356151121475330012132 0ustar00a "e@snddlTzddlmZddlmZWney6Yn0eedkdGdddej Z e d krje d S) )*)IPackageManager)DpkgZdebianz/Skipping tests because they are distro-specificc@s<eZdZddZddZddZddZd d Zd d Zd S)TestDpkgcCs t|_dS)N)rmanagerselfr :/usr/lib/python3.9/site-packages/tracer/tests/test_dpkg.pysetUp szTestDpkg.setUpcCs||jtddS)Nz9Every package manager should inherit from IPackageManager)ZassertIsInstancerrrr r r )test_implements_package_manager_interface sz2TestDpkg.test_implements_package_manager_interfacecCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz)packages_newer_than() is not implemented!)rZpackages_newer_thanNotImplementedErrorfail Exceptionrr r r #test_package_newer_than_implementedsz,TestDpkg.test_package_newer_than_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nz'load_package_info() is not implemented!)rZload_package_inforrrrr r r test_load_package_infoszTestDpkg.test_load_package_infocCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz$packages_files() is not implemented!)rZ package_filesrrrrr r r test_package_files_implementedsz'TestDpkg.test_package_files_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz!provided_by() is not implemented!)rZ provided_byrrrrr r r test_provided_byszTestDpkg.test_provided_byN) __name__ __module__ __qualname__r r rrrrr r r r rs r__main__N) Z__meta__Z&tracer.packageManagers.ipackageManagerrZtracer.packageManagers.dpkgr ImportErrorZunittestZskipIfZDISTROZTestCaserrmainr r r r s test_dpkg.cpython-39.pyc000064400000004356151121475330011173 0ustar00a "e@snddlTzddlmZddlmZWney6Yn0eedkdGdddej Z e d krje d S) )*)IPackageManager)DpkgZdebianz/Skipping tests because they are distro-specificc@s<eZdZddZddZddZddZd d Zd d Zd S)TestDpkgcCs t|_dS)N)rmanagerselfr :/usr/lib/python3.9/site-packages/tracer/tests/test_dpkg.pysetUp szTestDpkg.setUpcCs||jtddS)Nz9Every package manager should inherit from IPackageManager)ZassertIsInstancerrrr r r )test_implements_package_manager_interface sz2TestDpkg.test_implements_package_manager_interfacecCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz)packages_newer_than() is not implemented!)rZpackages_newer_thanNotImplementedErrorfail Exceptionrr r r #test_package_newer_than_implementedsz,TestDpkg.test_package_newer_than_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nz'load_package_info() is not implemented!)rZload_package_inforrrrr r r test_load_package_infoszTestDpkg.test_load_package_infocCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz$packages_files() is not implemented!)rZ package_filesrrrrr r r test_package_files_implementedsz'TestDpkg.test_package_files_implementedcCsBz|jdWn,ty,|dYnty<Yn0dS)Nrz!provided_by() is not implemented!)rZ provided_byrrrrr r r test_provided_byszTestDpkg.test_provided_byN) __name__ __module__ __qualname__r r rrrrr r r r rs r__main__N) Z__meta__Z&tracer.packageManagers.ipackageManagerrZtracer.packageManagers.dpkgr ImportErrorZunittestZskipIfZDISTROZTestCaserrmainr r r r s test_hooks.cpython-39.opt-1.pyc000064400000003476151121475330012332 0ustar00a "e@sddlTddlmZmZdaedddZedd gd d Zed d dZedddZGddde j Z e dkre dS))*) HooksObservermatchNapp1cCsdadS)Ndummycalledr r ;/usr/lib/python3.9/site-packages/tracer/tests/test_hooks.py hook_dummysr app2app3cCsdadS)N dummy_listrr r r r hook_dummy_list srfoocCstddS)Nrr appendr r r r hook_dummy_append1srbarcCstddS)Nrrr r r r hook_dummy_append2src@s,eZdZddZddZddZddZd S) TestHookscCst|_dadS)N)robserverr selfr r r setUpszTestHooks.setUpcCsF|d|td|d|td|d|tddS)Nrrr rr)rZ assertEqualr rr r r test_hook"s      zTestHooks.test_hookcCs,ga|d|d|tddgdS)Nrr)r rZassertListEqualrr r r test_hooks_list,s  zTestHooks.test_hooks_listcCs|d|tdS)NZ undefined)rZ assertIsNoner rr r r test_undefined_hook3s zTestHooks.test_undefined_hookN)__name__ __module__ __qualname__rrrrr r r r rs r__main__)Z__meta__Z tracer.hooksrrr r rrrZunittestZTestCaserrmainr r r r s     test_hooks.cpython-39.pyc000064400000003476151121475330011373 0ustar00a "e@sddlTddlmZmZdaedddZedd gd d Zed d dZedddZGddde j Z e dkre dS))*) HooksObservermatchNapp1cCsdadS)Ndummycalledr r ;/usr/lib/python3.9/site-packages/tracer/tests/test_hooks.py hook_dummysr app2app3cCsdadS)N dummy_listrr r r r hook_dummy_list srfoocCstddS)Nrr appendr r r r hook_dummy_append1srbarcCstddS)Nrrr r r r hook_dummy_append2src@s,eZdZddZddZddZddZd S) TestHookscCst|_dadS)N)robserverr selfr r r setUpszTestHooks.setUpcCsF|d|td|d|td|d|tddS)Nrrr rr)rZ assertEqualr rr r r test_hook"s      zTestHooks.test_hookcCs,ga|d|d|tddgdS)Nrr)r rZassertListEqualrr r r test_hooks_list,s  zTestHooks.test_hooks_listcCs|d|tdS)NZ undefined)rZ assertIsNoner rr r r test_undefined_hook3s zTestHooks.test_undefined_hookN)__name__ __module__ __qualname__rrrrr r r r rs r__main__)Z__meta__Z tracer.hooksrrr r rrrZunittestZTestCaserrmainr r r r s     test_lang.cpython-39.opt-1.pyc000064400000001251151121475330012115 0ustar00a "e@sHddlTddlmmZddlZGdddejZedkrDe dS))*Nc@seZdZddZdS)TestLangcCs|ttddS)N_)Z assertTruehasattrlang)selfr :/usr/lib/python3.9/site-packages/tracer/tests/test_lang.py test_provide_underscore_functionsz)TestLang.test_provide_underscore_functionN)__name__ __module__ __qualname__r r r r r rsr__main__) Z__meta__Ztracer.resources.langZ resourcesrosZunittestZTestCaserr mainr r r r s test_query.cpython-39.opt-1.pyc000064400000002544151121475330012347 0ustar00a "e>@sNddlTddlmZmZGdddejZGdddeZe dkrJe d S) )*)QueryLazyc@seZdZddZddZdS) TestQuerycCsttd|_dS)N)Ztracer)r TracerMockquery)selfr ;/usr/lib/python3.9/site-packages/tracer/tests/test_query.pysetUpszTestQuery.setUpcCsB|j}||t|t|d|t|gddS)NgetABC) rZaffected_applicationsZassertIsInstancerZ assertTruehasattrZassertListEquallistr )r Z apps_queryr r r test_affected_applications s  z$TestQuery.test_affected_applicationsN)__name__ __module__ __qualname__r rr r r r rsrc@seZdZddZdddZdS)rcGsdS)Nr )r argsr r r __init__szTracerMock.__init__NcCsgdS)Nrr )r userr r r trace_affectedszTracerMock.trace_affected)N)rrrrrr r r r rsr__main__N) Z__meta__Z tracer.queryrrZunittestZTestCaserobjectrrmainr r r r s