
    <iy                     
   S r SSKrSSKrSSKrSrSrSrSrSr	/ SQr
S	\-  \l        S
r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S \5      r " S! S"\5      r " S# S$\5      r " S% S&\5      r " S' S(\5      r " S) S*\5      r\R@                  RB                  RE                  S+S,S-S.S/5      r#\R@                  RB                  RI                  S0S1S2S3S4S5S6S7S8S9S:S;S<S=S>S?5      r%\R@                  RB                  RE                  S@SASBSCSDSES+SFSGSHSISJSKSLSM5      r&\R@                  RB                  RE                  SNSOSPSQSRSS5      r'\R@                  RB                  RE                  STSUSVSW5      r(\R@                  RB                  RE                  SXSYSZS[S\S]S^S_5      r)\R@                  RB                  RE                  S`SaSbScSdSeSfSgShSiSjSkSlSmSn5      r*\R@                  RB                  RE                  SoSp5      r+\R@                  RB                  RE                  SqSrSsStSuSvSwSxSySzS{5      r,\R@                  RB                  RE                  S|S}S~SSSSjSSdSbSeSSaS5      r-\R@                  RB                  RE                  SSSSSSSRSSS5	      r.\R@                  RB                  RD                  " \-R_                  5       SS/-   6 r0\R@                  RB                  RE                  SS5      r1\R@                  RB                  RE                  SSSSS5      r2\R@                  RB                  RE                  SSNSSRSS5      r3\R@                  RB                  RE                  SS~SSSjSSSeS|S5
      r4\R@                  RB                  RE                  SSS5      r5\R@                  RB                  RE                  SXSS5      r6\R@                  RB                  RE                  S5      r7\R@                  RB                  RE                  SSSSSS5      r8\R@                  RB                  RE                  SSSSS5      r9\R@                  RB                  RE                  SSS5      r:\R@                  RB                  RE                  SSS5      r;\R@                  RB                  RE                  ScSSSSSRS5      r<\R@                  RB                  RE                  SSSSSS5      r=\R@                  RB                  RE                  SSSS5      r>SSK?rg)aM  
Library for working with the tor process.

**Module Overview:**

::

  Endpoint - Networking endpoint.
    |- ORPort - Tor relay endpoint.
    +- DirPort - Descriptor mirror.

  ControllerError - Base exception raised when using the controller.
    |- ProtocolError - Malformed socket data.
    |
    |- OperationFailed - Tor was unable to successfully complete the operation.
    |  |- UnsatisfiableRequest - Tor was unable to satisfy a valid request.
    |  |  |- CircuitExtensionFailed - Attempt to make or extend a circuit failed.
    |  |  |- DescriptorUnavailable - The given relay descriptor is unavailable.
    |  |  +- Timeout - Caller requested timeout was reached.
    |  |
    |  |
    |  +- InvalidRequest - Invalid request.
    |     +- InvalidArguments - Invalid request parameters.
    |
    +- SocketError - Communication with the socket failed.
       +- SocketClosed - Socket has been shut down.

  DownloadFailed - Inability to download a resource.
    +- DownloadTimeout - Download timeout reached.

.. data:: Runlevel (enum)

  Rating of importance used for event logging.

  =========== ===========
  Runlevel    Description
  =========== ===========
  **ERR**     critical issues that impair tor's ability to function
  **WARN**    non-critical issues the user should be aware of
  **NOTICE**  information that may be helpful to the user
  **INFO**    high level runtime information
  **DEBUG**   low level runtime information
  =========== ===========

.. data:: Signal (enum)

  Signals that the tor process will accept.

  .. versionchanged:: 1.3.0
     Added the HEARTBEAT signal.

  .. versionchanged:: 1.8.0
     Added the ACTIVE and DORMANT signals. You can check for Tor support for
     these signals with the **DORMANT_MODE** :data:`~stem.version.Requirement`

  ========================= ===========
  Signal                    Description
  ========================= ===========
  **RELOAD** or **HUP**     reloads our torrc
  **SHUTDOWN** or **INT**   shut down, waiting ShutdownWaitLength first if we're a relay
  **DUMP** or **USR1**      dumps information about open connections and circuits to our log
  **DEBUG** or **USR2**     switch our logging to the DEBUG runlevel
  **HALT** or **TERM**      exit tor immediately
  **NEWNYM**                switch to new circuits, so new application requests don't share any circuits with old ones (this also clears our DNS cache)
  **CLEARDNSCACHE**         clears cached DNS results
  **HEARTBEAT**             trigger a heartbeat log message
  **DORMANT**               enables *dormant mode*, during which tor will avoid cpu and network usage
  **ACTIVE**                disables *dormant mode*
  ========================= ===========

