+
    f7iM  c                   s   ^ RI t ^ RIt^ RIt^ RIHt ^ RIHtHt ^ RIt^ RIH	t	 ]P                  tRRRRR	R/t ! R
 R]P                  4      tR tRR lt ! R R]4      t ! R R]P&                  4      t ! R R]P*                  4      t ! R R]4      t]3R lt]3R lt]R8X  d>   ^ RIt] P:                  ! ]P<                  ! ]P>                  R7      P@                  4       R# R# )    Nwraps)MappingCallable)PercentStyle*z%(levelname)s: %(message)sZINFOz%(message)sDEBUGc                   sF   a a ] tR t^t oRtRV 3R lltV 3R ltRtVtV ;t	# )LevelFormattera  Log formatter with level-specific formatting.

Formatter class which optionally takes a dict of logging levels to
format strings, allowing to customise the log records appearance for
specific levels.


Attributes:
        fmt: A dictionary mapping logging levels to format strings.
                The ``*`` key identifies the default format string.
        datefmt: As per py:class:`logging.Formatter`
        style: As per py:class:`logging.Formatter`

>>> import sys
>>> handler = logging.StreamHandler(sys.stdout)
>>> formatter = LevelFormatter(
...     fmt={
...         '*':     '[%(levelname)s] %(message)s',
...         'DEBUG': '%(name)s [%(levelname)s] %(message)s',
...         'INFO':  '%(message)s',
...     })
>>> handler.setFormatter(formatter)
>>> log = logging.getLogger('test')
>>> log.setLevel(logging.DEBUG)
>>> log.addHandler(handler)
>>> log.debug('this uses a custom format string')
test [DEBUG] this uses a custom format string
>>> log.info('this also uses a custom format string')
this also uses a custom format string
>>> log.warning("this one uses the default format string")
[WARNING] this one uses the default format string
c                s  < VR 8w  d   \        R4      hVf   \        p\        V\        4      '       d   Tp/ pMF\        V\        4      '       d   \        V4      pVP                  RR4      pM\        RV,          4      h\        \        V `+  WB4       V P                  V n        / V n        VP                  4        F)  w  ra\        P                   ! V4      pWP                  V&   K+  	  R# )%z:only '%' percent style is supported in both python 2 and 3Nr   z&fmt must be a str or a dict of str: %r)
ValueErrorDEFAULT_FORMATS
isinstancestrr   ZdictpopZ	TypeErrorsuperr   __init___fmtdefault_formatcustom_formatsZitemsloggingZ_checkLevel)selffmtdatefmtstyler   r   level	__class__s   &&&&   B/usr/lib64/python3.14/site-packages/fontTools/misc/loggingTools.pyr   ZLevelFormatter.__init__8   s    C<L  ;!Cc3 NNW%%!#YN+//T:NDsJKKnd,^E"ii (..0JE''.E),& 1    c                s  < V P                   '       dd   V P                   P                  VP                  V P                  4      pV P                  V8w  d#   W n        \
        '       d   \        V4      V n        \        \        V `'  V4      # N)
r   getZlevelnor   r   r   _styler   r   format)r   recordr   r   s   && r   r    ZLevelFormatter.formatN   se    %%))&..$:M:MNCyyC	<".s"3DK^T1&99r   )r   r   r   r   )NNr	   )
__name__
__module____qualname____firstlineno____doc__r   r    __static_attributes____classdictcell____classcell__r   __classdict__   @@r   r   r      s     B-,: :r   r   c                 s   V P                  RR4      pVf   RV 9   d   RV 9   d   \        R4      hMRV 9   g   RV 9   d   \        R4      hVfo   V P                  RR4      pV P                  RR4      pV'       d   \        P                  ! W#4      pM(V P                  RR4      p\        P                  ! V4      pV.pV P                  R	R
4      pV'       d   \        V\        4      '       d   \        P                  ! V4      p\        VP                  R7       V P                  RR4      pV P                  RR4      pV P                  RR4      p	\        WxV	4      p
V P                  R. 4      pV F_  pVP                  f   VP                  V
4       VP                  '       g   V F  pVP                  V4       K  	  VP                  V4       Ka  	  VP                  R8w  d   V P                  RR4      Vn        V P                  RR4      pVe   VP#                  V4       V '       d2   RP%                  V P'                  4       4      p\        RV,          4      hR# )a
  A more sophisticated logging system configuation manager.

