Ë
    ÿXZÂ   ã                   óF   — d dl Z d dlZd dlZd dlZd dlmZ  G d„ de«      Zy)é    N)ÚlocaleCc                   óH  — e Zd ZdZe	 	 dd„«       Zd„ Zd„ Zd„ Ze	d„ «       Z
 e	d„ d	„ «      Z e	d
„ d„ «      Z e	d„ d„ «      Zedd„«       Zed„ «       Zed„ «       Zedd„«       Zedd„«       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zedd„«       Zed„ «       Zd„ Zy)ÚGeometrya$  Geometry()

       Geometry represents a region on a device in the system - a disk or
       partition.  It is expressed in terms of a starting sector and a length.
       Many methods (read and write methods in particular) throughout pyparted
       take in a Geometry object as an argument.Nc                 óV  — |rA|| _         |€0t        j                  | j                   j                  ¬«      | _        y|| _        y|s<|| _        t        j                  | j                  j                  «       ||«      | _         y|sI||kD  rD|| _        t        j                  | j                  j                  «       |||z
  dz   |¬«      | _         y|rG|rE|rC||kD  r>|| _        t        j                  | j                  j                  «       |||¬«      | _         yt        j                  d«      ‚)z´Create a new Geometry object for the given _ped.Device that extends
           for length sectors from the start sector.  Optionally, an end sector
           can also be provided.N)Ú	PedDeviceé   )Úendzkmust specify PedGeometry or (device, start, length) or (device, start, end) or (device, start, length, end))