.. data:: Flag (enum)

  Flag assigned to tor relays by the authorities to indicate various
  characteristics.

  **Note:** The BADDIRECTORY flag was `removed from tor <https://gitweb.torproject.org/torspec.git/commit/dir-spec.txt?id=2f012f1>`_.

  .. versionchanged:: 1.5.0
     Added the NO_ED_CONSENSUS flag.

  .. versionchanged:: 1.8.0
     Added the STALE_DESC flag.

  =================== ===========
  Flag                Description
  =================== ===========
  **AUTHORITY**       relay is a directory authority
  **BADEXIT**         relay shouldn't be used as an exit due to being either problematic or malicious
  **BADDIRECTORY**    relay shouldn't be used for directory information
  **EXIT**            relay's exit policy makes it more useful as an exit rather than middle hop
  **FAST**            relay's suitable for high-bandwidth circuits
  **GUARD**           relay's suitable for being an entry guard (first hop)
  **HSDIR**           relay is being used as a v2 hidden service directory
  **NAMED**           relay can be referred to by its nickname
  **NO_ED_CONSENSUS** relay's Ed25519 doesn't reflrect the consensus
  **RUNNING**         relay is currently usable
  **STABLE**          relay's suitable for long-lived circuits
  **STALE_DESC**      relay descriptor is outdated and should be re-uploaded
  **UNNAMED**         relay isn't currently bound to a nickname
  **V2DIR**           relay supports the v2 directory protocol
  **VALID**           relay has been validated
  =================== ===========

.. data:: CircStatus (enum)

  Statuses that a circuit can be in. Tor may provide statuses not in this enum.

  .. versionchanged:: 1.6.0
     Added the GUARD_WAIT signal.

  ============== ===========
  CircStatus     Description
  ============== ===========
  **LAUNCHED**   new circuit was created
  **BUILT**      circuit finished being created and can accept traffic
  **GUARD_WAIT** waiting to see if there's a circuit with a better guard before using
  **EXTENDED**   circuit has been extended by a hop
  **FAILED**     circuit construction failed
  **CLOSED**     circuit has been closed
  ============== ===========

.. data:: CircBuildFlag (enum)

  Attributes about how a circuit is built. These were introduced in tor version
  0.2.3.11. Tor may provide flags not in this enum.

  ================= ===========
  CircBuildFlag     Description
  ================= ===========
  **ONEHOP_TUNNEL** single hop circuit to fetch directory information
  **IS_INTERNAL**   circuit that won't be used for client traffic
  **NEED_CAPACITY** circuit only includes high capacity relays
  **NEED_UPTIME**   circuit only includes relays with a high uptime
  ================= ===========

.. data:: CircPurpose (enum)

  Description of what a circuit is intended for. These were introduced in tor
  version 0.2.1.6. Tor may provide purposes not in this enum.

  ==================== ===========
  CircPurpose          Description
  ==================== ===========
  **GENERAL**          client traffic or fetching directory information
  **HS_CLIENT_INTRO**  client side introduction point for a hidden service circuit
  **HS_CLIENT_REND**   client side hidden service rendezvous circuit
  **HS_SERVICE_INTRO** server side introduction point for a hidden service circuit
  **HS_SERVICE_REND**  server side hidden service rendezvous circuit
  **TESTING**          testing to see if we're reachable, so we can be used as a relay
  **CONTROLLER**       circuit that was built by a controller
  **MEASURE_TIMEOUT**  circuit being kept around to see how long it takes
  ==================== ===========