This is more or less the same as :py:func:`logging.basicConfig`,
with some additional options and defaults.

The default behaviour is to create a ``StreamHandler`` which writes to
sys.stderr, set a formatter using the ``DEFAULT_FORMATS`` strings, and add
the handler to the top-level library logger ("fontTools").

A number of optional keyword arguments may be specified, which can alter
the default behaviour.

Args:

        logger: Specifies the logger name or a Logger instance to be
                configured. (Defaults to "fontTools" logger). Unlike ``basicConfig``,
                this function can be called multiple times to reconfigure a logger.
                If the logger or any of its children already exists before the call is
                made, they will be reset before the new configuration is applied.
        filename: Specifies that a ``FileHandler`` be created, using the
                specified filename, rather than a ``StreamHandler``.
        filemode: Specifies the mode to open the file, if filename is
                specified. (If filemode is unspecified, it defaults to ``a``).
        format: Use the specified format string for the handler. This
                argument also accepts a dictionary of format strings keyed by
                level name, to allow customising the records appearance for
                specific levels. The special ``'*'`` key is for 'any other' level.
        datefmt: Use the specified date/time format.
        level: Set the logger level to the specified level.
        stream: Use the specified stream to initialize the StreamHandler. Note
                that this argument is incompatible with ``filename`` - if both
                are present, ``stream`` is ignored.
        handlers: If specified, this should be an iterable of already created
                handlers, which will be added to the logger. Any handler in the
                list which does not have a formatter assigned will be assigned the
                formatter created in this function.
        filters: If specified, this should be an iterable of already created
                filters. If the ``handlers`` do not already have filters assigned,
                these filters will be added to them.
        propagate: All loggers have a ``propagate`` attribute which determines
                whether to continue searching for handlers up the logging hierarchy.
                If not provided, the "propagate" attribute will be set to ``False``.
handlersNstreamfilenamez8'stream' and 'filename' should not be specified togetherzG'stream' or 'filename' should not be specified together with 'handlers'ZfilemodeZaloggerZ	fontTools)parentr    r   r   r	   filtersroot	propagateFr   z, zUnrecognised argument(s): %s)r   r
   r   ZFileHandlerZStreamHandlerr   r   	getLogger_resetExistingLoggersnamer   Z	formatterZsetFormatterr2   Z	addFilter
addHandlerr4   setLeveljoinkeys)kwargsr-   r/   Zmodehr.   r0   ZfsZdfsr   r   r2   fr   r;   s   ,              r   configLoggerr?   Y   s   Z zz*d+Hv*"6M  vv!55  ::j$/zz*c*##H3AZZ$/F%%f-A3ZZ+.FZ,,""6*-	Hd	#B
**Y
%CJJw$E
%
(CjjB'G;;NN3yyyA !  {{f!::k59JJw%Eyy'7$>?? r   c                s\   \         P                  p\        VP                  P                  P                  4       4      pV R8X  d   V .V,           pMW9  d   R# W9   ds   V .pVP                  V 4      ^,           pV R,           p\        V4      p\        V4      pWG8  d3   W$,          RV V8X  d   VP                  W$,          4       V^,          pK8  X F  pVR8X  d   VP                  \         P                  4       VP                  R,           F  p	VP                  V	4       K  	  VP                  R,           F  p
VP                  V
4       K  	  RVn        K  VP                  P                  V,          p\         P                   Vn        . Vn        . Vn        RVn        RVn        K  	  R# )zReset the logger named 'parent' and all its children to their initial
state, if they already exist in the current configuration.
r3   N.:NNNFT)r   r3   ZsortedZmanagerZ
loggerDictr;   Zindexlenappendr9   ZWARNINGr-   removeHandlerr2   ZremoveFiltersdisabledZNOTSETr   r4   )r1   r3   ZexistingZloggers_to_resetZiZprefixedZpflenZnum_existingr7   r=   r>   r0   s   &           r   r6   r6      s^    <<Ddll--2245H"8h.				"8NN6"Q&C<H8}{6E"h. ''4FA 6>MM'//*]]1%%""1% &\\!__""1% %!DM\\,,T2F">>FL FOFN#F#FO !r   c                   s   a  ] tR t^t o Rt]! ]P                  4      tRt	Rt
RR ltRR ltR tR tR	 tR
 tR tRR ltR tR tR tV 3R ltRtV tR# )Timera  Keeps track of overall time and split/lap times.

