ó
    Ö›‘hØ?  ã                  óî   • S r SSKJr  SSKJr  SSKJr  SSKJrJrJ	r	J
r
JrJr  SSKJr  SSKJr  SS	KJrJr  SS
KJrJr   " S S\5      r " S S5      r " S S5      r " S S5      r\" 5       rSS jrg)z
Logger class.
é    )Úannotations)Útime)ÚTracebackType)ÚAnyÚCallableÚContextManagerÚOptionalÚProtocolÚcast)Úcurrentframe)ÚFailureé   )ÚILogObserverÚLogTrace)ÚInvalidLogLevelErrorÚLogLevelc                  óT   • \ rS rSrSr\SS j5       r\S	S j5       r\SS j5       rSr	g)
Ú	Operationé   z�
An L{Operation} represents the success (or lack thereof) of code performed
within the body of the L{Logger.failureHandler} context manager.
c                ó   • g)z¥
Did the operation succeed?  C{True} iff the code completed without
raising an exception; C{False} while the code is running and C{False}
if it raises an exception.
N© ©Úselfs    ÚZC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/logger/_logger.pyÚ	succeededÚOperation.succeeded   ó   � ó    c                ó   • g)zR
Did the operation raise an exception?  If so, this L{Failure} is that
exception.
Nr   r   s    r   ÚfailureÚOperation.failure#   r   r   c                ó   • g)z“
Did the operation fail?  C{True} iff the code raised an exception;
C{False} while the code is running and C{False} if it completed without
error.
Nr   r   s    r   ÚfailedÚOperation.failed*   r   r   r   N©ÚreturnÚbool)r&   úFailure | None)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úpropertyr   r    r#   Ú__static_attributes__r   r   r   r   r      sC   † ñð
 óó ðð óó ðð óó ór   r   c                  ót   • \ rS rSr% SrS\S'   SrS\S'   SS jr\SS	 j5       r	SS
 jr
        SS jrSrg)Ú_FailCtxMgré3   Fr'   r   Nr(   r    c                ó   • Xl         g ©N©Ú_fail©r   Úfails     r   Ú__init__Ú_FailCtxMgr.__init__7   ó   € Ø�
r   c                ó   • U R                   S L$ r4   ©r    r   s    r   r#   Ú_FailCtxMgr.failed:   s   € à�|‰| 4Ð'Ð'r   c                ó   • U $ r4   r   r   s    r   Ú	__enter__Ú_FailCtxMgr.__enter__>   s   € Øˆr   c               ó\   • Ub"  [        5       nX@l        U R                  U5        gSU l        g©NT)r   r    r6   r   ©r   Úexc_typeÚ	exc_valueÚ	tracebackr    s        r   Ú__exit__Ú_FailCtxMgr.__exit__A   s3   € ð ÑÜ“iˆGØ"ŒLØ�J‰J�wÔð ð "ˆDŒNØr   )r6   r    r   ©r8   zCallable[[Failure], None]r&   ÚNoner%   )r&   r   ©rE   ztype[BaseException] | NonerF   zBaseException | NonerG   zTracebackType | Noner&   r'   )r)   r*   r+   r,   r   Ú__annotations__r    r9   r.   r#   r@   rH   r/   r   r   r   r1   r1   3   s_   ‡ Ø€IˆtÓØ"€Gˆ^Ó"ôð ó(ó ð(ôðà,ðð (ðð (ð	ð 
÷r   r1   c                  óB   • \ rS rSrSS jrSS jr        S	S jrSrg)
Ú_FastFailCtxMgréQ   c                ó   • Xl         g r4   r5   r7   s     r   r9   Ú_FastFailCtxMgr.__init__R   r;   r   c                ó   • g r4   r   r   s    r   r@   Ú_FastFailCtxMgr.__enter__U   s   € Ør   c               óL   • Ub!  [        5       nX@l        U R                  U5        grC   )r   r    r6   rD   s        r   rH   Ú_FastFailCtxMgr.__exit__X   s%   € ð ÑÜ“iˆGØ"ŒLØ�J‰J�wÔØr   )r6   r    NrJ   )r&   rK   rL   )r)   r*   r+   r,   r9   r@   rH   r/   r   r   r   rO   rO   Q   s7   † ôôðà,ðð (ðð (ð	ð 
÷r   rO   c                  ób  • \ rS rSrSr\SS j5       r   S       SS jjrSSS jjrSS jr	 S       SS jjr
S\R                  4         SS	 jjrSSS
 jjrSSS jjrSSS jjrSSS jjrSSS jjr\R                  4       SS jjr\R                  4     SS jjrSrg)ÚLoggeréf   ab  
