Mini Shell

Direktori : /usr/lib64/python3.6/site-packages/parted/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/site-packages/parted/__pycache__/partition.cpython-36.pyc

3

��w]�'�@s�ddlZddlZddlZddlZddlmZGdd�de�ZiZej	d�Z
eje
�ee
<dZx*er�ej	e
�Z
e
svdZq^eje
�ee
<q^WdS)�N)�localeCc@sveZdZed?dd��Zdd�Zdd�Zdd	�Zd
d�Ze	edd
���Z
e	edd���Ze	dd��Ze	edd���Z
e	dd��Zedd��Zdd�Ze	dd�dd��Ze	dd�dd��Ze	dd�d d��Ze	d!d�d"d��Ze	ee�Zed#d$��Zed%d&��Zed'd(��Zed)d*��Zed+d,��Zed-d.��Zed@d0d1��ZedAd3d4��Zd5d6�ZdBd7d8�Zd9d:�Z d;d<�Z!d=d>�Z"dS)C�	PartitionNcCs|dkr�|dkrtjd��n&|dkr0tjd��n|dkrBtjd��||_||_||_|dkrxtj|j�||j|j	�|_
n$tj|j�||j|j	tj|j�|_
nf||_
tj
|j
jd�|_|dkr�tj|j
jd�|_n||_|j
jdkr�d|_ntj|j
jj|jd�|_dS)Nzno disk specifiedzno type specifiedzno geometry specified)�PedGeometry)ZPedDisk)�type�geometry)�parted�PartitionException�_fileSystem�	_geometry�_disk�_pedr�
getPedDisk�start�end�_Partition__partitionZfileSystemTyper�GeometryZgeomZDisk�diskZfs_typeZ
FileSystem�name)�selfrrZfsr�PedPartition�r�!/usr/lib64/python3.6/partition.py�__init__&s*
&zPartition.__init__cCs|j|�S)N)�__ne__)r�otherrrr�__eq__GszPartition.__eq__cCs@t||j�sdS|j|jkp>|j|jkp>|j|jkp>|j|jkS)NT)�
isinstance�	__class__�pathrr�
fileSystem)rrrrrrJszPartition.__ne__cCsZy
|j}Wntjk
r$d}YnXd|j|j|j|j|j|j||j	|j
|jd�
}|S)Nz�parted.Partition instance --
  disk: %(disk)r  fileSystem: %(fileSystem)r
  number: %(number)s  path: %(path)s  type: %(type)s
  name: %(name)s  active: %(active)s  busy: %(busy)s
  geometry: %(geometry)r  PedPartition: %(ped)r)
rrr�numberrrr�active�busyZped)rrrrrrr rrr!r"r)rr�srrr�__str__Ps


zPartition.__str__cCstj|��dS)N)rZWriteOnlyProperty)rZproprrrZ__writeOnlyaszPartition.__writeOnlycCst|jj��S)z1True if the partition is active, False otherwise.)�boolrZ	is_active)rrrrr!dszPartition.activecCst|jj��S)z1True if the partition is active, False otherwise.)r%rZis_busy)rrrrr"jszPartition.busycCs|jS)z#The Disk this partition belongs to.)r)rrrrrpszPartition.diskcCs
|jj�S)z4The filesystem path to this partition's device node.)r�get_path)rrrrruszPartition.pathcCs|jjS)zThe partition number.)rZnum)rrrrr {szPartition.numbercCs|j�j|�dS)z@Set the partition name to the given string, on supported labels.N)�getPedPartition�set_name)rrrrrr(�szPartition.set_namecCs&y
|jj�Stjk
r dSXdS)z(The partition name, on supported labels.N)r�get_namerr)rrrrr)�s
zPartition.get_namecCs|jS)N)r	)r#rrr�<lambda>�szPartition.<lambda>cCst|d|�S)Nr	)�setattr)r#�vrrrr*�scCs|jS)N)r
)r#rrrr*�scCst|d|�S)Nr
)r+)r#r,rrrr*�scCs
|jd�S)N�system)�_Partition__writeOnly)r#rrrr*�scCs|jj|�S)N)rZ
set_system)r#r,rrrr*�scCs|jjS)N)rr)r#rrrr*�scCst|jd|�S)Nr)r+r)r#r,rrrr*�scCs|jj|�S)z�Get the value of a particular flag on the partition.  Valid flags
           are the _ped.PARTITION_* constants.  See _ped.flag_get_name() and
           _ped.flag_get_by_name() for more help working with partition flags.
        )rZget_flag)r�flagrrr�getFlag�szPartition.getFlagcCs|jj|d�S)z�Set the flag on a partition to the provided value.  On error, a
           PartitionException will be raised.  See getFlag() for more help on
           working with partition flags.�)r�set_flag)rr/rrr�setFlag�szPartition.setFlagcCs|jj|d�S)z�Unset the flag on this Partition.  On error, a PartitionException
           will be raised.  See getFlag() for more help on working with
           partition flags.r)rr2)rr/rrr�	unsetFlag�szPartition.unsetFlagcCs tj|jj�j|j|j��d�S)zzGiven a constraint, return the maximum Geometry that self can be
           grown to.  Raises Partitionexception on error.)r)rrrr