.. data:: CircClosureReason (enum)

  Reason that a circuit is being closed or failed to be established. Tor may
  provide reasons not in this enum.

  ========================= ===========
  CircClosureReason         Description
  ========================= ===========
  **NONE**                  no reason given
  **TORPROTOCOL**           violation in the tor protocol
  **INTERNAL**              internal error
  **REQUESTED**             requested by the client via a TRUNCATE command
  **HIBERNATING**           relay is currently hibernating
  **RESOURCELIMIT**         relay is out of memory, sockets, or circuit IDs
  **CONNECTFAILED**         unable to contact the relay
  **OR_IDENTITY**           relay had the wrong OR identification
  **OR_CONN_CLOSED**        connection failed after being established
  **FINISHED**              circuit has expired (see tor's MaxCircuitDirtiness config option)
  **TIMEOUT**               circuit construction timed out
  **DESTROYED**             circuit unexpectedly closed
  **NOPATH**                not enough relays to make a circuit
  **NOSUCHSERVICE**         requested hidden service does not exist
  **MEASUREMENT_EXPIRED**   same as **TIMEOUT** except that it was left open for measurement purposes
  ========================= ===========

.. data:: CircEvent (enum)

  Type of change reflected in a circuit by a CIRC_MINOR event. Tor may provide
  event types not in this enum.

  ===================== ===========
  CircEvent             Description
  ===================== ===========
  **PURPOSE_CHANGED**   circuit purpose or hidden service state has changed
  **CANNIBALIZED**      circuit connections are being reused for a different circuit
  ===================== ===========

.. data:: HiddenServiceState (enum)

  State that a hidden service circuit can have. These were introduced in tor
  version 0.2.3.11. Tor may provide states not in this enum.

  Enumerations fall into four groups based on their prefix...

  ======= ===========
  Prefix  Description
  ======= ===========
  HSCI_*  client-side introduction-point
  HSCR_*  client-side rendezvous-point
  HSSI_*  service-side introduction-point
  HSSR_*  service-side rendezvous-point
  ======= ===========

  ============================= ===========
  HiddenServiceState            Description
  ============================= ===========
  **HSCI_CONNECTING**           connecting to the introductory point
  **HSCI_INTRO_SENT**           sent INTRODUCE1 and awaiting a reply
  **HSCI_DONE**                 received a reply, circuit is closing
  **HSCR_CONNECTING**           connecting to the introductory point
  **HSCR_ESTABLISHED_IDLE**     rendezvous-point established, awaiting an introduction
  **HSCR_ESTABLISHED_WAITING**  introduction received, awaiting a rend
  **HSCR_JOINED**               connected to the hidden service
  **HSSI_CONNECTING**           connecting to the introductory point
  **HSSI_ESTABLISHED**          established introductory point
  **HSSR_CONNECTING**           connecting to the introductory point
  **HSSR_JOINED**               connected to the rendezvous-point
  ============================= ===========

.. data:: RelayEndReason (enum)

  Reasons why the stream is to be closed.

  =================== ===========
  RelayEndReason      Description
  =================== ===========
  **MISC**            none of the following reasons
  **RESOLVEFAILED**   unable to resolve the hostname
  **CONNECTREFUSED**  remote host refused the connection
  **EXITPOLICY**      OR refuses to connect to the destination
  **DESTROY**         circuit is being shut down
  **DONE**            connection has been closed
  **TIMEOUT**         connection timed out
  **NOROUTE**         routing error while contacting the destination
  **HIBERNATING**     relay is temporarily hibernating
  **INTERNAL**        internal error at the relay
  **RESOURCELIMIT**   relay has insufficient resources to service the request
  **CONNRESET**       connection was unexpectedly reset
  **TORPROTOCOL**     violation in the tor protocol
  **NOTDIRECTORY**    directory information requested from a relay that isn't mirroring it
  =================== ===========

.. data:: StreamStatus (enum)

  State that a stream going through tor can have. Tor may provide states not in
  this enum.

  ================= ===========
  StreamStatus      Description
  ================= ===========
  **NEW**           request for a new connection
  **NEWRESOLVE**    request to resolve an address
  **REMAP**         address is being re-mapped to another
  **SENTCONNECT**   sent a connect cell along a circuit
  **SENTRESOLVE**   sent a resolve cell along a circuit
  **SUCCEEDED**     stream has been established
  **FAILED**        stream is detached, and won't be re-established
  **DETACHED**      stream is detached, but might be re-established
  **CLOSED**        stream has closed
  ================= ===========

.. data:: StreamClosureReason (enum)

  Reason that a stream is being closed or failed to be established. This
  includes all values in the :data:`~stem.RelayEndReason` enumeration as
  well as the following. Tor may provide reasons not in this enum.

  ===================== ===========
  StreamClosureReason   Description
  ===================== ===========
  **END**               endpoint has sent a RELAY_END cell
  **PRIVATE_ADDR**      endpoint was a private address (127.0.0.1, 10.0.0.1, etc)
  ===================== ===========

.. data:: StreamSource (enum)

  Cause of a stream being remapped to another address. Tor may provide sources
  not in this enum.

  ============= ===========
  StreamSource  Description
  ============= ===========
  **CACHE**     tor is remapping because of a cached answer
  **EXIT**      exit relay requested the remap
  ============= ===========

.. data:: StreamPurpose (enum)

  Purpsoe of the stream. This is only provided with new streams and tor may
  provide purposes not in this enum.

  ================= ===========
  StreamPurpose     Description
  ================= ===========
  **DIR_FETCH**     fetching directory information (descriptors, consensus, etc)
  **DIR_UPLOAD**    uploading our descriptor to an authority
  **DNS_REQUEST**   user initiated DNS request
  **DIRPORT_TEST**  checking that our directory port is reachable externally
  **USER**          either relaying user traffic or not one of the above categories
  ================= ===========

.. data:: ORStatus (enum)

  State that an OR connection can have. Tor may provide states not in this
  enum.

  =============== ===========
  ORStatus        Description
  =============== ===========
  **NEW**         received OR connection, starting server-side handshake
  **LAUNCHED**    launched outbound OR connection, starting client-side handshake
  **CONNECTED**   OR connection has been established
  **FAILED**      attempt to establish OR connection failed
  **CLOSED**      OR connection has been closed
  =============== ===========

.. data:: ORClosureReason (enum)

  Reason that an OR connection is being closed or failed to be established. Tor
  may provide reasons not in this enum.

  =================== ===========
  ORClosureReason     Description
  =================== ===========
  **DONE**            OR connection shut down cleanly
  **CONNECTREFUSED**  got a ECONNREFUSED when connecting to the relay
  **IDENTITY**        identity of the relay wasn't what we expected
  **CONNECTRESET**    got a ECONNRESET or similar error from relay
  **TIMEOUT**         got a ETIMEOUT or similar error from relay
  **NOROUTE**         got a ENOTCONN, ENETUNREACH, ENETDOWN, EHOSTUNREACH, or similar error from relay
  **IOERROR**         got a different kind of error from relay
  **RESOURCELIMIT**   relay has insufficient resources to service the request
  **MISC**            connection refused for another reason
  **PT_MISSING**      no pluggable transport was available
  =================== ===========

.. data:: AuthDescriptorAction (enum)

  Actions that directory authorities might take with relay descriptors. Tor may
  provide reasons not in this enum.

  ===================== ===========
  AuthDescriptorAction  Description
  ===================== ===========
  **ACCEPTED**          accepting the descriptor as the newest version
  **DROPPED**           descriptor rejected without notifying the relay
  **REJECTED**          relay notified that its descriptor has been rejected
  ===================== ===========

.. data:: StatusType (enum)

  Sources for tor status events. Tor may provide types not in this enum.

  ============= ===========
  StatusType    Description
  ============= ===========
  **GENERAL**   general tor activity, not specifically as a client or relay
  **CLIENT**    related to our activity as a tor client
  **SERVER**    related to our activity as a tor relay
  ============= ===========

.. data:: GuardType (enum)

  Use a guard relay can be for. Tor may provide types not in this enum.

  =========== ===========
  GuardType   Description
  =========== ===========
  **ENTRY**   used to connect to the tor network
  =========== ===========

.. data:: GuardStatus (enum)

  Status a guard relay can have. Tor may provide types not in this enum.

  ============= ===========
  GuardStatus   Description
  ============= ===========
  **NEW**       new guard that we weren't previously using
  **DROPPED**   removed from use as one of our guards
  **UP**        guard is now reachable
  **DOWN**      guard is now unreachable
  **BAD**       consensus or relay considers this relay to be unusable as a guard
  **GOOD**      consensus or relay considers this relay to be usable as a guard
  ============= ===========

.. data:: TimeoutSetType (enum)

  Way in which the timeout value of a circuit is changing. Tor may provide
  types not in this enum.

  =============== ===========
  TimeoutSetType  Description
  =============== ===========
  **COMPUTED**    tor has computed a new timeout based on prior circuits
  **RESET**       timeout reverted to its default
  **SUSPENDED**   timeout reverted to its default until network connectivity has recovered
  **DISCARD**     throwing out timeout value from when the network was down
  **RESUME**      resumed calculations to determine the proper timeout
  =============== ===========

.. data:: ConnectionType (enum)

  Purpose for a tor connection. Tor may provide types not in this enum.

  The meaning behind these values is a bit unclear, pending :trac:`10086`.

  .. versionadded:: 1.2.0

  =============== ===========
  ConnectionType  Description
  =============== ===========
  **OR**          carrying traffic within the tor network
  **DIR**         fetching or sending tor descriptor data
  **EXIT**        carrying traffic between the tor network and an external destination
  =============== ===========

.. data:: TokenBucket (enum)

  Bucket categories of TB_EMPTY events.

  .. versionadded:: 1.2.0

  =============== ===========
  TokenBucket     Description
  =============== ===========
  **GLOBAL**      global token bucket
  **RELAY**       relay token bucket
  **ORCONN**      bucket used for OR connections
  =============== ===========

.. data:: HSDescAction (enum)

  Action beeing taken in a HS_DESC event.

  .. versionadded:: 1.2.0

  .. versionchanged:: 1.4.0
     Added the UPLOAD and UPLOADED actions.

  .. versionchanged:: 1.5.0
     Added the CREATED action.

  =============== ===========
  HSDescAction    Description
  =============== ===========
  **REQUESTED**   uncached hidden service descriptor is being requested
  **UPLOAD**      descriptor is being uploaded with HSPOST
  **RECEIVED**    hidden service descriptor has been retrieved
  **UPLOADED**    descriptor was uploaded with HSPOST
  **IGNORE**      fetched descriptor was ignored because we already have its v0 descriptor
  **FAILED**      we were unable to retrieve the descriptor
  **CREATED**     hidden service descriptor was just created
  =============== ===========

.. data:: HSDescReason (enum)

  Reason for the hidden service descriptor to fail to be fetched.

  .. versionadded:: 1.3.0

  .. versionchanged:: 1.4.0
     Added the UPLOAD_REJECTED reason.

  .. versionchanged:: 1.6.0
     Added the QUERY_NO_HSDIR reason.

  .. versionchanged:: 1.8.0
     Added the QUERY_RATE_LIMITED reason.

  ======================= ===========
  HSDescReason            Description
  ======================= ===========
  **BAD_DESC**            descriptor was unparseable
  **QUERY_REJECTED**      hidden service directory refused to provide the descriptor
  **UPLOAD_REJECTED**     descriptor was rejected by the hidden service directory
  **NOT_FOUND**           descriptor with the given identifier wasn't found
  **QUERY_NO_HSDIR**      no hidden service directory was found
  **QUERY_RATE_LIMITED**  request was throttled
  **UNEXPECTED**          failure type is unknown
  ======================= ===========

.. data:: HSAuth (enum)

  Type of authentication being used for a HS_DESC event.

  .. versionadded:: 1.2.0

  ================= ===========
  HSAuth            Description
  ================= ===========
  **NO_AUTH**       no authentication
  **BASIC_AUTH**    general hidden service authentication
  **STEALTH_AUTH**  authentication method that hides service activity from unauthorized clients
  **UNKNOWN**       unrecognized method of authentication
  ================= ===========
    Nz1.8.2zDamian Johnsonzatagar@torproject.orgzhttps://stem.torproject.org/LGPLv3)1client
descriptorresponseutil
connectioncontrol	directoryexit_policyprereqprocesssocketversionControllerErrorProtocolErrorOperationFailedUnsatisfiableRequestCircuitExtensionFailedDescriptorUnavailableTimeoutInvalidRequestInvalidArgumentsSocketErrorSocketClosedDownloadFailedDownloadTimeoutRunlevelSignalFlag
CircStatusCircBuildFlagCircPurposeCircClosureReason	CircEventHiddenServiceStateHSAuthHSDescActionHSDescReasonRelayEndReasonStreamStatusStreamClosureReasonStreamSourceStreamPurposeORStatusORClosureReasonAuthDescriptorAction
StatusType	GuardTypeGuardStatusTimeoutSetTypezStem/%sz<Undefined_ >c                   0    \ rS rSrSrS rS rS rS rSr	g)	EndpointiB  z
Tor endpint that can be connected to.

