+
    iG  c                   sJ    R t ^ RIt^ RIt^ RIt^ RIt^ RIHt  ! R R4      tR# )zifcfg file parserN)logc                   sP   a  ] tR t^t o R tR tR tR tR tR t	R t
R tR	tV tR
# )ifcfgc                sN    / V n         . V n        Wn        V P                  4        R # N)_config_deletedfilenameclear)selfr      &&;/usr/lib/python3.14/site-packages/firewall/core/io/ifcfg.py__init__Zifcfg.__init__   s     

    c                s"    / V n         . V n        R # r   )r   r   r      &r	   r   Zifcfg.clear   s    r   c                s:    V P                   P                  4        R # r   )r   r   r   r   r	   cleanupZifcfg.cleanup   s    r   c                sT    V P                   P                  VP                  4       4      # r   )r   getstrip)r   keyr   r	   r   Z	ifcfg.get    s    ||		,,r   c                s    VP                  4       pVP                  4       V P                  V&   W0P                  9   d   V P                  P                  V4       R # R # r   )r   r   r   remove)r   r   valueZ_keys   &&& r	   setZ	ifcfg.set#   sB    yy{"[[]T== MM  & !r   c                s    R pV P                   P                  4        F%  w  r#V'       d
   VR,          pW: RV: 2,          pK'  	  V# ) 
=)r   items)r   Zsr   r   s   &   r	   __str__Zifcfg.__str__)   sB    ,,,,.JCT	C''A / r   c                s   V P                  4         \        V P                  R 4      pT EFe  pT'       g    EM[TP                  4       p\        T4      ^8  g   T^ ,          R9   d   K?  TP                  R^4       Uu. uF  qDP                  4       NK  	  pp\        T4      ^8w  d   K  \        T^,          4      ^8  dL   T^,          P                  R4      '       d.   T^,          P                  R4      '       d   T^,          ^R T^&   T^,          R8X  d   K  T P                  P                  T^ ,          4      e4   \        P                  ! RT P                  TP                  4       4       EKH  T^,          T P                  T^ ,          &   EKh  	  TP                  4        R#   \         d)   p\        P
                  ! RT P                  T4       h Rp?ii ; iu upi )	ZrzFailed to load '%s': %sNr   "r   z%%s: Duplicate option definition: '%s')#Z;)r   openr   	Exceptionr    errorr   lensplit
startswithendswithr   r   Zwarningclose)r   fmsglineZxZpairs   &     r	   readZ
ifcfg.read2   sm   

	T]]C(A
 D::<D4y1}Q: 5'+zz#q'9:'9!GGI'9D:4yA~47|q T!W%7%7%<%<aAQAQRUAVAVq'!B-QAw"}!!$q'*6;T]]DJJL $(GDLLa!' ( 	
	1  	II/D	 ;s   F& =G&G1#GGc                s
   \        V P                  4      ^8  d   R# . p \        P                  ! RR\        P
                  P                  V P                  4      ,          \        P
                  P                  V P                  4      RR7      pRpRp \        P                  ! T P                  RRR	7      pT EF  pT'       g    EMTP                  R
4      p\        T4      ^8  d    T'       g   TP                  R
4       RpKM  KO  T^ ,          R8X  d'   RpTP                  T4       TP                  R
4       K  TP!                  R^4      p\        T4      ^8w  d   RpTP                  TR
,           4       K  T^ ,          P                  4       p	T^,          P                  4       p
\        T
4      ^8  d4   T
P#                  R4      '       d   T
P%                  R4      '       d   T
^R p
Y9  d   YP                  9   dH   T P                  T	,          T
8w  d0   RpTP                  T	: RT P                  T	,          : R
24       RpM-YP&                  9   d   RpMRpTP                  TR
,           4       TP)                  T	4       EK  RpEK  	   \        T P                  4      ^ 8  dQ   T P                  P-                  4        F2  w  rY9   d   K  T'       g   RpTP                  T	: RT
: R
24       RpK4  	  T'       d   TP/                  4        TP/                  4        T'       g#   \        P0                  ! TP2                  4       R# \        P
                  P+                  T P                  4      '       d4    \4        P6                  ! T P                  RT P                  ,          4        \4        P:                  ! TP2                  T P                  4       \        P<                  ! T P                  R4       R#   \         d$   p\        P                  ! RT,          4       h Rp?ii ; i  \         df   p\        P
                  P+                  T P                  4      '       d*   \        P                  ! RT P                  : RT: 24       h Rp Rp?EL	Rp?ii ; i  \         dC   p\        P0                  ! TP2                  4       \9        RT P                  : RT: 24      hRp?ii ; i  \         dC   p\        P0                  ! TP2                  4       \9        RT P                  : RT: 24      hRp?ii ; i)i   NZwtz%s.F)modeZprefixZdirZdeletez!Failed to open temporary file: %sZrtzUTF-8)r)   Zencodingr   Tr   r   r   zFailed to open 'z': z%s.bakzBackup of 'z
' failed: i  zFailed to create 'r   )r    r   tempfileZNamedTemporaryFileosZpathZbasenamer   Zdirnamer   r    r   ior   r   writer!   r"   r#   r   ZappendZexistsr   r$   r   ZnameshutilZcopy2ZIOErrorZmoveZchmod)r   ZdoneZ	temp_filer&   ZmodifiedZemptyr%   r'   Zpr   r   s   &          r	   r-   Zifcfg.writeP   s   t||q  		 33rww//>>GGOODMM2	I 2	(D7CA zz$'t9q= !- $ ! !W^!EOOD)OOD)

3*A1v{ %!t4 A$**,CaDJJLEE
a!,,S11!NN3// %a,,.4<<3D3M$)E%OOdll3>O>O,PQ'+H MM1'+H$)E%OOD4K8C(#'S X t||q "ll002
; ES% 89 3 GGIIIinn%77>>$--((RT]]Ht}},DE	+KK	6
 HHT]]E*u  	II9C?@	  	ww~~dmm,,		t}}cJK	N  R		)..)T]]CPQQR  	NIIinn%LMM	Nsa   A/O> #P/ =2R" 0+S2 >P,	P''P,/R:ARR"S/-=S**S/2T?==T::T?)r   r   r   N)Z__name__Z
__module__Z__qualname__Z__firstlineno__r
   r   r   r   r   r   r(   r-   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r	   r   r      s4     -'<i+ i+r   r   )	Z__doc__Zos.pathr+   r,   r*   r.   Zfirewall.core.loggerr    r   ) r   r	   <module>r/      s%      	   $g+ g+r   