[ Root System Explorer ]
Location:
Root
/
proc
/
thread-self
/
root
/
proc
/
thread-self
/
root
/
opt
/
gsutil
/
third_party
/
fasteners
/
fasteners
/
__pycache__
+ Folder
+ File
Upload
Editing: _utils.cpython-39.pyc
a V�EV � @ sv d dl Z d dlZd dlmZ dZe �e�Zdd� ZG dd� de �Z G dd � d e�ZG d d� de �Z G dd � d e �ZdS )� N)� monotonic� c G s | D ]}|dur| S qdS )zEReturns first of values that is *not* None (or None if all are/were).N� )�values�valr r �5/opt/gsutil/third_party/fasteners/fasteners/_utils.py�pick_first_not_none s r c @ s2 e Zd ZdZddd�Zdd� Zdd� Zd d � ZdS )� LockStackz�Simple lock stack to get and release many locks. An instance of this should **not** be used by many threads at the same time, as the stack that is maintained will be corrupted and invalid if that is attempted. Nc C s g | _ t|t�| _d S �N)�_stackr �LOG�_logger)�self�loggerr r r �__init__. s zLockStack.__init__c C s |� � }|r| j�|� |S r )�acquirer �append)r �lockZgottenr r r �acquire_lock2 s zLockStack.acquire_lockc C s | S r r �r r r r � __enter__8 s zLockStack.__enter__c C s\ t | j�}|}| jrX| j�� }z|�� W n" tyL | j�d||� Y n0 |d8 }qd S )Nz6Failed releasing lock %s from lock stack with %s locks� )�lenr �pop�release� Exceptionr � exception)r �exc_type� exc_value�exc_tbZam_leftZtot_amr r r r �__exit__; s � zLockStack.__exit__)N)�__name__� __module__�__qualname__�__doc__r r r r r r r r r &