ok
Direktori : /opt/cloudlinux/venv/lib/python3.11/site-packages/dill/__pycache__/ |
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/dill/__pycache__/logger.cpython-311.pyc |
� �܋fL+ � �� � d Z g d�ZddlZddlZddlZddlZddlZddlZddlm Z ddl mZmZ ddl Z e� ddddd �� � Z G d � dej � � Z G d� d ej � � Z ej d� � Zde_ ee� � Z ej � � Ze� e� � ddd�deeeeej f deddfd�Z G d� dej � � Z dS )uo Logging utilities for dill. The 'logger' object is dill's top-level logger. The 'adapter' object wraps the logger and implements a 'trace()' method that generates a detailed tree-style trace for the pickling call at log level INFO. The 'trace()' function sets and resets dill's logger log level, enabling and disabling the pickling trace. The trace shows a tree structure depicting the depth of each object serialized *with dill save functions*, but not the ones that use save functions from 'pickle._Pickler.dispatch'. If the information is available, it also displays the size in bytes that the object contributed to the pickle stream (including its child objects). Sample trace output: >>> import dill, dill.tests >>> dill.detect.trace(True) >>> dill.dump_session(main=dill.tests) ┬ M1: <module 'dill.tests' from '.../dill/tests/__init__.py'> ├┬ F2: <function _import_module at 0x7f0d2dce1b80> │└ # F2 [32 B] ├┬ D2: <dict object at 0x7f0d2e98a540> │├┬ T4: <class '_frozen_importlib.ModuleSpec'> ││└ # T4 [35 B] │├┬ D2: <dict object at 0x7f0d2ef0e8c0> ││├┬ T4: <class '_frozen_importlib_external.SourceFileLoader'> │││└ # T4 [50 B] ││├┬ D2: <dict object at 0x7f0d2e988a40> │││└ # D2 [84 B] ││└ # D2 [413 B] │└ # D2 [763 B] └ # M1 [813 B] )�adapter�logger�trace� N)�partial)�TextIO�Union�|�+�`)� │u ├� ┬� └c �6 � e Zd ZdZd� Zd� Zd� Zd� Zd� Zd� Z dS ) �TraceAdaptera� Tracks object tree depth and calculates pickled object size. A single instance of this wraps the module's logger, as the logging API doesn't allow setting it directly with a custom Logger subclass. The added 'trace()' method receives a pickle instance as the first argument and creates extra values to be added in the LogRecord from it, then calls 'info()'. Usage of logger with 'trace()' method: >>> from dill.logger import adapter as logger #NOTE: not dill.logger.logger >>> ... >>> def save_atype(pickler, obj): >>> logger.trace(pickler, "Message with %s and %r etc. placeholders", 'text', obj) >>> ... c � � || _ d S �N)r )�selfr s �\/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/dill/logger.py�__init__zTraceAdapter.__init__t s � ������ c � � t d|�� � }|� |� � | j � |� � d S )Nz%(prefix)s%(message)s%(suffix)s��handler)�TraceFormatter�setFormatterr � addHandler)r r � formatters r r zTraceAdapter.addHandlerv sE � �"�#D�g�V�V�V� ����Y�'�'�'�����w�'�'�'�'�'r c �: � | j � |� � d S r )r � removeHandler)r r s r r zTraceAdapter.removeHandlerz s � ���!�!�'�*�*�*�*�*r c � � ||fS r � )r �msg�kwargss r �processzTraceAdapter.process| s � ��F�{�r c � � t j � |d�� � sd S | � t j � � rd|_ g |_ d S d |_ d S )NF)�child� )�dill�_dill�is_dill�isEnabledFor�logging�INFO�_trace_depth�_size_stack)r �picklers r �trace_setupzTraceAdapter.trace_setup s` � ��z�!�!�'��!�7�7� ��F����W�\�*�*� (�#$�G� �"$�G����#'�G� � � r c � � t |d� � st j |g|�R i |�� d S |j �d S |� di � � }|� d� � }d } |j � � � }|j j } ||� � � z }n"# t $ r |t |� � z }Y nw xY wn# t t f$ r Y nw xY w|�>|s|j � |� � n!||j � � � z }||d<