Ú_Geometry__geometryÚpartedÚDeviceÚdevÚ_deviceÚ_pedr   ÚdeviceÚgetPedDeviceÚGeometryException)Úselfr   ÚstartÚlengthr	   ÚPedGeometrys         ú1/usr/lib/python3/dist-packages/parted/geometry.pyÚ__init__zGeometry.__init__)   só   € ñ Ø)ˆDŒOàˆ~Ü%Ÿ}™}°t·±×7JÑ7JÔK�•à%�•ÙØ!ˆDŒLÜ"Ÿm™m¨D¯K©K×,DÑ,DÓ,FÈÈvÓVˆD�OÙ˜S 5š[Ø!ˆDŒLÜ"Ÿm™m¨D¯K©K×,DÑ,DÓ,FÈÐPSÐV[ÑP[Ð^_ÑP_ÐfiÔjˆD�OÙ‘v¡#¨3°ª;Ø!ˆDŒLÜ"Ÿm™m¨D¯K©K×,DÑ,DÓ,FÈÈvÐ[^Ô_ˆD�Oä×*Ñ*ð  ,Yó  Zð  Zó    c                 ó&   — | j                  |«       S ©N)Ú__ne__©r   Úothers     r   Ú__eq__zGeometry.__eq__B   s   € Ø—;‘;˜uÓ%Ð%Ð%r   c                 óÎ   — t        | |j                  «      sy| j                  |j                  k7  xs4 | j                  |j                  k7  xs | j                  |j                  k7  S )NT)Ú
isinstanceÚ	__class__r   r   r   r   s     r   r   zGeometry.__ne__E   sM   € Ü˜$ §¡Ô0Øà�{‰{˜eŸl™lÑ*Òf¨d¯j©j¸E¿K¹KÑ.GÒfÈ4Ï;É;ÐZ_×ZfÑZfÑKfÐfr   c                 ó€   — d| j                   | j                  | j                  | j                  | j                  dœz  }|S )Nz{parted.Geometry instance --
  start: %(start)s  end: %(end)s  length: %(length)s
  device: %(device)r  PedGeometry: %(ped)r)r   r	   r   r   Úped)r   r	   r   r   r
   )r   Úss     r   Ú__str__zGeometry.__str__K   s<   € ð:ð —z‘z¨$¯(©(¸d¿k¹kØŸ™¨D¯O©Oñ=ñ=ˆð
 ˆr   c                 ó   — | j                   S )z#The Device this geometry describes.)r   ©r   s    r   r   zGeometry.deviceS   s   € ð �|‰|Ðr   c                 ó.   — | j                   j                  S r   )r
   r   ©r%   s    r   ú<lambda>zGeometry.<lambda>X   s   € ˜qŸ|™|×1Ñ1€ r   c                 ó8   — | j                   j                  |«      S r   )r
   Ú	set_start©r%   Úvs     r   r+   zGeometry.<lambda>X   s   € ÀÇÁ×@VÑ@VÐWXÓ@Y€ r   c                 ó.   — | j                   j                  S r   )r
   r	   r*   s    r   r+   zGeometry.<lambda>Y   s   € ˜QŸ\™\×-Ñ-€ r   c                 ó8   — | j                   j                  |«      S r   )r
   Úset_endr.   s     r   r+   zGeometry.<lambda>Y   s   € ¸A¿L¹L×<PÑ<PÐQRÓ<S€ r   c                 ó.   — | j                   j                  S r   )r
   r   r*   s    r   r+   zGeometry.<lambda>Z   s   €  §¡× 3Ñ 3€ r   c                 ób   — | j                   j                  | j                   j                  |«      S r   )r
   Úsetr   r.   s     r   r+   zGeometry.<lambda>Z   s%   € À!Ç,Á,×BRÑBRÐST×S_ÑS_×SeÑSeÐghÓBi€ r   c                 ó|   — |s| j                   j                  |||«      S | j                   j                  ||||«      S )a5  Check the region described by self for errors on the disk.
           offset -- The beginning of the region to check, in sectors from the
                     start of the geometry.
           granularity -- How sectors should be grouped together
           count -- How many sectors from the region to check.)r
   Úcheck)r   ÚoffsetÚgranularityÚcountÚtimers        r   r7   zGeometry.check\   s;   € ñ Ø—?‘?×(Ñ(¨°¸eÓDÐDà—?‘?×(Ñ(¨°¸eÀUÓKÐKr   c                 óT   — | j                   j                  |j                  «       «      S )zgReturn whether Geometry b is contained entirely within self and on
           the same physical device.)r
   Útest_insideÚgetPedGeometry©r   Úbs     r   ÚcontainszGeometry.containsh   s"   € ð �‰×*Ñ*¨1×+;Ñ+;Ó+=Ó>Ð>r   c                 ó8   — | j                   j                  |«      S )z=Return whether the sectory is contained entirely within self.)r
   Útest_sector_inside)r   Úsectors     r   ÚcontainsSectorzGeometry.containsSectorn   s   € ð �‰×1Ñ1°&Ó9Ð9r   c                 óL  — t        j                  dt        «       |j                  «       }| j                  | j
                  j                  z  }|t        j                  j                  «       vrt        d|z  «      ‚|t        j                  dt        j                  |   «      z  S )aW  Return the size of the geometry 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.zuse the getLength methodzinvalid unit %s giveng      �@)ÚwarningsÚwarnÚDeprecationWarningÚlowerr   r   Ú