>>> import time
>>> timer = Timer()
>>> time.sleep(0.01)
>>> print("First lap:", timer.split())
First lap: ...
>>> time.sleep(0.02)
>>> print("Second lap:", timer.split())
Second lap: ...
>>> print("Overall time:", timer.time())
Overall time: ...

Can be used as a context manager inside with-statements.

>>> with Timer() as t:
...     time.sleep(0.01)
>>> print("%0.3f seconds" % t.elapsed)
0... seconds

If initialised with a logger, it can log the elapsed time automatically
upon exiting the with-statement.

>>> import logging
>>> log = logging.getLogger("my-fancy-timer-logger")
>>> configLogger(logger=log, level="DEBUG", format="%(message)s", stream=sys.stdout)
>>> with Timer(log, 'do something'):
...     time.sleep(0.01)
Took ... to do something

The same Timer instance, holding a reference to a logger, can be reused
in multiple with-statements, optionally with different messages or levels.

>>> timer = Timer(log)
>>> with timer():
...     time.sleep(0.01)
elapsed time: ...s
>>> with timer('redo it', level=logging.INFO):
...     time.sleep(0.02)
Took ... to redo it

It can also be used as a function decorator to log the time elapsed to run
the decorated function.

>>> @timer()
... def test1():
...    time.sleep(0.01)
>>> @timer('run test 2', level=logging.INFO)
... def test2():
...    time.sleep(0.02)
>>> test1()
Took ... to run 'test1'
>>> test2()
Took ... to run test 2
zelapsed time: %(time).3fszTook %(time).3fs to %(msg)sNc                s    V P                  V4       Vf7   R F0  p\        4       P                  V4      f   K   \        RV,          4      h	  Wn        Ve   TM\
        V n        W n        R # )Nz*'%s' can't be specified without a 'logger')msgr   )resetZlocalsr   r
   r0   
TIME_LEVELr   rF   )r   r0   rF   r   startZargs   &&&&& r   r   ZTimer.__init__#  sZ    

5>'8<<$0$%QTW%WXX ( #/UZ
r   c                sv    Vf   V P                  4       V n        MWn        V P                  V n        RV n        R# )z0Reset timer to 'start_time' or the current time.N        )_timerI   lastelapsed)r   rI      &&r   rG   ZTimer.reset-  s+    =DJJJJ	r   c                sD    V P                  4       V P                  ,
          # )z=Return the overall time (in seconds) since the timer started.)rK   rI   r      &r   timeZ
Timer.time6  s    zz|djj((r   c                st    V P                  4       pWP                  ,
          V n        Wn        V P                  # )z=Split and return the lap time (in seconds) in between splits.rK   rL   rM   )r   Zcurrent   & r   splitZTimer.split:  s*    **,*	||r   c                s    V'       g   V P                   pVP                  R4      ^ 8  d   V P                  RVRV/,          pV#  VRV/,          pV#   \        \        3 d     T# i ; i)zFormat 'time' value in 'msg' and return formatted string.
If 'msg' contains a '%(time)' format string, try to use that.
Otherwise, use the predefined 'default_format'.
If 'msg' is empty or None, fall back to 'default_msg'.
z%(time)rF   rQ   )default_msgfindr   ZKeyErrorr
   )r   rF   rQ      &&&r   
formatTimeZTimer.formatTimeA  s{     ""C88I"%%VT(BBC 
	VTN* 
 j) 
s   A A'&A'c                s>    V P                  4       V n        RV n        V # )zStart a new laprJ   rR   rO   rP   r   	__enter__ZTimer.__enter__R  s    JJL	r   c                s    V P                  4       pV P                  e	   V'       d   R# V P                  V P                  V4      pRV P                  RV/pV P                  P	                  V P
                  WV4       R# )z|End the current lap. If timer has a logger, log the time elapsed,