A L{Logger} emits log messages to an observer.  You should instantiate it
as a class or module attribute, as documented in L{this module's
documentation <twisted.logger>}.

@ivar namespace: the namespace for this logger
@ivar source: The object which is emitting events via this logger
@ivar observer: The observer that this logger will send events to.
c                 óp   •  [        [        [        S5      R                  S   5      $ ! [         a     gf = f)z{
Derive a namespace from the module containing the caller's caller.

@return: the fully qualified python name of a module.
é   r)   z	<unknown>)r   Ústrr   Ú	f_globalsÚKeyErrorr   r   r   Ú_namespaceFromCallingContextÚ#Logger._namespaceFromCallingContextq   s5   € ð	Üœœ\¨!›_×6Ñ6°zÑBÓCÐCøÜó 	Ùð	ús   ‚%( ¨
5´5Nc                ón   • Uc  U R                  5       nXl        X l        Uc  SSKJn  X@l        gX0l        g)aë  
@param namespace: The namespace for this logger.  Uses a dotted
    notation, as used by python modules.  If not L{None}, then the name
    of the module of the caller is used.
@param source: The object which is emitting events via this
    logger; this is automatically set on instances of a class
    if this L{Logger} is an attribute of that class.
@param observer: The observer that this logger will send events to.
    If L{None}, use the L{global log publisher <globalLogPublisher>}.
Nr   )ÚglobalLogPublisher)r_   Ú	namespaceÚsourceÚ_globalrb   Úobserver)r   rc   rd   rf   rb   s        r   r9   ÚLogger.__init__}   s5   € ð  ÑØ×9Ñ9Ó;ˆIà"ŒØŒàÑÝ3à*<�Mà$�Mr   c                óœ   • Uc   eUc  UnOUnU R                  SR                  UR                  UR                  /5      UU R                  S9$ )a  
When used as a descriptor, i.e.::

    # File: athing.py
    class Something:
        log = Logger()
        def hello(self):
            self.log.info("Hello")

a L{Logger}'s namespace will be set to the name of the class it is
declared on.  In the above example, the namespace would be
C{athing.Something}.

Additionally, its source will be set to the actual object referring to
the L{Logger}.  In the above example, C{Something.log.source} would be
C{Something}, and C{Something().log.source} would be an instance of
C{Something}.
Ú.)rf   )Ú	__class__Újoinr*   r)   rf   )r   ÚinstanceÚownerrd   s       r   Ú__get__ÚLogger.__get__š   s[   € ð& Ñ Ð Ð àÑØ‰FàˆFà�~‰~Ø�H‰H�e×&Ñ&¨¯©Ð7Ó8ØØ—]‘]ð ð 
ð 	
r   c                óR   • SU R                   R                   SU R                  < S3$ )NÚ<Ú Ú>)rj   r)   rc   r   s    r   Ú__repr__ÚLogger.__repr__º   s'   € Ø�4—>‘>×*Ñ*Ð+¨1¨T¯^©^Ñ,>¸aÐ@Ð@r   c           	     ól  • U[         R                  " 5       ;  a%  U R                  S[        [	        U5      5      UU S9  gUnUR                  U UU R                  U R                  U[        5       S9  SU;   a-  [        [        US   5      R                  X R                  45        U R                  U5        g)aÍ  
Emit a log event to all log observers at the given level.

