+
     Gi9  c                   s    ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIHtHt  ^ RIt	Rt
^ RIHt ^ RIt^ RIHt ]P"                  P%                  4       t ! R R4      tR#    Rt
 L<; i)    N)ConfigParserErrorTF)commandsc                   s@   a  ] tR t^t o RR ltR tRR ltR tRtV t	R# )	ProfileRecommenderc                s>    Wn         \        4       V n        R V n        R # )N)_is_hardcodedr   	_commands_chassis_type)selfZis_hardcodeds   &&D/usr/lib/python3.14/site-packages/tuned/utils/profile_recommender.py__init__ZProfileRecommender.__init__   s    #:$.$    c                s   \         P                  pV P                  '       d   V# \        P                  ! 4       ^ 8H  pV'       g   \
        P                  R4       V P                  \         P                  VR7      pVe   V# / p\         P                   FH  p. p \        P                  ! V4      pV F&  p\        P                  P!                  WX4      p	WV&   K(  	  KJ  	  \#        VP%                  4       4       F%  pWH,          p	V P                  WR7      pVf   K#  Vu # 	  V#   \         dG   pTP                  \        P                  8w  d   \
        P                  RT: RT: 24        Rp?LRp?ii ; i)r    ztProfile recommender is running without root privileges. Profiles with virt recommendation condition will be omitted.)has_rootNzerror accessing z: )constsZDEFAULT_PROFILEr   osZgeteuidlogwarningprocess_configZRECOMMEND_CONF_FILEZRECOMMEND_DIRECTORIESZlistdirOSErrorerrnoENOENTerrorpathZjoinZsortedZkeys)
r   Zprofiler   ZmatchingfilesZ	directorycontentseZnamer   s
   &         r	   	recommendZProfileRecommender.recommend   s8   ""'	
>ZZ\Q(	;;  F  G  !;!; ! (
?
%//i8:zz)$H t77<<	(D$K  0 UZZ\"d
+4!!$!:8O	 #
 
.  :ww%,,YY9a89:s   D##E4.<E//E4c           
     s	   R pRp \         P                  P                  V4      '       g   R # \        RRRR7      p\        Vn        \        V4      ;_uu_ 4       pVP                  Wa4       R R R 4       VP                  4        EF8  pRpVP                  V4       EF  p	VP                  WyRR7      p
V
R8X  d   Rp
V	R	8X  da   V'       g   Rp EM\        P                  ! V
V P                  P                  R
.4      ^,          \        P                  4      '       g   RpK  K  V	R8X  d\   \        P                  ! V
V P                  P                  \         P"                  RR7      \        P                  4      '       g   RpK  K  V	^ ,          R8X  ds   \         P                  P%                  V	4      '       dF   \        P                  ! V
V P                  P                  V	4      \        P                  4      '       g   RpEKf  EKi  V	R,          R8X  da   \&        P(                  ! 4       pVP+                  4        \-        VP/                  \        P0                  ! V
4      4      4      ^ 8X  d   RpEK  EK  V	R8X  dD   V P3                  4       p\        P                  ! W\        P4                  4      '       g   RpEK  EK!  V	R8X  g   EK+  Rp\6        '       d_   \8        P:                  P=                  \8        P:                  P>                  RR7      p VP                  4        VP@                  R,          pM&V'       g   \N        PQ                  RV,          4       Rp\        P                  ! W\        P4                  4      e   EK  RpEK  	  V'       g   EK  \        P0                  ! R4      pVPS                  RV4      p V# 	   V#   + '       g   i     ELa; i  \B        \D        \F        3 dX   p\I        TR4      '       d<   TPJ                  \J        PL                  8w  d   \N        PQ                  RT,          4        R p?LR p?ii ; i  \B        \D        \T        3 d)   p\N        PQ                  RT: RT: 24        R p?T# R p?ii ; i)NFZ=Z#)Z
delimitersZinline_comment_prefixesZstrictT)Zraw z^$Zvirtz	virt-whatZsystem)Zno_errorZ/:r    i   NZprocesschassis_typeZsyspurpose_role)Zraise_on_errorroler   z/Failed to load the syspurpose										file: %sz\Failed to process 'syspurpose_role' in '%s'									, the syspurpose module is not availablez,[^,]*$zerror processing 'z', )+r   r   Zisfiler   ZstrZoptionxformopenZ	read_fileZsectionsZoptionsgetrematchr   ZexecuteZSr   ZSYSTEM_RELEASE_FILEZexistsprocfsZpidstatsZreload_threadsZlenZfind_by_regexZcompile_get_chassis_typeZ
IGNORECASEhave_syspurpose
syspurposer   ZSyspurposeStoreZUSER_SYSPURPOSEr   IOErrorr   ZKeyErrorZhasattrr   r   r   r   Zsubr   )r   Zfnamer   Zmatching_profileZsyspurpose_error_loggedZconfigZfZsectionr!   ZoptionZvalueZpsr   r   Zsr   rs   &&&              r	   r   Z!ProfileRecommender.process_config9   s   !C7
''..