using the format string in self.msg (or the default one).
NrF   rQ   )rT   r0   rX   rF   logr   )r   Zexc_typeZ	exc_value	tracebackrQ   ZmessageZ	msg_partss   &&&&   r   __exit__ZTimer.__exit__X  s^     zz|;;( //$((D1 DHHfd3	

G7r   c                s^  a a \        V\        4      '       dD   VoS P                  '       g   RSP                  ,          S n        \	        S4      VV 3R l4       pV# T;'       g    VP                  R4      pVP                  RS P                  4      pS P                  S P                  WE4      # )a.  If the first argument is a function, return a decorator which runs
the wrapped function inside Timer's context manager.
Otherwise, treat the first argument as a 'msg' string and return an updated
Timer instance, referencing the same logger.
A 'level' keyword can also be passed to override self.level.
zrun '%s'c                  sf   < S;_uu_ 4        S! V / VB uuR R R 4       #   + '       g   i     R # ; ir    )argsZkwdsfuncr   s   *,r   wrapperZTimer.__call__.<locals>.wrappert  s!    T.. TTTs   0	rF   r   )	r   r   rF   r"   r   r   r   r   r0   )r   Zfunc_or_msgr<   r`   rF   r   r_   s   f&,   @r   __call__ZTimer.__call__g  s     k8,,D888%54[/ / N22E!2CJJw

3E>>$++s::r   c                s    V P                   # r   rM   rO   rP   r   	__float__ZTimer.__float__  s    ||r   c                s,    \        V P                  4      # r   )ZintrM   rO   rP   r   __int__ZTimer.__int__  s    4<<  r   c                s(    R V P                   ,          # )z%.3frb   rO   rP   r   __str__ZTimer.__str__  s    $$r   c                s:   < V ^8  d   Qh/ S[ . S[3,          ;R&   # )i   rK   )r   Zfloat)r    r+   s   "r   Z__annotate__ZTimer.__annotate__   s     t BICu r   )rM   rL   r   r0   rF   rI   )NNNNr   )r"   r#   r$   r%   r&   ZstaticmethodtimeitZdefault_timerrK   rU   r   r   rG   rQ   rT   rX   rY   r\   ra   rc   rd   re   Z__annotate_func__r'   r(   r+      @r   rE   rE      sf     6r ".f.B.B!CE-K2N)"8;0!%A  r   rE   c                   s0   a  ] tR tRt o RtR tR tRtV tR# )ChannelsFilteri  a  Provides a hierarchical filter for log entries based on channel names.

Filters out records emitted from a list of enabled channel names,
including their children. It works the same as the ``logging.Filter``
class, but allows the user to specify multiple channel names.

>>> import sys
>>> handler = logging.StreamHandler(sys.stdout)
>>> handler.setFormatter(logging.Formatter("%(message)s"))
>>> filter = ChannelsFilter("A.B", "C.D")
>>> handler.addFilter(filter)
>>> root = logging.getLogger()
>>> root.addHandler(handler)
>>> root.setLevel(level=logging.DEBUG)
>>> logging.getLogger('A.B').debug('this record passes through')
this record passes through
>>> logging.getLogger('A.B.C').debug('records from children also pass')
records from children also pass
>>> logging.getLogger('C.D').debug('this one as well')
this one as well
>>> logging.getLogger('A.B.').debug('also this one')
also this one
>>> logging.getLogger('A.F').debug('but this one does not!')
>>> logging.getLogger('C.DE').debug('neither this one!')
c                s|    Wn         \        V4      V n        V Uu/ uF  q"\        V4      bK  	  upV n        R # u upi r   )namesrA   numlengths)r   rj   Zns   &* r   r   ZChannelsFilter.__init__  s1    
u:+015a3q6	511s   9c                s   V P                   ^ 8X  d   R# V P                   Fh  pV P                  V,          pW!P                  8X  d    R# VP                  P	                  V^ V4      ^ 8X  g   KM  VP                  V,          R8X  g   Kg   R# 	  R# )r    Tr@   F)rk   rj   rl   r7   rV   )r   r!   r7   Znlens   &&  r   filterZChannelsFilter.filter  sl    88q=JJD<<%D{{"!!$40A5&++d:Ks:R  r   )rl   rj   rk   N)	r"   r#   r$   r%   r&   r   rm   r'   r(   rg   rh   r   ri   ri     s     42
	 	r   ri   c                   sN   a a ] tR tRt oV 3R ltR tR tR tRR ltRt	Vt