@param level: a L{LogLevel}
@param format: a message format using new-style (PEP 3101)
    formatting.  The logging event (which is a L{dict}) is
    used to render this format string.
@param kwargs: additional key/value pairs to include in the event.
    Note that values which are later mutated may result in
    non-deterministic behavior from observers that schedule work for
    later execution.
z:Got invalid log level {invalidLevel!r} in {logger}.emit().)ÚinvalidLevelÚloggerN)Ú
log_loggerÚ	log_levelÚlog_namespaceÚ
log_sourceÚ
log_formatÚlog_timeÚ	log_trace)r   Úiterconstantsr    r   r   Úupdaterc   rd   r   r   r   Úappendrf   )r   ÚlevelÚformatÚkwargsÚevents        r   ÚemitÚLogger.emit½   s«   € ð œ×.Ò.Ó0Ó0Ø�L‰LØLÜÔ,¨UÓ3Ó4Ø"Øð	 ñ ð àˆØ�‰ØØØŸ.™.Ø—{‘{ØÜ“Vð 	ñ 	
ð ˜%ÓÜ”˜5 Ñ-Ó.×5Ñ5°t¿]¹]Ð6KÔLà�‰�eÕr   c                óH   • Uc
  [        5       nU R                  " X14SU0UD6  g)au  
Log a failure and emit a traceback.

For example::

    try:
        frob(knob)
    except Exception:
        log.failure("While frobbing {knob}", knob=knob)

or::

    d = deferredFrob(knob)
    d.addErrback(lambda f: log.failure("While frobbing {knob}",
                                       f, knob=knob))

This method is meant to capture unexpected exceptions in code; an
exception that is caught and handled somehow should be logged, if
appropriate, via L{Logger.error} instead.  If some unknown exception
occurs and your code doesn't know how to handle it, as in the above
example, then this method provides a means to describe the failure.
This is done at L{LogLevel.critical} by default, since no corrective
guidance can be offered to an user/administrator, and the impact of the
condition is unknown.

@param format: a message format using new-style (PEP 3101) formatting.
    The logging event (which is a L{dict}) is used to render this
    format string.

@param failure: a L{Failure} to log.  If L{None}, a L{Failure} is
    created from the exception in flight.

@param level: a L{LogLevel} to use.

@param kwargs: additional key/value pairs to include in the event.
    Note that values which are later mutated may result in
    non-deterministic behavior from observers that schedule work for
    later execution.

@see: L{Logger.failureHandler}

@see: L{Logger.failuresHandled}
NÚlog_failure)r   r‡   )r   r„   r    rƒ   r…   s        r   r    ÚLogger.failureä   s'   € ðd ‰?Ü“iˆGà�	Š	�%Ñ?¨WÐ?¸Ó?r   c                óH   • U R                   " [        R                  U40 UD6  g)a¨  
Emit a log event at log level L{LogLevel.debug}.

@param format: a message format using new-style (PEP 3101) formatting.
    The logging event (which is a L{dict}) is used to render this
    format string.

@param kwargs: additional key/value pairs to include in the event.
    Note that values which are later mutated may result in
    non-deterministic behavior from observers that schedule work for
    later execution.