Zget_max_partition_geometryrZgetPedConstraint)rZ
constraintrrr�getMaxGeometry�szPartition.getMaxGeometrycCs|jj|�S)zOReturn True if flag is available on this Partition, False
           otherwise.)rZis_flag_available)rr/rrr�isFlagAvailable�szPartition.isFlagAvailablecCs2|jj�j|j�}|dkrdStj|j|d�SdS)z4Return the Partition following this one on the Disk.N)rr)rr
Znext_partitionrrr)r�	partitionrrr�
nextPartition�szPartition.nextPartition�MBcCstjdt�|jj|�S)aXReturn the size of the partition in the unit specified.  The unit
           is given as a string corresponding to one of the following
           abbreviations:  b (bytes), KB (kilobytes), MB (megabytes), GB
           (gigabytes), TB (terabytes).  An invalid unit string will raise a
           SyntaxError exception.  The default unit is MB.zuse the getLength method)�warnings�warn�DeprecationWarningr�getSize)r�unitrrrr=�szPartition.getSize�sectorscCs|jj|�S)z�Return the length of the partition in sectors. Optionally, a SI or
           IEC prefix followed by a 'B' may be given in order to convert the
           length into bytes. The allowed values include B, kB, MB, GB, TB, KiB,
           MiB, GiB, and TiB.)r�	getLength)rr>rrrr@�szPartition.getLengthcCs8g}x(tj�D]}|j|�r|jt|�qWdj|�S)zTReturn a comma-separated string representing the flags
           on this partition.z, )�
partitionFlag�keysr0�append�join)r�flagsr/rrr�getFlagsAsString�s

zPartition.getFlagsAsStringcCs~|j�}|tjj�kr"td|��|jj}|jjj}x,|j	j
D] }|jtj@r\||jj7}q>Pq>Wt
j|t
j|tj|��S)a�Return the maximum size this Partition can grow to by looking
           at contiguous freespace partitions.  The size is returned in
           the unit specified (default is megabytes).  The unit is a
           string corresponding to one of the following abbreviations:
           b (bytes), KB (kilobytes), MB (megabytes), GB (gigabytes),
           TB (terabytes).  An invalid unit string will raise a
           SyntaxError exception.zinvalid unit %s given)�lowerrZ	_exponentrB�SyntaxErrorrZlengthZdevice�
sectorSizerZ
partitionsrZPARTITION_FREESPACE�mathZfloor�pow)rr>ZlunitZ	maxLengthrIr7rrr�getMaxAvailableSize�s
zPartition.getMaxAvailableSizecCs|jdd�S)z*Return the device name for this Partition.�N)r)rrrr�getDeviceNodeName�szPartition.getDeviceNodeNamecCs|jS)zfReturn the _ped.Partition object contained in this Partition.
           For internal module use only.)r)rrrrr'�szPartition.getPedPartitioncCs
|jj�S)z'Reset the partition's number to default)rZ	reset_num)rrrr�resetNumber�szPartition.resetNumber)NNNNN)r9)r?)r9)#�__name__�
__module__�__qualname__rrrrr$r.�propertyr!r"rrr r(r)rrr-rrr0r3r4r5r6r8r=r@rFrLrNr'rOrrrrr$sH 

	
rTF)
rJr:rrZparted.decoratorsr�objectrrAZpartition_flag_nextZ__flagZpartition_flag_get_nameZ__readFlagsrrrr�<module>s^