관리-도구
편집 파일: __init__.cpython-311.opt-1.pyc
� �EBgI � � � d Z ddlZddlmZ ddlmZ ddlmZ ddlm Z ddl mZ dd lm Z mZmZ d Zdaed� � � ZdS )a, Config for wizard is not like all other our configs, it can be read and modified in multiple processes at the same time, so we should handle that situations correctly. Thus, we must set up exclusive locks for reading and writing and use contextmanager to load config on start and save right after leaving scope and in case of any errors. You can use config like this: with config.acquire_config_access() as config: options = config.get_options(module) or with config.acquire_config_access() as config: options = config.set_state(module, 'failed') � N)�contextmanager)�Optional)�Config)�MODULES_STATUS_FILE_LOCK)�UnableAcquireLockError� )�BaseConfigError�NoSuchModule�MalformedConfigError)r r r �acquire_config_accessc # �� K � t �t V � d S t t dd�� � } n7# t t f$ r#}t t |� � �� � |�d }~ww xY wt j | t j � � t � � a t V � t d u pt � � � d a t j | t j � � d S # d a t j | t j � � w xY w# t d u pt � � � d a t j | t j � � w # d a t j | t j � � w xY wxY w)N�wzutf-8)�encoding)� error_message) �_config�openr �IOError�OSErrorr �str�fcntl�flock�LOCK_EXr �save�LOCK_UN)� lock_file�es �py/clwizard/config/__init__.pyr r F s^ � � � � ��� � � ���B��1�3��I�I�I� � ���W�� B� B� B�$�3�q�6�6�:�:�:��A�����B���� �K� �5�=�)�)�)� 2��(�(��� � � � 2��t�O�-�w�|�|�~�~���G��K� �5�=�1�1�1�1�1�� �G��K� �5�=�1�1�1�1����� 2��t�O�-�w�|�|�~�~���G��K� �5�=�1�1�1�1�� �G��K� �5�=�1�1�1�1������sD �. �A"�A�A"�D �"C"