ó
    ð›‘h(  ã                   óØ   • S SK Jr  S SKJr   S SKJr  S SKJ
r
Jr  S SKJr  Sr " S S	\5      r\" \
5       " S
 S\5      5       rg! \ a     S SKJr   NA! \ a
    S SK	Jr    NPf = ff = f)é    )Úimplementer)ÚProtocolWrapper©ÚnotFound)Ú
NoResource)Ú	IResourceÚResource)ÚNOT_DONE_YET)ÚWebSocketResourceÚWSGIRootResourcec                   ó$   • \ rS rSrSrS rS rSrg)r   é6   aƒ  
Root resource when you want a WSGI resource be the default serving
resource for a Twisted Web site, but have subpaths served by
different resources.

This is a hack needed since
`twisted.web.wsgi.WSGIResource <http://twistedmatrix.com/documents/current/api/twisted.web.wsgi.WSGIResource.html>`_.
does not provide a ``putChild()`` method.

.. seealso::

   * `Autobahn Twisted Web WSGI example <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/echo_wsgi>`_
   * `Original hack <http://blog.vrplumber.com/index.php?/archives/2426-Making-your-Twisted-resources-a-url-sub-tree-of-your-WSGI-resource....html>`_
c                 óH   • [         R                  " U 5        Xl        X l        g)aU  

:param wsgiResource: The WSGI to serve as root resource.
:type wsgiResource: Instance of `twisted.web.wsgi.WSGIResource <http://twistedmatrix.com/documents/current/api/twisted.web.wsgi.WSGIResource.html>`_.
:param children: A dictionary with string keys constituting URL subpaths, and Twisted Web resources as values.
:type children: dict
N)r	   Ú__init__Ú_wsgiResourceÚchildren)ÚselfÚwsgiResourcer   s      Ú]C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\autobahn/twisted/resource.pyr   ÚWSGIRootResource.__init__F   s   € ô 	×Ò˜$ÔØ)ÔØ �ó    c                 ó†   • UR                   R                  5         UR                  R                  SU5        U R                  $ )Nr   )ÚprepathÚpopÚpostpathÚinsertr   )r   ÚpathÚrequests      r   ÚgetChildÚWSGIRootResource.getChildR   s4   € Ø�‰×ÑÔØ×Ñ×Ñ  4Ô(Ø×!Ñ!Ð!r   )r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Ú__static_attributes__© r   r   r   r   6   s   † ñò
!õ"r   r   c                   ó4   • \ rS rSrSrSrS rS rS rS r	Sr
g	)
r   éX   z'
A Twisted Web resource for WebSocket.
Tc                 ó   • Xl         g)zp

:param factory: An instance of :class:`autobahn.twisted.websocket.WebSocketServerFactory`.
:type factory: obj
N©Ú_factory)r   Úfactorys     r   r   ÚWebSocketResource.__init___   s	   € ð  �r   c                 ó   • [        SS9$ )zB
This resource cannot have children, hence this will always fail.
zNo such child resource.)Úmessager   )r   Únamer   s      r   ÚgetChildWithDefaultÚ%WebSocketResource.getChildWithDefaulth   s   € ô Ð 9Ñ:Ð:r   c                 ó   • g)zC
This resource cannot have children, hence this is always ignored.
Nr'   )r   r   Úchilds      r   ÚputChildÚWebSocketResource.putChildn   s   � r   c                 óV  • UR                   R                  cV  SSKJn  UR	                  SS5        UR                  SS5        UR                  SUR                  4-  nUR                  S	5      $ U R                  R                  UR                  R                  5       5      nU(       d  UR	                  S
5        gUR                   R                  SsoAR                   l        [        U[        5      (       a  X$l        O6[        UR                  [        5      (       a  X$R                  l        OX$l        UR                  U5        [!        US5      (       a  UR"                  R%                  5         O![!        US5      (       a  UR%                  5         UR&                  S-   UR(                  -   S-   nUR*                  R-                  5        H%  nXVS   S-   SR/                  US   5      -   S-   -  nM'     US-  nXQR0                  R3                  5       -  nUR5                  U5        [6        $ )zÂ
Render the resource. This will takeover the transport underlying
the request, create a :class:`autobahn.twisted.websocket.WebSocketServerProtocol`
and let that do any subsequent communication.
Nr   )Úprotocoliª  s   Upgrade requireds   Upgrades	   WebSocketÚ Úutf8iô  r   Ú_networkProducerÚresumeProducingó    s    HTTP/1.1
s   : ó   ,é   s   
)ÚchannelÚ	transportÚautobahn.websocketr9   ÚsetResponseCodeÚ	setHeaderÚ_SERVER_STATUS_TEMPLATEÚ__version__Úencoder,   ÚbuildProtocolÚgetPeerÚ
isinstancer   ÚwrappedProtocolÚmakeConnectionÚhasattrr<   r=   ÚmethodÚuriÚrequestHeadersÚgetAllRawHeadersÚjoinÚcontentÚreadÚdataReceivedr
   )r   r   r9   ÚhtmlrB   ÚdataÚhs          r   ÚrenderÚWebSocketResource.renders   sÏ  € ð �?‰?×$Ñ$Ñ,å3Ø×#Ñ# CÐ)<Ô=ð ×Ñ˜j¨,Ô7Ø×3Ñ3°r¸8×;OÑ;OÐ6PÑPˆDØ—;‘;˜vÓ&Ð&ð —=‘=×.Ñ.¨w×/@Ñ/@×/HÑ/HÓ/JÓKˆÞà×#Ñ# CÔ(Øð 07¯©×/HÑ/HÈ$Ð,ˆ	—?‘?Ô,ô �i¤×1Ñ1à(0Õ%Ü˜	×*Ñ*¬O×<Ñ<à19×ÑÕ.à!)ÔØ×Ñ 	Ô*ô �9Ð0×1Ñ1Ø×&Ñ&×6Ñ6Õ8ä�YÐ 1×2Ñ2Ø×%Ñ%Ô'ð �~‰~ Ñ$ w§{¡{Ñ2Ð5IÑIˆØ×'Ñ'×8Ñ8Ö:ˆAØ�a‘D˜5‘L 4§9¡9¨Q¨q©T£?Ñ2°[Ñ@Ñ@ŠDñ ;à�ÑˆØ—‘×$Ñ$Ó&Ñ&ˆØ×Ñ˜dÔ#äÐr   r+   N)r!   r"   r#   r$   r%   ÚisLeafr   r2   r6   rZ   r&   r'   r   r   r   r   X   s#   † ñð €Fò ò;òõ
Cr   r   N)Úzope.interfacer   Útwisted.protocols.policiesr   Útwisted.web.pagesr   ÚImportErrorÚtwisted.web.resourcer   Útwisted.web.errorr   r	   Útwisted.web.serverr
   Ú__all__r   Úobjectr   r'   r   r   Ú<module>rf      s…   ðõ8 'å 6ð	=å*÷ 5õ ,ð€ô"�xô "ñD ˆYÓô]˜ó ]ó ñ]øðo ó =ð=ç?øØó =ç<Ð<ð=úð	=ús)   ŽA ÁA)ÁAÁA%Á!A)Á$A%Á%A)