V ;t# )	CapturingLogHandleri  c                s   < \         \        V `  VR 7       . V n        \	        V\
        4      '       d   \        P                  ! V4      V n        R# Wn        R# ))r   N)	r   rn   r   recordsr   r   r   r5   r0   )r   r0   r   r   s   &&&r   r   ZCapturingLogHandler.__init__  sA    !411>fc""!++F3DK Kr   c                sl   V P                   P                  V n        V P                   P                  V n        V P                   P
                  V n        V P                   P                  V 4       V P                   P                  V P                  4       R V P                   n        R V P                   n        V # )F)	r0   rD   original_disabledr   original_levelr4   original_propagater8   r9   rO   rP   r   rY   ZCapturingLogHandler.__enter__  s}    !%!5!5"kk//"&++"7"7t$TZZ($ %r   c                s    V P                   P                  V 4       V P                   P                  V P                  4       V P                  V P                   n        V P                  V P                   n        V # r   )r0   rC   r9   rq   rp   rD   rr   r4   )r   ZtypeZvaluer[   s   &&&&r   r\   ZCapturingLogHandler.__exit__  sU    !!$'T001#55 $ 7 7r   c                s<    V P                   P                  V4       R # r   )ro   rB   )r   r!   rN   r   emitZCapturingLogHandler.emit  s    F#r   c                s    ^ RI pVP                  V4      pV P                   F+  pVP                  VP	                  4       4      '       g   K*   R# 	  Vf
   RV,          pQ T4       h)r    NTz(Pattern '%s' not found in logger records)reZcompilero   ZsearchZ
getMessage)r   ZregexprF   rt   ZpatternZrs   &&&   r   assertRegexZCapturingLogHandler.assertRegex  sS    **V$A~~alln--  ;<vEC#qr   )r0   rp   rq   rr   ro   r   )r"   r#   r$   r%   r   rY   r\   rs   ru   r'   r(   r)   r*   r,   r   rn   rn     s#     !
$	 	r   rn   c                   s4   a  ] tR tRt o Rt]R 4       tRtV tR# )LogMixini  a  Mixin class that adds logging functionality to another class.

You can define a new class that subclasses from ``LogMixin`` as well as
other base classes through multiple inheritance.
All instances of that class will have a ``log`` property that returns
a ``logging.Logger`` named after their respective ``<module>.<class>``.

For example:

>>> class BaseClass(object):
...     pass
>>> class MyClass(LogMixin, BaseClass):
...     pass
>>> a = MyClass()
>>> isinstance(a.log, logging.Logger)
True
>>> print(a.log.name)
fontTools.misc.loggingTools.MyClass
>>> class AnotherClass(MyClass):
...     pass
>>> b = AnotherClass()
>>> isinstance(b.log, logging.Logger)
True
>>> print(b.log.name)
fontTools.misc.loggingTools.AnotherClass
c                s    \        V R 4      '       gW   RP                  V P                  P                  V P                  P                  34      p\
        P                  ! V4      V n        V P                  # )_logr@   )Zhasattrr:   r   r#   r"   r   r5   rw   )r   r7   rS   r   rZ   ZLogMixin.log  sR    tV$$88T^^668O8OPQD))$/DIyyr   )rw   N)	r"   r#   r$   r%   r&   ZpropertyrZ   r'   r(   rg   rh   r   rv   rv     s     6  r   rv   c                sF    \         P                  ! V : RV: 2V^R7       R# )z:Raise a warning about deprecated function argument 'name'. is deprecated; categoryZ
stacklevelN)warningswarn)r7   rF   rz   rW   r   deprecateArgumentr}     s    MMD#6VWXr   c                s   a a VV 3R lpV# )zBDecorator to raise a warning when a deprecated function is called.c                 s6   <a  \        S 4      VV V3R  l4       pV# )c                  sh   < \         P                  ! SP                  : R S: 2S^R7       S! V / VB # )rx   ry   )r{   r|   r"   )r^   r<   rz   r_   rF   s   *,r   r`   Z5deprecateFunction.<locals>.decorator.<locals>.wrapper  s3    MM*.--=!
 (((r   r   )r_   r`   rz   rF   s   f r   	decoratorZ$deprecateFunction.<locals>.decorator  s     	t	) 
	) r   r]   )rF   rz   r~   s   ff r   deprecateFunctionr   
  s    
 r   Z__main__)Zoptionflags)r3   )!Zsysr   rf   Z	functoolsr   Zcollections.abcr   r   r{   r   r   rH   r   Z	Formatterr   r?   r6   ZobjectrE   ZFilterri   ZHandlerrn   rv   ZUserWarningr}   r   r"   ZdoctestZexitZtestmodZELLIPSISZfailedr]   r   r   <module>r      s    
    -    ]]

 	%
M]@:W&& @:F`@F&$Ra%F a%H)W^^ )X)'// )X!v !H +6 Y
 %0 $ zHHW__)9)9:AAB r   