+
    j                     \    R t ^ RIt^ RIHtHt  ! R R]4      tR R ltR R ltR	 R
 ltR# )z
S390xGeneration

This module provides functionality to determine the generation of the
s390x architecture based on the machine type.

Author: Simon Johnsson
Version: 0.0.1
N)Enumautoc                      a  ] tR t^t o Rt]! 4       t]! 4       t]! 4       t]! 4       t	]! 4       t
]! 4       tV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltR
tV tR# )S390xGenerationzs
S390xGeneration

This Enum class provides constants representing different generations
of the S390x architecture.
c                $   < V ^8  d   QhRRRS[ /#    otherr   returnbool)format__classdict__s   "=/usr/lib/python3/dist-packages/DistUpgrade/S390xGeneration.py__annotate__S390xGeneration.__annotate__"        ( (- ($ (    c                4    V P                   VP                   8  # Nvalueselfr	   s   &&r   __lt__S390xGeneration.__lt__"       zzEKK''r   c                $   < V ^8  d   QhRRRS[ /# r   r   )r   r   s   "r   r   r   %   r   r   c                4    V P                   VP                   8  # r   r   r   s   &&r   __gt__S390xGeneration.__gt__%   r   r   c                $   < V ^8  d   QhRRRS[ /# r   r   )r   r   s   "r   r   r   (        ) )- )$ )r   c                4    V P                   VP                   8*  # r   r   r   s   &&r   __le__S390xGeneration.__le__(       zzU[[((r   c                $   < V ^8  d   QhRRRS[ /# r   r   )r   r   s   "r   r   r   +   r"   r   c                4    V P                   VP                   8  # r   r   r   s   &&r   __ge__S390xGeneration.__ge__+   r&   r    N)__name__
__module____qualname____firstlineno____doc__r   ZEC12Z13Z14Z15Z16Z17r   r   r$   r)   __static_attributes____classdictcell__)r   s   @r   r   r      s^      FE
&C
&C
&C
&C
&C( (( () )) )r   r   c                >    V ^8  d   QhR\         R\        R,          /# )r   machine_typer
   N)intr   )r   s   "r   r   r   /   s     % %c %o6L %r   c                   R\         P                  R\         P                  R\         P                  R\         P                  R\         P                  R\         P                  R\         P                  R\         P                  R	\         P
                  R
\         P
                  R\         P                  R\         P                  /pVP                  V 4      # )z
Get the S390x generation corresponding to the given machine type.

Returns:
    S390xGeneration | None: The corresponding S390x generation, or None if
    the machine code is unrecognized.
i  i  i  i  iB  iC  iq!  ir!  i[  i\  i#  i#  )r   r1   r2   r3   r4   r5   r6   get)r:   mappings   & r   _machine_type_to_generationr?   /   s     	o##o##o!!o!!o!!o!!o!!o!!o!!o!!o!!o!!%+G( ;;|$$r   c                2    V ^8  d   QhR\         R,          /# r   r
   N)r;   )r   s   "r   r   r   N   s      C$J r   c                     \        RR4      ;_uu_ 4       p V  Fw  pVP                  R4      w  r#pVP                  4       R8X  g   K.  VP                  4       P                  4       '       g   KT  \	        VP                  4       4      u uuRRR4       # 	  RRR4       R#   + '       g   i     R# ; i  \
        \        3 d     R# i ; i)z
Read the machine type from /proc/sysinfo.

Returns:
    int | None: The machine type as an integer, or None if it cannot be
    determined.
z/proc/cpuinfor:machineN)open	partitionstripisdigitr;   FileNotFoundError
ValueError)flinekey_r   s        r   _read_machine_typerP   N   s    /3''1 $s 399;)+0E0E0G0Gu{{}--	 (' (  ('  z* sF   B2 ,B!B-B
B2 BB2 B/	)B2 /B2 2CCc                2    V ^8  d   QhR\         R,          /# rA   )r   )r   s   "r   r   r   a   s     
5 
5_t%; 
5r   c                 d    \        4       p V f   \        P                  ! R4       R# \        V 4      # )z
Return the current running s390x generation, otherwise None if not running
on s390x architecture or if the generation cannot be determined.
Nz/Failed to read machine type from /proc/cpuinfo!)rP   loggingwarningr?   )r:   s    r   get_system_s390x_generationrU   a   s-    
 &'LIJ&|44r   )	r0   rS   enumr   r   r   r?   rP   rU   r+   r   r   <module>rW      s-     )d )<%>&
5r   