403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.202
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Python315/Lib/profiling/sampling/live_collector/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Python315/Lib/profiling/sampling/live_collector/__pycache__/trend_tracker.cpython-315.pyc
R
>lqjc�N�Qs]PHs]QHGsGsGs\Q*sQQ2sP!)z�TrendTracker - Encapsulated trend tracking for live profiling metrics.

This module provides trend tracking functionality for profiling metrics,
calculating direction indicators (up/down/stable) and managing associated
visual attributes like colors.
)�Dict�Literal�Anyc��`�\sQs]snQsQsQU1QkQkks\U1QkQk2sU1QkQks	U1Q	kQ
ks
U1QkQksU1Q
kQksU1QkQks
U1QkQksU1QkQksU1QkQksQsUsP!)�TrendTrackera�
Tracks metric trends over time and provides visual indicators.

This class encapsulates all logic for:
- Tracking previous values of metrics
- Calculating trend directions (up/down/stable)
- Determining visual attributes (colors) for trends
- Managing enable/disable state

Example:
    tracker = TrendTracker(colors_dict)
    tracker.update("func1", "nsamples", 10)
    trend = tracker.get_trend("func1", "nsamples")
    color = tracker.get_color("func1", "nsamples")
g����MbP?c�>:�U]6�cPgQRZRZRZ1*QRZ-!)��colors�enabled)r�str�int�bool)�format�
__classdict__s"��DC:\Python315\\Lib\profiling\sampling\live_collector\trend_tracker.py�__annotate__�"TrendTracker.__init__.__annotate__"s#�����t�C��H�~����c�.�-UmV mVmP!)z�
Initialize the trend tracker.

Args:
    colors: Dictionary containing color attributes including
           'trend_up', 'trend_down', 'trend_stable'
    enabled: Whether trend tracking is initially enabled
)�_previous_values�_enabled�_colors)�selfrr	s&&&r�__init__�TrendTracker.__init__"s��>@����
��rc�":�U]6�cPgQRZ-!�r�return�r)r
rs"�rr�!TrendTracker.enabled.__annotate__0s������rc��UO!)z"Whether trend tracking is enabled.�r�rs&rr	�TrendTracker.enabled/s���}�}�rc�":�U]6�cPgQRZ-!rr)r
rs"�rr� TrendTracker.toggle.__annotate__4s������rc�H�UO%(UmUO!)z?
Toggle trend tracking on/off.

Returns:
    New enabled state
r r!s&r�toggle�TrendTracker.toggle4s��!�M�M�)��
��}�}�rc�&:�U]6�cPgQRZQP-!)rr	rr)r
rs"�rr�%TrendTracker.set_enabled.__annotate__>s��� � �4� �D� rc��VmP!)z!Set trend tracking enabled state.r )rr	s&&r�set_enabled�TrendTracker.set_enabled>s���
rc�4:�U]6�cPgQRZQRZQRZQRZ-!)r�key�metric�valuer)rr
�float�TrendDirection)r
rs"�rr� TrendTracker.update.__annotate__Bs)�����#��s��5��^�rc� �VO7c-UOU$UOU*OV#2oV4UO*6�cQoLV4UO*
6cQoLQoV0OU*U$U!)a
Update a metric value and calculate its trend.

Args:
    key: Identifier for the entity (e.g., function)
    metric: Name of the metric (e.g., 'nsamples', 'tottime')
    value: Current value of the metric

Returns:
    Trend direction: 'up', 'down', or 'stable'
�up�down�stable)r�get�CHANGE_THRESHOLD)rr.r/r0�
prev_value�trends&&&&  r�update�TrendTracker.updateBs����+�+�+�)+�D�!�!�#�&��*�*�3�/�3�3�F�B�
��� 5� 5�5�5��E�
�$�"7�"7�7�
7��E��E�.3���c�"�6�*��rc�.:�U]6�cPgQRZQRZQRZ-!)rr.r/r)rr
r2)r
rs"�rr�#TrendTracker.get_trend.__annotate__bs"���
�
�S�
�#�
�.�
rc��Q!)z�
Get the current trend for a metric without updating.

Args:
    key: Identifier for the entity
    metric: Name of the metric

Returns:
    Trend direction, or 'stable' if not tracked
r7�)rr.r/s&&&r�	get_trend�TrendTracker.get_trendbs��rc�(:�U]6�cPgQRZQRZ-!)rr;r)r2r)r
rs"�rr�#TrendTracker.get_color.__annotate__qs���E�E�~�E�#�Erc�`�UO%f[O!UQ6Xc+UOO	Q[O
2!UQ6Xc+UOO	Q[O
2!UOO	Q[O2!)z�
Get the color attribute for a trend direction.

Args:
    trend: The trend direction

Returns:
    Curses color attribute (or A_NORMAL if disabled)
r5�trend_upr6�
trend_down�trend_stable)r�curses�A_NORMALrr8�A_BOLD)rr;s&&r�	get_color�TrendTracker.get_colorqsv���}�}�}��?�?�"��D�=��<�<�#�#�J��
�
�>�>�
�f�_��<�<�#�#�L�&�-�-�@�@��<�<�#�#�N�F�O�O�D�Drc�Z:�U]6�cPgQRZQRZRZRZ1*QRZRZRZ1*-!)rr.�metricsr)rrr
r1r2)r
rs"�rr�(TrendTracker.update_metrics.__annotate__�s5�����#���S�%�Z�0@��T�#�~�J]�E^�rc�h�-oUO2FDvqEUOVU2V4$J	U!)z�
Update multiple metrics at once and get their trends.

Args:
    key: Identifier for the entity
    metrics: Dictionary of metric_name -> value

Returns:
    Dictionary of metric_name -> trend_direction
)�itemsr<)rr.rP�trendsr/r0s&&&   r�update_metrics�TrendTracker.update_metrics�s2����$�]�]�_�M�F�!�[�[��e�<�F�N�-��
rc� :�U]6�cPgQP-!rrA)r
rs"�rr�TrendTracker.clear.__annotate__�s���&�&�t�&rc�<�UOO2P!)z1Clear all tracked values (useful on stats reset).)r�clearr!s&rrZ�TrendTracker.clear�s�����#�#�%rc�":�U]6�cPgQRZ-!r)r
)r
rs"�rr�"TrendTracker.__repr__.__annotate__�s���F�F�#�Frc�l�UO%cQLQo[UO2oQUQUQ0!)z$String representation for debugging.r	�disabledz
TrendTracker(z, tracking z
 entities))r�lenr)r�status�trackeds&  r�__repr__�TrendTracker.__repr__�s6��"�m�m�m�����d�+�+�,���v�h�k�'��*�E�Er)rrr)T)�__name__�
__module__�__qualname__�__firstlineno__�__doc__r9r�propertyr	r&r+r<rBrMrUrZrc�__static_attributes__�__classdictcell__)rs@rrrs������"���������� � ���@
�
�E�E�(�� &�&�F�Frr)r5r6r7)rirJ�typingrrrr2rrArr�<module>rns.����%�%��/�0��OF�OFr

Youez - 2016 - github.com/yon3zu
LinuXploit