N)r‡   r   Údebug©r   r„   r…   s      r   r�   ÚLogger.debug  ó   € ð 	�	Š	”(—.‘. &Ñ3¨FÓ3r   c                óH   • U R                   " [        R                  U40 UD6  g)a§  
Emit a log event at log level L{LogLevel.info}.

@param format: a message format using new-style (PEP 3101) formatting.
    The logging event (which is a L{dict}) is used to render this
    format string.

@param kwargs: additional key/value pairs to include in the event.
    Note that values which are later mutated may result in
    non-deterministic behavior from observers that schedule work for
    later execution.
N)r‡   r   ÚinforŽ   s      r   r’   ÚLogger.info*  ó   € ð 	�	Š	”(—-‘- Ñ2¨6Ó2r   c                óH   • U R                   " [        R                  U40 UD6  g)a§  
Emit a log event at log level L{LogLevel.warn}.

@param format: a message format using new-style (PEP 3101) formatting.
    The logging event (which is a L{dict}) is used to render this
    format string.

@param kwargs: additional key/value pairs to include in the event.
    Note that values which are later mutated may result in
    non-deterministic behavior from observers that schedule work for
    later execution.
N)r‡   r   ÚwarnrŽ   s      r   r–   ÚLogger.warn9  r”   r   c                óH   • U R                   " [        R                  U40 UD6  g)a¨  
Emit a log event at log level L{LogLevel.error}.

@param format: a message format using new-style (PEP 3101) formatting.
    The logging event (which is a L{dict}) is used to render this
    format string.

@param kwargs: additional key/value pairs to include in the event.
    Note that values which are later mutated may result in
    non-deterministic behavior from observers that schedule work for
    later execution.
N)r‡   r   ÚerrorrŽ   s      r   r™   ÚLogger.errorH  r�   r   c                óH   • U R                   " [        R                  U40 UD6  g)a«  
Emit a log event at log level L{LogLevel.critical}.

@param format: a message format using new-style (PEP 3101) formatting.
    The logging event (which is a L{dict}) is used to render this
    format string.

@param kwargs: additional key/value pairs to include in the event.
    Note that values which are later mutated may result in
    non-deterministic behavior from observers that schedule work for
    later execution.