.. versionadded:: 1.7.0

:var str address: ip address of the endpoint
:var int port: port of the endpoint
c                 |   [         R                  R                  R                  U5      (       d<  [         R                  R                  R	                  U5      (       d  [        SU-  5      e[         R                  R                  R                  U5      (       d  [        SU-  5      eXl        [        U5      U l	        g )Nz''%s' isn't a valid IPv4 or IPv6 addressz'%s' isn't a valid port)
stemr   r   is_valid_ipv4_addressis_valid_ipv6_address
ValueErroris_valid_portaddressintport)selfr=   r?   s      G/home/james-whalen/.local/lib/python3.13/site-packages/stem/__init__.py__init__Endpoint.__init__L  s    9955g>>tyyG[G[GqGqryGzGz@7JKKYY!!//5504788LD	DI    c                 B    [         R                  R                  U SSSS9$ )Nr=   r?   T)cache)r8   r   
_hash_attrr@   s    rA   __hash__Endpoint.__hash__U  s     99iFFrD   c                 ^    [        U[        5      (       a  [        U 5      [        U5      :H  $ S$ )NF)
isinstancer6   hashr@   others     rA   __eq__Endpoint.__eq__X  s&    (25((C(C4:e$NNrD   c                     X:X  + $ N rN   s     rA   __ne__Endpoint.__ne__[  s    rD   )r=   r?   N)
__name__
__module____qualname____firstlineno____doc__rB   rI   rP   rU   __static_attributes__rT   rD   rA   r6   r6   B  s    GOrD   r6   c                   6   ^  \ rS rSrSrSU 4S jjrS rSrU =r$ )ORPorti_  z
Tor relay's ORPort. The endpoint on which Tor accepts relay traffic.

:var list link_protocols: link protocol version we're willing to establish
c                 8   > [         [        U ]  X5        X0l        g rS   )superr^   rB   link_protocols)r@   r=   r?   ra   	__class__s       rA   rB   ORPort.__init__f  s    	&$ /(rD   c                 J    [         R                  R                  U S[        SS9$ )Nra   T)parentrF   )r8   r   rG   r6   rH   s    rA   rI   ORPort.__hash__j  s"    99&6SWXXrD   )ra   rS   )	rW   rX   rY   rZ   r[   rB   rI   r\   __classcell__rb   s   @rA   r^   r^   _  s    )Y YrD   r^   c                       \ rS rSrSrSrg)DirPortin  zb
Tor relay's DirPort. The endpoint on which Tor provides http access for
downloading descriptors.
rT   NrW   rX   rY   rZ   r[   r\   rT   rD   rA   rj   rj   n  s    rD   rj   c                       \ rS rSrSrSrg)r   iu  z/Base error for controller communication issues.rT   Nrk   rT   rD   rA   r   r   u  s    3rD   r   c                       \ rS rSrSrSrg)r   iy  z*Malformed content from the control socket.rT   Nrk   rT   rD   rA   r   r   y  s    .rD   r   c                   0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )r   i}  z
Base exception class for failed operations that return an error code

:var str code: error code returned by Tor
:var str message: error message returned by Tor or a human readable error
  message
c                 D   > [         [        U ]  U5        Xl        X l        g rS   )r`   r   rB   codemessage)r@   rp   rq   rb   s      rA   rB   OperationFailed.__init__  s    	/4)'2ILrD   )rp   rq   )NNrW   rX   rY   rZ   r[   rB   r\   rg   rh   s   @rA   r   r   }  s     rD   r   c                       \ rS rSrSrSrg)r   i  z<
Exception raised if Tor was unable to process our request.
rT   Nrk   rT   rD   rA   r   r         rD   r   c                   0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )r   i  z~
An attempt to create or extend a circuit failed.

:var stem.response.CircuitEvent circ: response notifying us of the failure
c                 4   > [         [        U ]  US9  X l        g N)rq   )r`   r   rB   circ)r@   rq   ry   rb   s      rA   rB   CircuitExtensionFailed.__init__  s    	
 $070CIrD   )ry   rS   rs   rh   s   @rA   r   r     s     rD   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )r   i  z
Tor was unable to provide a descriptor for the given relay.

.. versionchanged:: 1.7.0
   Subclassed under UnsatisfiableRequest rather than OperationFailed.
c                 (   > [         [        U ]  US9  g rx   )r`   r   rB   r@   rq   rb   s     rA   rB   DescriptorUnavailable.__init__  s    	
/'/BrD   rT   rs   rh   s   @rA   r   r     s    C CrD   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )r   i  zG
Timeout requested by the caller was reached.

.. versionadded:: 1.7.0
c                 (   > [         [        U ]  US9  g rx   )r`   r   rB   r}   s     rA   rB   Timeout.__init__  s    	'4!G!4rD   rT   rs   rh   s   @rA   r   r     s    5 5rD   r   c                       \ rS rSrSrSrg)r   i  z=
Exception raised when the request was invalid or malformed.
rT   Nrk   rT   rD   rA   r   r     ru   rD   r   c                   0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )r   i  z
Exception class for requests which had invalid arguments.

:var str code: error code returned by Tor
:var str message: error message returned by Tor or a human readable error
  message
:var list arguments: a list of arguments which were invalid
c                 8   > [         [        U ]  X5        X0l        g rS   )r`   r   rB   	arguments)r@   rp   rq   r   rb   s       rA   rB   InvalidArguments.__init__  s    	
D*49NrD   )r   )NNNrs   rh   s   @rA   r   r     s     rD   r   c                       \ rS rSrSrSrg)r   i  z8Error arose while communicating with the control socket.rT   Nrk   rT   rD   rA   r   r         <rD   r   c                       \ rS rSrSrSrg)r   i  z8Control socket was closed before completing the message.rT   Nrk   rT   rD   rA   r   r     r   rD   r   c                   0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )r   i  a!  
Inability to download a resource. Python's urllib module raises
a wide variety of undocumented exceptions (urllib2.URLError,
socket.timeout, and others).

This wraps lower level failures in a common exception type that
retains their exception and `stacktrace
<https://docs.python.org/3/library/traceback.html>`_.

.. versionadded:: 1.8.0

:var str url: url we failed to download from
:var Exception error: original urllib exception
:var traceback stacktrace: original stacktrace
:var str stacktrace_str: string representation of the stacktrace
c                   > Uc  [        U5      n[        [        USS 5      SS 5      [        USS 5      [        USS 5      4nU H%  nU(       d  M  [        U[         5      (       d  M#  Un  O   SU< S[        U5      R                  < SU< 3n[
        [        U ]  U5        Xl        X l	        X0l
        SR                  [        R                  " U5      5      U l        g )Nreasonstrerrorrq   zFailed to download from z (z):  )strgetattrrL   typerW   r`   r   rB   urlerror
stacktracejoin	traceback	format_tbstacktrace_str)	r@   r   r   r   rq   r   all_str_reprstr_reprrb   s	           rA   rB   DownloadFailed.__init__  s     5zf 	x.
DAx&y$'l #(8
8S11&
 #
 :=d5k>R>RTZ[g	.$(1HJ O'')"5"5j"ABDrD   )r   r   r   r   rS   rs   rh   s   @rA   r   r     s    "C CrD   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )r   i  zK
Timeout reached while downloading this resource.

.. versionadded:: 1.8.0
c                 :   > SX4-  n[         [        U ]  XX55        g )Nz8Failed to download from %s: %0.1f second timeout reached)r`   r   rB   )r@   r   r   r   timeoutrq   rb   s         rA   rB   DownloadTimeout.__init__	  s     HC>YG	/4)#jJrD   rT   rs   rh   s   @rA   r   r     s    K KrD   r   DEBUGINFONOTICEWARNERR)	AUTHORITY	Authority)BADEXITBadExit)BADDIRECTORYBadDirectory)EXITExit)FASTFast)GUARDGuard)HSDIRHSDir)NAMEDNamed)NO_ED_CONSENSUSNoEdConsensus)RUNNINGRunning)STABLEStable)
STALE_DESC	StaleDesc)UNNAMEDUnnamed)V2DIRV2Dir)V3DIRV3Dir)VALIDValidRELOADHUPSHUTDOWNINTDUMPUSR1USR2HALTTERMNEWNYMCLEARDNSCACHE	HEARTBEATACTIVEDORMANTLAUNCHEDBUILT
GUARD_WAITEXTENDEDFAILEDCLOSEDONEHOP_TUNNELIS_INTERNALNEED_CAPACITYNEED_UPTIMEGENERALHS_CLIENT_INTROHS_CLIENT_RENDHS_SERVICE_INTROHS_SERVICE_RENDTESTING
CONTROLLERMEASURE_TIMEOUTNONETORPROTOCOLINTERNAL	REQUESTEDHIBERNATINGRESOURCELIMITCONNECTFAILEDOR_IDENTITYOR_CONN_CLOSEDFINISHEDTIMEOUT	DESTROYEDNOPATHNOSUCHSERVICEMEASUREMENT_EXPIREDPURPOSE_CHANGEDCANNIBALIZEDHSCI_CONNECTINGHSCI_INTRO_SENT	HSCI_DONEHSCR_CONNECTINGHSCR_ESTABLISHED_IDLEHSCR_ESTABLISHED_WAITINGHSCR_JOINEDHSSI_CONNECTINGHSSI_ESTABLISHEDHSSR_CONNECTINGHSSR_JOINEDMISCRESOLVEFAILEDCONNECTREFUSED
EXITPOLICYDESTROYDONENOROUTE	CONNRESETNOTDIRECTORYNEW
NEWRESOLVEREMAPSENTCONNECTSENTRESOLVE	SUCCEEDEDDETACHEDENDPRIVATE_ADDRCACHEr   	DIR_FETCH
DIR_UPLOADDNS_REQUESTDIRPORT_TESTUSER	CONNECTEDIDENTITYCONNECTRESETIOERROR
PT_MISSINGACCEPTEDDROPPEDREJECTEDCLIENTSERVERENTRYUPDOWNBADGOODCOMPUTEDRESET	SUSPENDEDDISCARDRESUMEORDIRGLOBALRELAYORCONNUPLOADRECEIVEDUPLOADEDIGNORECREATEDBAD_DESCQUERY_REJECTEDUPLOAD_REJECTED	NOT_FOUNDQUERY_NO_HSDIR
UNEXPECTEDNO_AUTH
BASIC_AUTHSTEALTH_AUTHUNKNOWN)@r[   r   	stem.utilr8   stem.util.enum__version__
__author____contact____url____license____all__
USER_AGENT	UNDEFINEDobjectr6   r^   rj   	Exceptionr   r   r   r   r   r   r   r   r   r   r   IOErrorr   r   r   enumUppercaseEnumr   Enumr   r   r    r!   r"   r#   r$   r%   r)   r*   keysr+   r,   r-   r.   r/   r0   r1   r2   r3   r4   ConnectionTypeTokenBucketr'   r(   r&   stem.util.connectionrT   rD   rA   <module>rU     s  sj   
%
(2j k) 	v :YX Yh 4i 4/O /o ? 	1 		C0 	C5" 5_ ~ =/ ==; =-CW -C`	Kn 	K 99>>''	
 yy~~"&!& 
	%	%
	


$ YY^^))	


 		,,	 iinn**	 IINN00
 $ IINN((	
 YY^^11  --" yy~~++	


 iinn22^5H5H5JN 6  
 yy~~++	
 		,, 99>>''

 )).... yy~~33  YY^^))


 IINN((		 iinn** --	
 -- iinn**
	
 yy~~++


 yy~~++ 
	%	%	
 rD   