sectorSizer   Ú	_exponentÚkeysÚSyntaxErrorÚmathÚpow)r   ÚunitÚlunitÚsizes       r   ÚgetSizezGeometry.getSizes   s€   € ô 	�‰Ð0Ô2DÔEØ—
‘
“ˆØ�{‰{˜TŸ[™[×3Ñ3Ñ3ˆàœ×(Ñ(×-Ñ-Ó/Ñ/ÜÐ5¸Ñ>Ó?Ð?à”t—x‘x ¬×(8Ñ(8¸Ñ(?Ó@Ñ@ÐAr   c                 ó‚   — | j                   }|dk(  r|S t        j                  || j                  j                  z  |«      S )zýReturn the length of the geometry 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.Úsectors)r   r   ÚformatBytesr   rK   )r   rQ   rV   s      r   Ú	getLengthzGeometry.getLengthƒ   s<   € ð —+‘+ˆØ�9ÒØˆNÜ×!Ñ! '¨D¯K©K×,BÑ,BÑ"BÀDÓIÐIr   c                 óh   — t        | j                  j                  |j                  «       «      ¬«      S )zžReturn a new Geometry describing the region common to both self
           and Geometry b.  Raises ArithmeticError if the regions do not
           intersect.©r   )r   r
   Ú	intersectr>   r?   s     r   r[   zGeometry.intersectŽ   s'   € ô
  D§O¡O×$=Ñ$=¸a×>NÑ>NÓ>PÓ$QÔRÐRr   c                 ó~   — t        j                  | j                  j                  |j	                  «       |«      ¬«      S )zöGiven a Geometry src that overlaps with self and a sector inside src,
           this method translates the address of the sector into an address
           inside self.  If self does not contain sector, ArithmeticError will
           be raised.rZ   )r   r   r
   Úmapr>   )r   ÚsrcrD   s      r   r]   zGeometry.map•   s.   € ô �‰¨4¯?©?×+>Ñ+>¸s×?QÑ?QÓ?SÐU[Ó+\Ô]Ð]r   c                 óv   — 	 | j                   j                  |j                  «       «       y# t        $ r Y yw xY w)zgReturn whether self and b are on the same device and share at least
           some of the same region.TF)r
   r[   r>   ÚArithmeticErrorr?   s     r   ÚoverlapsWithzGeometry.overlapsWith�   s7   € ð	Ø�O‰O×%Ñ% a×&6Ñ&6Ó&8Ô9ØøÜò 	Ùð	ús   ‚), ¬	8·8c                 ó:   — | j                   j                  ||«      S )zêRead data from the region described by self.
           offset -- The number of sectors from the beginning of the region
                     (not the beginning of the disk) to read.
           count  -- The number of sectors to read.)r
   Úread)r   r8   r:   s      r   rc   zGeometry.read§   s   € ð �‰×#Ñ# F¨EÓ2Ð2r   c                 ón   — |r| j                   j                  «       S | j                   j                  «       S )z›Flushes all caches on the device described by self.  If fast is
           True, the flush will be quicked by cache coherency is not
           guaranteed.)r
   Ú	sync_fastÚsync)r   Úfasts     r   rf   zGeometry.sync¯   s-   € ñ
 Ø—?‘?×,Ñ,Ó.Ð.à—?‘?×'Ñ'Ó)Ð)r   c                 ó<   — | j                   j                  |||«      S )a1  Write data into the region described by self.
           buf    -- The data to be written.
           offset -- Where to start writing to region, expressed as the number
                     of sectors from the start of the region (not the disk).
           count  -- How many sectors of buf to write out.)r
   Úwrite)r   Úbufr8   r:   s       r   ri   zGeometry.write¹   s   € ð �‰×$Ñ$ S¨&°%Ó8Ð8r   c                 ó   — | j                   S )zdReturn the _ped.Geometry object contained in this Geometry.
           For internal module use only.)r
   r(   s    r   r>   zGeometry.getPedGeometryÂ   s   € ð �‰Ðr   )NNNNNr   )ÚMB)rV   )F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r&   Úpropertyr   r   r	   r   r7   rA   rE   rT   rX   r[   r]   ra   rc   rf   ri   r>   © r   r   r   r   "   s\  „ ñ4ð ØAEØ!òZó ðZò0&ògòð ñó ðñ Ñ1Ñ3YÓZ€EÙ
Ñ-Ñ/SÓ
T€CÙÑ3Ñ5iÓj€Fàò	Ló ð	Lð ñ?ó ð?ð
 ñ:ó ð:ð òBó ðBð òJó ðJð ñSó ðSð ñ^ó ð^ð ñó ðð ñ3ó ð3ð ò*ó ð*ð ñ9ó ð9ór   r   )rO   rG   r   r   Úparted.decoratorsr   Úobjectr   rr   r   r   ú<module>ru      s$   ðó4 Û ã Û å %ôcˆvõ cr   