N)r‡   r   ÚcriticalrŽ   s      r   rœ   ÚLogger.criticalW  s   € ð 	�	Š	”(×#Ñ# VÑ6¨vÓ6r   c                ó.   ^ ^^^• [        UUUU 4S j5      $ )a?  
Run some application code, logging a failure and emitting a traceback
in the event that any of it fails, but continuing on.  For example::

    log = Logger(...)

    def frameworkCode() -> None:
        with log.failuresHandled("While frobbing {knob}:", knob=knob) as op:
            frob(knob)
        if op.succeeded:
            log.info("frobbed {knob} successfully", knob=knob)

This method is meant to capture unexpected exceptions from application
code; an exception that is caught and handled somehow should be logged,
if appropriate, via L{Logger.error} instead.  If some unknown exception
occurs and your code doesn't know how to handle it, as in the above
example, then this method provides a means to describe the failure.
This is done at L{LogLevel.critical} by default, since no corrective
guidance can be offered to an user/administrator, and the impact of the
condition is unknown.

@param format: a message format using new-style (PEP 3101) formatting.
    The logging event (which is a L{dict}) is used to render this
    format string.

@param level: a L{LogLevel} to use.

@param kwargs: additional key/value pairs to include in the event, if
    it is emitted.  Note that values which are later mutated may result
    in non-deterministic behavior from observers that schedule work for
    later execution.

@see: L{Logger.failure}
@see: L{Logger.failureHandler}

@return: A context manager which yields an L{Operation} which will have
    either its C{succeeded} or C{failed} attribute set to C{True} upon
    completion of the code within the code within the C{with} block.
c                ó.   >• TR                   " TU T40 TD6$ r4   r=   )Úfr„   r…   rƒ   r   s    €€€€r   Ú<lambda>Ú(Logger.failuresHandled.<locals>.<lambda>�  s   ø€  T§\¢\°&¸!¸UÑ%MÀfÒ%Mr   )r1   )r   r„   rƒ   r…   s   ````r   ÚfailuresHandledÚLogger.failuresHandledf  s   û€ ôT ×MÓNÐNr   c                ó*   ^ ^^• [        UU U4S j5      $ )aÂ  
For performance-sensitive frameworks that needs to handle potential
failures from frequently-called application code, and do not need to
include detailed structured information about the failure nor inspect
the result of the operation, this method returns a context manager that
will log exceptions and continue, that can be shared across multiple
invocations.  It should be instantiated at module scope to avoid
additional object creations.

For example::

    log = Logger(...)
    ignoringFrobErrors = log.failureHandler("while frobbing:")

    def hotLoop() -> None:
        with ignoringFrobErrors:
            frob()

This method is meant to capture unexpected exceptions from application
code; an exception that is caught and handled somehow should be logged,
if appropriate, via L{Logger.error} instead.  If some unknown exception
occurs and your code doesn't know how to handle it, as in the above
example, then this method provides a means to describe the failure in
nerd-speak.  This is done at L{LogLevel.critical} by default, since no
corrective guidance can be offered to an user/administrator, and the
impact of the condition is unknown.

@param format: a message format using new-style (PEP 3101) formatting.
    The logging event (which is a L{dict}) is used to render this
    format string.

@param level: a L{LogLevel} to use.

@see: L{Logger.failure}

@return: A context manager which does not return a value, but will
    always exit from exceptions.
c                ó*   >• TR                  TU T5      $ r4   r=   )r    rƒ   r   ÚstaticMessages    €€€r   r¡   Ú'Logger.failureHandler.<locals>.<lambda>½  s   ø€ ¨¯©°mÀQÈÔ)Nr   )rO   )r   r§   rƒ   s   ```r   ÚfailureHandlerÚLogger.failureHandler’  s   ú€ ôV ÖNÓOÐOr   )rc   rf   rd   )r&   r\   )NNN)rc   úOptional[str]rd   zOptional[object]rf   zOptional['ILogObserver']r&   rK   r4   )rl   Úobjectrm   zOptional[type]r&   z'Logger')rƒ   r   r„   r«   r…   r¬   r&   rK   )
r„   r\   r    zOptional[Failure]rƒ   r   r…   r¬   r&   rK   )r„   r«   r…   r¬   r&   rK   )r„   r\   rƒ   r   r…   r¬   r&   zContextManager[Operation])r§   r\   rƒ   r   r&   zContextManager[None])r)   r*   r+   r,   r-   Ústaticmethodr_   r9   rn   rt   r‡   r   rœ   r    r�   r’   r–   r™   r£   r©   r/   r   r   r   rX   rX   f   sW  † ñð ó	ó ð	ð $(Ø#'Ø-1ð	%à ð%ð !ð%ð +ð	%ð
 
õ%ö:
ô@Að 8<ð%Øð%Ø'4ð%ØGMð%à	õ%ðT &*Ø"×+Ñ+ð	5@àð5@ð #ð5@ð ð	5@ð
 ð5@ð 
õ5@ön4ö3ö3ö4ö7ð  .6×->Ñ->ð*OØð*OØ"*ð*OØJPð*Oà	"õ*Oð^ #×+Ñ+ð+Pàð+Pð ð+Pð 
÷	+Pð +Pr   rX   c                ó@   • [         R                  X R                  5      $ )z7
Get a L{Logger} instance attached to the given class.
)Ú_logrn   rj   )Úobjs    r   Ú
_loggerForr±   Ã  s   € ô �<‰<˜Ÿ]™]Ó+Ð+r   N)r°   r¬   r&   rX   )r-   Ú
__future__r   r   Útypesr   Útypingr   r   r   r	   r
   r   Útwisted.python.compatr   Útwisted.python.failurer   Ú_interfacesr   r   Ú_levelsr   r   r   r1   rO   rX   r¯   r±   r   r   r   Ú<module>r¹      sd   ðñ
õ #å Ý ß J× Jå .Ý *ß /ß 3ô�ô ÷<ñ ÷<ñ ÷*WPñ WPñt
 ƒx€õ,r   