SCQVW66Uq
Q 	//#wE..)ZZTZ2Ue&uXXe}-a0"$$8 8u8 H
XXe  "" 	! 	$$    u	 
 )s
WW^^F##288E  ("$$,0 ,0u,0 +
"??b	Rbjj/0	1Q	6u 
7
N
"++-lXXe2==99u :
%
%d	++				)	) ,  q	zz&! &		 35:; 	<"&	%r}}	-	5ue *h u	J	Qb'*
 
{ $z 
 	X * 1g177ell#:	  
" 7E	" 799E1566	7s   $Q ,Q O+AQ 	AQ A!Q =8Q 6AQ ;CQ Q 9Q #O0Q 9AQ Q )Q >Q O		Q Q-AP?:Q ?QQ RR  Rc                s   V P                   e3   \        P                  RV P                   ,          4       V P                   # . RNRNRNRNRNRNRNR	NR
NRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNR NR!NR"NR#NR$NR%NR&Np \        R'R(4      ;_uu_ 4       p\	        VP                  4       4      pR R R 4       VX,          V n         V P                   '       d3   \        P                  R+V P                   ,          4       V P                   #  \        P                  ! . R1O\        P                  \        P                  R,R-7      pVP                  4       w  rgVP                  '       d*   \        P                  R.VP                  V3,          4       M$VP!                  4       P#                  4       V n          V P                   '       g)   \        P                  R04       RV n         V P                   # \        P                  R+V P                   ,          4       V P                   #   + '       g   i     ELy; i  \         d!    \        P                  R)X,          4        EL\        \        3 d(   p\        P                  R*T,          4        R p?ELR p?ii ; i  \        \        3 d(   p\        P                  R/T,          4        R p?ELR p?ii ; i)2Nz"returning cached chassis type '%s'r   ZOtherZUnknownZDesktopzLow Profile Desktopz	Pizza Boxz
Mini TowerZTowerZPortableZLaptopZNotebookz	Hand HeldzDocking Stationz
All In OnezSub NotebookzSpace-savingz	Lunch BoxzMain Server ChassiszExpansion ChassiszSub ChassiszBus Expansion ChassiszPeripheral ChassiszRAID ChassiszRack Mount ChassiszSealed-case PCzMulti-systemZ
CompactPCIZAdvancedTCAZBladezBlade EnclosingZTabletZConvertibleZ
DetachablezIoT GatewayzEmbedded PCzMini PCzStick PCz(/sys/devices/virtual/dmi/id/chassis_typer'   z/Unknown chassis type id read from dmi sysfs: %dz"error accessing dmi sysfs file: %szchassis type - %sT)ZstdoutZstderrZ	close_fdsz,dmidecode finished with error (ret %d): '%s'z#error executing dmidecode tool : %sz!could not determine chassis type.)Z	dmidecodez-szchassis-type)r   r   Zdebugr   ZintZreadZ
IndexErrorr   r   r&   r   
subprocessZPopenZPIPEZcommunicateZ
returncodeZstripZdecode)r   ZDMI_CHASSIS_TYPESZsysfs_chassis_typeZchassis_type_idr   Zp_dmiZ
dmi_outputZ	dmi_errors   &       r	   r#   Z$ProfileRecommender._get_chassis_type   sw   	#991D4F4FFG


Yr Y7 YI Yy Y:O YQ\ Y^j Yls YYY'Y)4Y6GYIUYWeYY"Y$9Y;NYP]Y Y !5Y 7EY G[Y ]mY 	Y $	Y &3	Y 5<	Y >O	Y QY	Y
 Y
 #Y
 %2Y
 4AY
 CLY
 NXY97==AS,1134O 	> */:4 
99 4#5#556


:???:??5 #..0JII<@P@PR[?\\]#))+224D 
			99014 
		 99 4#5#556			E 	>== 
 R99>PQ
7	 9;;3a7889& 7	 :;;4q899:s[   I  "H,<I  BJ$ #J$ ,H=	7	I   'J!*J!9J!:JJ!$K5KK)r   r   r   N)F)T)
Z__name__Z
__module__Z__qualname__Z__firstlineno__r
   r   r   r#   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r	   r   r      s      
<GR0 0r   r   )r   r    r   r"   r(   Ztuned.utils.config_parserr   r   Zsyspurpose.filesr%   r$   Ztuned.constsr   Z
tuned.logsZtunedZtuned.utils.commandsr   Zlogsr   r   r   ) r   r	   <module>r)      sW    	 	    9   )jjnn^ ^s   A A 