Sindbad~EG File Manager

Current Path : /lib/python3.6/site-packages/vdo/vdomgmnt/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/vdo/vdomgmnt/__pycache__/Utils.cpython-36.pyc

3

x?ag�
�@s�dZddlmZddlmZddlmZddlmZddlmZmZddl	Z
ddlZddlZddl
Z
ddlZGdd	�d	e�ZdS)
z�
  Utils - miscellaneous utilities for the VDO manager

  $Id: //eng/vdo-releases/aluminum/src/python/vdo/vdomgmnt/Utils.py#2 $

�)�absolute_import)�division)�print_function)�unicode_literals)�CommandError�
runCommandNc@s�eZdZdZdZdeZdeZdeZdeZe	dd��Z
e	dd��Ze	dd��Ze
d	d
��Ze	dd��Ze	d
d��Zdd�ZdS)�Utilsz'Utils contains miscellaneous utilities.icCstjjdd�|jtj�D��S)zTakes a path or a colon-separated list of paths and makes
    each one an absolute path. Paths that don't exist are left alone.cSsg|]}tjj|��qS�)�os�path�abspath)�.0�pr	r	�/usr/lib/python3.6/Utils.py�
<listcomp>5sz%Utils.abspathPath.<locals>.<listcomp>)r
�pathsep�join�split)rr	r	r�abspathPath1szUtils.abspathPathcCstjdtj|7<dS)z�Appends a directory or directories to the current PATH.

    Arguments:
      path (str): A directory or colon-separated list of directories.
    �PATHN)r
�environr)rr	r	r�appendToPath8szUtils.appendToPathcCs|dko||d@dkS)z0Returns True iff its argument is a power of two.r�r	)�ir	r	r�isPowerOfTwoBszUtils.isPowerOfTwocCsfy.tj|tj�xtjd�tj|d�qWWn2tk
r`}z|jtjkrP|�WYdd}~XnXdS)z�Kills a process and waits for it to die.

    Arguments:
      pid:      process id to kill
    Throws:
      Any unexpected OS error
    rrN)	r
�kill�signal�SIGTERM�timeZsleep�OSError�errnoZESRCH)�cls�pid�er	r	r�killProcessHs	
zUtils.killProcesscCs||kr|S|S)z#Returns the maximum of two numbers.r	)�a�br	r	r�maxNum[szUtils.maxNumcCstjj|�S)z�Finds the full path to a command.

    Arguments:
      cmd (str): The command to search for.
    Returns:
      The full path as a string, or None if the command is not found.
    )�	distutilsZspawnZfind_executable)�cmdr	r	r�whichcs	zUtils.whichcCsdS)Nr	)�selfr	r	r�__init__qszUtils.__init__N)�__name__�
__module__�__qualname__�__doc__ZKiBZMiBZGiBZTiBZPiB�staticmethodrrr�classmethodr$r'r*r,r	r	r	rr%s
r)r0Z
__future__rrrrZ	vdo.utilsrrZdistutils.spawnr(r r
rr�objectrr	r	r	r�<module>s

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists