3 \�me�A � @ s d dl Z d dlZd dlZd dlmZmZmZ d dlmZ d dl m Z d dl mZmZm Z d dlmZmZmZmZ eje�ZG dd� de�ZG d d � d �ZG dd� d�ZG d d� d�Zdd� ZG dd� d�ZG dd� d�ZG dd� d�ZG dd� d�ZG dd� dej �Z!G dd� de�Z"dS )� N)� NoOptionError�NoSectionError�RawConfigParser)�StringIO)�time)�persistence� type_utils�util)�CFG_ENV_NAME� PER_ALWAYS�PER_INSTANCE�PER_ONCEc @ s e Zd ZdS )�LockFailureN)�__name__� __module__�__qualname__� r r �/usr/lib/python3.6/helpers.pyr s r c @ s e Zd ZdS )� DummyLockN)r r r r r r r r s r c @ s4 e Zd Zdd� Zejddd��Zdd� Zdd � Zd S )�DummySemaphoresc C s d S )Nr )�selfr r r �__init__! s zDummySemaphores.__init__Fc c s t � V d S )N)r )r �_name�_freqZ_clear_on_failr r r �lock$ s zDummySemaphores.lockc C s dS )NFr )r r r r r r �has_run( s zDummySemaphores.has_runc C s dS )NTr )r r r r r r �clear+ s zDummySemaphores.clearN)F) r r r r � contextlib�contextmanagerr r r r r r r r s r c @ s e Zd Zdd� Zdd� ZdS )�FileLockc C s || _ d S )N)�fn)r r r r r r 0 s zFileLock.__init__c C s dt j| �| jf S )Nz<%s using file %r>)r Zobj_namer )r r r r �__str__3 s zFileLock.__str__N)r r r r r! r r r r r / s r c C s | j dd�S )N�-�_)�replace)�namer r r �canon_sem_name7 s r&