+
    Ciq                         ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIHtH	t	H
t
 ^ RIHt ^ RIHt ^ RIHt ^ RIHtHtHt ] P*                  ! 4        Rt ! R	 R
]4      t ! R R]4      t ! R R]4      tR# )    N)
get_distro)SourceEntrySourcesListDeb822SourceEntry)suppress)gettext)urlparse)get_source_entry_from_listcopy_source_entrydeb822_source_entry_containsz=gpg -q --no-options --no-default-keyring --batch --keyring %sc                   4  a  ] tR t^+t o RtR.R lt]R 4       t]R 4       t]R 4       t	]R 4       t
]R 4       t]R	 4       t]R
 4       t]R 4       t]R 4       t]R 4       tR/R lt]R 4       t]R 4       tR tR tR tR tR tR t]R 4       t]R 4       t]R 4       t]R 4       tR tR t ]R 4       t!]R 4       t"]R 4       t#]R  4       t$]R! 4       t%R" t&R# t']R$ 4       t(]R% 4       t)]R& 4       t*]R' 4       t+]R( 4       t,R) t-R/R* lt.R/R+ lt/R, t0R-t1V t2R# )0ShortcutHandlera#  Superclass for shortcut handler implementations.

This provides a way to take a apt repository reference, in various forms,
and write the specific apt configuration to local files.  This also can
remove previously written configuration from local files.

This class and any subclasses should never modify any main apt configuration
files, only specifically named files in '.d' subdirs (e.g. sources.list.d, etc)
should be modified.  The only exception to that rule is adding or removing
sourceslist lines or components of existing source entries.
Nc                   Wn         T;'       g    . V n        W0n        \        4       V n        T;'       g    V P                  P
                  V n        WPn        W`n        Wpn        R V n	        R V n
        R V n        R V n        R # N)shortcut
componentsenable_sourcer   distrocodenamepocketdry_rundeb822_source_entry	_filebase	_username	_password)	selfr   r   r   r   r   r   r   kwargss	   &&&&&&&&,D/usr/lib/python3/dist-packages/softwareproperties/shortcuthandler.py__init__ShortcutHandler.__init__7   sn     $*** l 88DKK$8$8 "     c                X    \        V4      pVP                  ;'       d    VP                  # )z(Return if the uri is in valid uri format)r	   schemenetlocclsuriparseds   && r   is_valid_uriShortcutHandler.is_valid_uriK   s#     #}}...r"   c                    \        V4      pVP                  VP                  P                  R4      ^,          R7      P	                  4       # )z6Return the uri with the username and password stripped@r%   )r	   _replacer%   
rpartitiongeturlr&   s   && r   uri_strip_authShortcutHandler.uri_strip_authQ   s=     # fmm&>&>s&CA&FGNNPPr"   c                    \        V P                  V4      4      pV: RV: RVP                  : 2pVP                  VR7      P	                  4       # )z6Return the uri with the username and password included:r-   r.   )r	   r2   r%   r/   r1   )r'   r(   usernamepasswordr)   r%   s   &&&&  r   uri_insert_authShortcutHandler.uri_insert_authY   sC     #,,S12%x?f-4466r"   c           	        RpVR
,          p \         P                  ! 4       ;_uu_ 4       pVRV 2,          p\        V\        4      '       g   VP	                  4       p\
        P                  ! VP                  4       RV\
        P                  R7      P                  P                  4       pRRR4        XP                  4        Uu. uF3  qfP                  R4      '       g   K  TP                  R4      ^	,          NK5  	  up#   + '       g   i     L_; i  \
        P                   d(   p\        \        R4      T,          4       . u Rp?# Rp?ii ; iu upi   \          d!    \        \        R	4      X,          4       . u # i ; i)zReturn an array of fingerprint(s) for provided key(s).

The 'keys' parameter should be in text (str) or binary (bytes) format;
it is converted to bytes if needed, and then passed to the 'gpg' program.
zBgpg --show-keys -q --no-options --no-keyring --batch --with-colons --homedir T)checkinputstdoutNz,Warning: gpg error while processing keys:
%sfprr5   zWarning: invalid gpg output:
%sz& --with-fingerprint --with-fingerprint)tempfileTemporaryDirectory
isinstancebytesencode
subprocessrunsplitPIPEr>   decodeCalledProcessErrorprint_
splitlines
startswithKeyError)r'   keyscmdhomedirr>   els   &&     r   fingerprintsShortcutHandler.fingerprints`   s,    S((		,,..'WI..!$..;;=D#		4t/9@@Fvvx 	 /	-3->->-@X-@LLQVDWOAGGCLOO-@XX /. ,, 	!CDqHII	 Y 	!67&@AI	se   D BD+D 4E E#E?E D	D D E*EEEE (FFc           	         \        R V P                  4       P                  : RRP                  V P                  4       P                  4      : 24      # )zArchive for codename: z components: ,)rL   r   distjoincompsr   s   &r   descriptionShortcutHandler.description|   sA    ##%**88D,,.4457 8 	9r"   c                    V P                   # r   )archive_linkr\   s   &r   web_linkShortcutHandler.web_link   s       r"   c                6    V P                  4       P                  # r   )r   r(   r\   s   &r   r`   ShortcutHandler.archive_link   s    !%%%r"   c                x    V P                   '       d   V P                  : R V P                   : 2# V P                  # )-)r   r   r\   s   &r   rY   ShortcutHandler.dist   s(    ;;;"mmT[[99}}r"   c                .    V P                   P                  # )z*Text indicating a binary-type SourceEntry.)r   binary_typer\   s   &r   ri   ShortcutHandler.binary_type        {{&&&r"   c                .    V P                   P                  # )z*Text indicating a source-type SourceEntry.)r   source_typer\   s   &r   rm   ShortcutHandler.source_type   rk   r"   c                   V P                   '       g   \        R4      h\        V P                   4      pV'       g   V# WP                  8X  d   VP	                  R4       M>WP
                  8X  d   VP	                  V P                  4       M\        RV,          4      h\        V\        4      '       d
   V.Vn
        MWn        \        V4      # )a  Get the SourceEntry representing this archive/shortcut.

This should never include any authentication data; if required,
the username and password should only be available from the
username and password properties, as well as from the
netrcparts_content property.

If pkgtype is provided, it must be either binary_type or source_type,
in which case this returns a SourceEntry with the requested type.
If pkgtype is not specified, this returns a SourceEntry with an
implementation-dependent type (in most cases, implementations should
default to binary_type).

Note that the default SourceEntry will be returned without modification,
and the implementation will determine if it is enabled or disabled;
while the source-type SourceEntry will be enabled or disabled based on
self.enable_source.  The binary-type SourceEntry will always be enabled.

The SourceEntry 'file' field should always be set to the value of
sourceparts_file.
z3Implementation class did not set self._source_entryTzInvalid pkgtype: %s)r   NotImplementedErrorr   ri   set_enabledrm   r   
ValueErrorrB   r   typestype)r   pkgtyperS   s   && r   r   ShortcutHandler.SourceEntry   s    , !!!%&[\\d001H&&&MM$(((MM$,,-2W<==a*++iAGF ##r"   c                    V P                   # )a/  Return the username used for authentication

If authentication is used, return the username; otherwise return None.

By default, this returns the private variable self._username, which
defaults to None.  Subclasses should override this method and/or
set self._username if they have authentication data.
)r   r\   s   &r   r6   ShortcutHandler.username        ~~r"   c                    V P                   # )a/  Return the password used for authentication

If authentication is used, return the password; otherwise return None.

By default, this returns the private variable self._password, which
defaults to None.  Subclasses should override this method and/or
set self._password if they have authentication data.
)r   r\   s   &r   r7   ShortcutHandler.password   ry   r"   c                f    V P                  4        V P                  4        V P                  4        R# )zSave all data for this shortcut to file(s).

This writes everything to the relevant files.  By default, it
calls add_source(), add_key(), and add_login().  Subclasses
should override it if other actions are required.
N)
add_sourceadd_key	add_loginr\   s   &r   addShortcutHandler.add   s!     	r"   c                F    V P                  4        V P                  4        R# )a  Remove all data for this shortcut from file(s).

This removes everything from the relevant files.  By default, it
only calls remove_source() and remove_login().  Subclasses
should override it if other actions are required.  Note that by
default is does not call remove_key().
N)remove_sourceremove_loginr\   s   &r   removeShortcutHandler.remove   s     	r"   c                (   \        R R7      pRpV P                  V P                  4      pV F0  p\        V\        4      '       g   K  \        WC4      '       g   K.  Tp M	  Ve3   \        \        R4      V P                  VP                  3,          4       MVP                  RRR. V P                  R7      pVP                  Vn        VP                  Vn        VP                  Vn        VP                  Vn        V P                  '       dp   V P                  P!                  4       pV Uu. uF$  pRVP#                  4       '       d   TMR,           NK&  	  ppRRP%                  V4      ,           VP&                  R	&   TpV P(                  '       d   V P*                  \-        VP                  4      9  d   RpV P                  V P*                  4      pV F0  p\        V\        4      '       g   K  \        WG4      '       g   K.  Tp M	  Ve3   \        \        R4      V P*                  VP                  3,          4       MV P                  V P*                  .Vn        V P.                  '       Eg   \0        P2                  P5                  VP                  4      '       g   VP                  P7                  V P8                  4      '       dQ   \0        P2                  P5                  V P8                  4      '       g"   \0        P:                  ! V P8                  R
4       \=        VP                  R4      ;_uu_ 4        \0        P>                  ! VP                  V P@                  4       RRR4       VPC                  4        R# R# u upi   + '       g   i     L); i)Tr   NFound existing %s entry in %s file .
z	Signed-By  w)"r   r   ri   rB   r   r   rK   rL   r   r   sourceparts_filers   urissuitesr[   trustedparts_contentrM   striprZ   sectionr   rm   setr   ospathexistsrN   sourceparts_pathmkdiropenchmodsourceparts_modesave)r   sourceslistnewentrybinentryslinesrT   srcentrys   &       r   _add_deb822_source"ShortcutHandler._add_deb822_source   s   !.##D$4$45Aa!233+A88  !348H8H8@8G G H #r2r2,0,A,A ' CH%^^HN$MMHM&ooHO%^^HN(((11<<>BGH%QQWWYYC88%H04tyy7G0G  -$"2"2#hnn:M"MH''(8(89H !!%677/<< H ! #a78D<L<L<DMM<K K L #'"2"2D4D4D!E|||77>>(--00MM,,T-B-BCCGGNN4+@+@AAHHT22E:(----HHX]]D,A,AB . / I: .-s   *M<M<4,NN	c                L	   V P                   '       d   V P                  4        R# V P                  V P                  4      pV P                  V P                  4      pV P
                  p\        4       p\        WA4      pVe3   \        \        R4      VP                  VP                  3,          4       MYVP                  VP                  VP                  VP                  VP                  VP                  R7      pVP                   Vn        VP                  VP                  8w  d'   \        \        R4      VP                  ,          4       MVP"                  '       dA   \        R4      P                  Vn        \        \        R4      VP                  ,          4       MuVP                   '       d3   \        \        R4      VP                  VP                  3,          4       M1\        \        R4      VP                  VP                  3,          4       TpVP                  Vn        \        WB4      pVe3   \        \        R4      VP                  VP                  3,          4       MYVP                  VP                  VP                  VP                  VP                  VP                  R7      pVP                   Vn        VP                  VP                  8w  d'   \        \        R4      VP                  ,          4       MuVP                   '       d3   \        \        R4      VP                  VP                  3,          4       M1\        \        R4      VP                  VP                  3,          4       TpV P$                  '       Eg   \'        VP                  VP                  .4       F  p\(        P*                  P-                  V4      '       d   K*  VP/                  V P0                  4      '       dQ   \(        P*                  P-                  V P0                  4      '       g"   \(        P2                  ! V P0                  R	4       \5        VR
4      ;_uu_ 4        \(        P6                  ! Wc4       RRR4       K  	  VP9                  4        R# R#   + '       g   i     K  ; i)a  Add the apt SourceEntries.

This uses SourcesList to add the binary-type and source-type
SourceEntries.

If the SourceEntry matches a known apt template, this will ignore
the sourceparts_file and instead place the SourceEntries into
the main/default sources.list file.  Otherwise, this will add
the SourceEntries into the sourceparts_file.

If either the binary-type or source-type entry exist in the current
SourcesList, the existing entries are updated instead of placing
the entries in the sourceparts_file.
Nr   )r(   rY   r   rt   
orig_compsz+Updating existing entry instead of using %sr   z!Archive has template, updating %szAdding disabled %s entry to %szAdding %s entry to %sr   r   )r   r   r   ri   rm   r   r   r
   rK   rL   rt   r   r   r(   rY   r[   disabledtemplater   r   r   r   r   rN   r   r   r   r   r   )r   r   r   moder   r   	entryfiles   &      r   r}   ShortcutHandler.add_source,  s4    ;;;##%##D$4$45##D$4$45$$!m-kD!34x}}7UUV"LL]]]]]]#>> ' H !) 1 1H==HMM)!ABX]]RS'O00HM!788==HI!458VVW!+,x}}/MMN !-kD!34x}}7UUV"LL]]]]]]#>> ' H !) 1 1H==HMM)!ABX]]RS!458VVW!+,x}}/MMN||| (--!?@	ww~~i00!,,T-B-BCC "t/D/D E E!6!6>i--1 .- A   .--s   RR#c                \   \        R R7      pV P                  V P                  4      pV Ff  p\        V\        4      '       g   K  \        W24      '       g   K.  \        \        R4      VP                  ,          4       TpVP                  V4        M	  V P                  '       gj   VP                  4        V Uu. uF!  q3P                  VP                  8X  g   K  VNK#  	  up'       g$    \        P                  ! VP                  4       R# R# R# u upi   \        \        3 d     R# i ; i)Tr   zRemoving entry from %sN)r   r   ri   rB   r   r   rK   rL   r   r   r   r   r   OSErrorIOError)r   r   r   r   s   &   r   _remove_deb822_source%ShortcutHandler._remove_deb822_source  s    !.##D$4$45Aa!233+A88a01QVV<=""8,  |||*F{!ff.EAA{FFIIhmm, G F  ) s   :DD+ D D+*D+c                   V P                   '       d   V P                  4        R# \        4       p\        V Uu. uF  q"P                  NK  	  up4      pV P                  V P                  4      pV P                  V P                  4      pRVn        RVn        V FL  p\        WE.V4      f   K  \        \        R4      VP                  VP                  3,          4       RVn        KN  	  V Uu. uF!  qfP                  V P                  8X  g   K  VNK#  	  ppV Uu. uF,  q"P                  '       d   K  VP                  '       d   K*  VNK.  	  up'       g^   V FW  pVP                  '       g2   \        \        R4      VP                  VP                  3,          4       VP                  V4       KY  	  V P                   '       g\   VP#                  4        T\        V Uu. uF  q"P                  NK  	  up4      ,
           F  p \$        P                  ! V4       K  	  R# R# u upi u upi u upi u upi   \&        \(        3 d     KJ  i ; i)a.  Remove the apt SourceEntries.

This uses SourcesList to remove the binary-type and source-type
SourceEntries.

This must disable the corresponding SourceEntries, from whatever file(s)
they are located in.  This must not disable more than matches, e.g.
if the existing SourceEntry line contains more components this must
edit the existing line to remove this SourceEntry's component(s).

After disabling all matching SourceEntries, if the sourceparts_file is
empty or contains only invalid and/or disabled SourceEntries, this
may remove the sourceparts_file.
NFzDisabling %s entry in %sTz"Removing disabled %s entry from %s)r   r   r   r   r   r   ri   rm   r   r
   rK   rL   rt   r   invalidr   r   r   r   r   r   )	r   r   rS   
orig_filesr   r   r   file_entriesr   s	   &        r   r   ShortcutHandler.remove_source  s    ;;;&&(!m+6+Q&&+67
##D$4$45##D$4$45!!A)8*=qAMa23qvvqvv6FFG!
 
 $/R;a&&D<Q<Q2Q;R'L<ayy<LL!yyy!@AQVVQVVDTTU""1% "
 |||"S+)F+Q&&+)F%GGGIIdO H + 7 SL *G  ) s;   H!-H&H&H+2H+H+H0
H55I
	I
c                @    \         P                  P                  R4      # )zAReturn result of apt_pkg.config.find_dir("Dir::Etc::sourceparts")zDir::Etc::sourcepartsapt_pkgconfigfind_dirr\   s   &r   r    ShortcutHandler.sourceparts_path  s     ~~&&'>??r"   c                f    V P                   '       d   RMRpV P                  WP                  R7      # )aA  Get the sources.list.d filename, without the leading path.

By default, this combines the filebase with the codename, and uses a
extension of 'list' if deb822 is not enabled, and 'sources' if deb822
is enabled.  This is different than the trustedparts or
netrcparts filenames, which use only the filebase plus extension.
sourceslistsuffix)r   _filebase_to_filenamer   )r   exts   & r   sourceparts_filename$ShortcutHandler.sourceparts_filename  s+      ;;;iF))#mm)DDr"   c                N    V P                  V P                  V P                  4      # )a  Get the sources.list.d absolute-path filename.

Note that the add_source() function will not use this file if this shortcut's
SourceEntry matches a known apt template; instead the entries will be placed
in the main sources.list file.  Also, if the SourceEntry already exists in
the SourcesList, it will be edited in place, instead of using this file.
See add_source() for more details.
)_filename_to_filer   r   r\   s   &r   r    ShortcutHandler.sourceparts_file  s#     %%d&;&;T=V=VWWr"   c                    R# )zMode of sourceparts file.

Note that add_source() will only use this mode if it creates a new file
for sourceparts_file; if the file already exists or if the SourceEntry is
saved in a different file, this mode is not used.
   r\   s   &r   r    ShortcutHandler.sourceparts_mode  s     r"   c                   V P                   '       d   R# \        V P                  V P                  34      '       g   R# V P                  pV P                  p\	        V\
        4      '       g   VP                  4       pV P                  V4      p\        \        R4      VRP                  V4      3,          4       \        V,          pRpV P                  '       EgF   \        P                  P                  V4      '       g   VP!                  V P"                  4      '       dR   \        P                  P                  V P"                  4      '       g#   \        P$                  ! V P"                  RR7       V P&                  '       d>   \)        VR4      ;_uu_ 4        \        P*                  ! WP&                  4       RRR4        \,        P.                  ! 4       ;_uu_ 4       pVRV R	V 2,          p\0        P2                  ! VP5                  4       R
VR7       RRR4       R# R#   + '       g   i     Lq; i  + '       g   i     R# ; i  \0        P6                   d   p\9        T4      hRp?ii ; i)a+  Add the GPG key(s) corresponding to this repo.

By default, if self.trustedparts_content contains content,
and self.trustedparts_file points to a file, the key(s) will
be added to the file.

If the file does not yet exist, and self.trustedparts_mode is set,
the file will be created with that mode.
Nz$Adding key to %s with fingerprint %srX   z--importr   r   wbr;   r   T)r<   r=   )r   alltrustedparts_filer   rB   rC   rD   rU   rK   rL   rZ   GPG_KEYRING_CMDr   r   r   r   rN   trustedparts_pathr   trustedparts_moder   r   r@   rA   rE   rF   rG   rJ   ShortcutException)r   destrP   fprQ   actionrR   rS   s   &       r   r~   ShortcutHandler.add_key  s    ;;;D**D,E,EFGG%%(($&&;;=Dt$a674":NNO$|||77>>$''OOD$:$:;;GGNN4+A+ABBHHT33%@)))dD))'='=> *+0022g[	6(;;CNN399;d$G 32  *) 322 00 +'**+sB   !H"I	 7H5I	 "H2	5I	 I	 I	 	I.I))I.c                   \        V P                  V P                  34      '       g   R# V P                  pV P                  V P                  4      p\        P
                  P                  V4      '       g   R# \        \        R4      VRP                  V4      3,          4       \        V,          pRRP                  V4      ,          pV P                  '       g    \        P                  ! 4       ;_uu_ 4       pVRV RV 2,          p\        P                  ! VP!                  4       RR7       RRR4       \'        TR	4      ;_uu_ 4       pT P                  TP)                  4       4      '       * pRRR4       X'       d   \        P*                  ! T4       R# R# R#   + '       g   i     Lu; i  \        P"                   d   p\%        T4      hRp?ii ; i  + '       g   i     Lo; i)
a  Remove the GPG key(s) corresponding to this repo.

By default, if self.trustedparts_content contains content,
and self.trustedparts_file points to a file, the key(s) will
be removed from the file.

If the file contains no more keys after removal, the file will
be removed.

This does not consider other files; multiple repositories may
use the same signing key.  This only modifies/removes
self.trustedparts_file.
Nz(Removing key from %s with fingerprint %srX   z--delete-keys %sr   r;   T)r<   rb)r   r   r   rU   r   r   r   rK   rL   rZ   r   r   r@   rA   rE   rF   rG   rJ   r   r   readr   )	r   r   r   rQ   r   rR   rS   femptys	   &        r   
remove_keyShortcutHandler.remove_key  s^    D**D,E,EFGG%%t889ww~~d##a:;tSXXb\>RRS$#chhrl2|||+0022g[	6(;;CNN399;d; 3 dD!!Q --affh77 "		$  22 00 +'**+ "!sB   F/ 96F/F/ %GF,	'F/ ,F/ /GGGG'	c                @    \         P                  P                  R4      # )zBReturn result of apt_pkg.config.find_dir("Dir::Etc::trustedparts")zDir::Etc::trustedpartsr   r\   s   &r   r   !ShortcutHandler.trustedparts_pathG  s     ~~&&'?@@r"   c                $    V P                  R4      # )z9Get the trusted.gpg.d filename, without the leading path.gpgr   r\   s   &r   trustedparts_filename%ShortcutHandler.trustedparts_filenameL  s     ))%00r"   c                N    V P                  V P                  V P                  4      # )z-Get the trusted.gpg.d absolute-path filename.)r   r   r   r\   s   &r   r   !ShortcutHandler.trustedparts_fileQ  s#     %%d&<&<d>X>XYYr"   c                    R# )z&Content to put into trusted.gpg.d fileNr   r\   s   &r   r   $ShortcutHandler.trustedparts_contentV  s     r"   c                    R# )zMode of trustedparts filer   r   r\   s   &r   r   !ShortcutHandler.trustedparts_mode[       r"   c                   \        V P                  V P                  34      '       g   R# V P                  pV P                  p\        P                  P                  V4      '       * pRpV'       g   \        VR4      ;_uu_ 4       pVP                  4        Uu. uF  qfP                  4       NK  	  ppRRR4       \        \        4      ;_uu_ 4        XR
,          R
,          pRRR4       \        VP                  4        Uu. uF  qfP                  4       X9   NK  	  up4      '       d   \        \        R4      V,          4       R# \        \        R4      V,          4       V P                  '       Eg   V'       d   VP                  V P                   4      '       dR   \        P                  P                  V P                   4      '       g#   \        P"                  ! V P                   RR7       V P$                  '       d>   \        VR4      ;_uu_ 4        \        P&                  ! WP$                  4       RRR4       \        VR	4      ;_uu_ 4       pVR8w  d   VP)                  R4       VP)                  V P                  4       RRR4       R# R# u upi   + '       g   i     EL; i  + '       g   i     EL; iu upi   + '       g   i     L; i  + '       g   i     R# ; i)zAdd the login credentials corresponding to this repo.

By default, if self.netrcparts_content contains content,
and self.netrcparts_file points to a file, the file will be
created and content placed into it.
Nr   rz!Authentication data already in %sz Adding authentication data to %sr   r   r   a)r   netrcparts_filenetrcparts_contentr   r   r   r   	readlinesr   r   rO   rM   rK   rL   r   rN   netrcparts_pathr   netrcparts_moder   write)r   r   contentnewfile	finalcharr   rT   r   s   &       r   r   ShortcutHandler.add_login`  s    D(($*A*ABCC##))ggnnT**	dCA,-KKM:MqM: !(##!"IbM	 $0B0B0DE0D1GGI&0DEFFa;<tCDa23d:;|||OOD$8$899GGNN4+?+?@@HHT11>'''dC';';< )dCA$GGDM//0	 !  ; !###E ) sH   JJ/JJ) J=!K4KJJ&	)J:	K	K&	c           	        \        V P                  V P                  34      '       g   R# V P                  p\        V P                  P	                  4        Uu. uF  q"P                  4       NK  	  up4      p\        P                  P                  V4      '       g   R# \        VR4      ;_uu_ 4       p\        VP                  4        Uu. uF  q"P                  4       NK  	  up4      pRRR4       XV,          '       g   \        \        R4      V,          4       Mp\        \        R4      V,          4       V P                  '       gD   \        VR4      ;_uu_ 4       pVP                  RP                  WS,
          4      4       RRR4       V P                  '       gc   \        VR4      ;_uu_ 4       pVP!                  4       P                  4       '       * pRRR4       X'       d   \        P"                  ! V4       R# R# R# u upi u upi   + '       g   i     EL,; i  + '       g   i     L; i  + '       g   i     Le; i)av  Remove the login credentials corresponding to this repo.

By default, if self.netrcparts_content contains content,
and self.netrcparts_file points to a file, the content will
be removed from the file.

If the file is empty (other than whitespace) after removal, the file
will be removed.

This does not consider other files; this only modifies/removes
self.netrcparts_file.
Nr   z'Authentication data not contained in %sz$Removing authentication data from %sr   r   )r   r   r   r   rM   r   r   r   r   r   r   rK   rL   r   r   rZ   r   r   )r   r   rT   r   r   filecontentr   s   &      r   r   ShortcutHandler.remove_login  s{    D(($*A*ABCC##$*A*A*L*L*NO*NQwwy*NOPww~~d##$__!++-@-Qwwy-@AK W$$!=>EF!:;dBC<<<$__GGDIIk&;<= % |||dCAFFHNN,, !		$   P A __ %_ !s<   H1H	H!H'H1$H2HH	H/	2I	c                @    \         P                  P                  R4      # )z@Return result of apt_pkg.config.find_dir("Dir::Etc::netrcparts")zDir::Etc::netrcpartsr   r\   s   &r   r   ShortcutHandler.netrcparts_path  s     ~~&&'=>>r"   c                $    V P                  R4      # )z7Get the auth.conf.d filename, without the leading path.confr   r\   s   &r   netrcparts_filename#ShortcutHandler.netrcparts_filename  s     ))&11r"   c                N    V P                  V P                  V P                  4      # )z+Get the auth.conf.d absolute-path filename.)r   r   r  r\   s   &r   r   ShortcutHandler.netrcparts_file  s#     %%d&:&:D<T<TUUr"   c                J   \        V P                  V P                  34      '       g   R# \        V P	                  4       P
                  4      P                  p\        V P	                  4       P
                  4      P                  pRV V RV P                   RV P                   2# )zContent to put into auth.conf.d file

By default, if both username and password are set, this will return a proper
netrc-formatted line with the authentication information, including the
hostname and path.
Nzmachine z login z
 password )r   r6   r7   r	   r   r(   hostnamer   )r   r  r   s   &  r   r   "ShortcutHandler.netrcparts_content  s     DMM4==122D,,.223<<((*../44(D6z$--YYr"   c                    R# )zMode of netrcparts filei  r   r\   s   &r   r   ShortcutHandler.netrcparts_mode  r   r"   c                   V P                   '       d   \        WP                  R7      pM\        WP                  R7      p\	        \        VP                  4      \        V P                  4      ,          4      Vn        \        V4      V n	        R# )zSet the SourceEntry.

This should be called from subclasses to set the SourceEntry.
The SourceEntry file will be set to the sourceparts_file value.

The self.components, if any, will be added to the line's component(s).
r   N)
r   r   r   r   r   r   r[   r   r   r   )r   linerS   s   && r   _set_source_entry!ShortcutHandler._set_source_entry  s\     ;;;!$-B-BCAD'<'<=As177|c$//&::;.q1r"   c                    V P                   pV'       g   R # V'       d   VRV,          ,          p\        P                  ! RRVP                  4       4      # )Nz-%sz[^a-z0-9_-]+rL   )r   resublower)r   r   bases   && r   _encode_filebase ShortcutHandler._encode_filebase  s;    ~~EFN"Dvvnc4::<88r"   c                L    V P                  VR 7      pV'       g   R# V: RV: 2# )r   Nr   )r  )r   r   r   r  s   &&& r   r   %ShortcutHandler._filebase_to_filename  s&    $$F$3$$r"   c                T    V'       g   R # \         P                  P                  W4      # r   )r   r   rZ   )r   r   names   &&&r   r   !ShortcutHandler._filename_to_file  s    ww||D''r"   )r   r   r   r   r   r   r   r   r   r   r   r   )NFNNFFr   )3__name__
__module____qualname____firstlineno____doc__r    classmethodr*   r2   r8   rU   propertyr]   ra   r`   rY   ri   rm   r   r6   r7   r   r   r   r}   r   r   r   r   r   r   r~   r   r   r   r   r   r   r   r   r   r  r   r   r   r  r  r   r   __static_attributes____classdictcell__)__classdict__s   @r   r   r   +   s    
( / /
 Q Q 7 7  6 9 9
 ! ! & &  
 ' ' ' ''$R 	 	 	 			9vXt,/b @ @ 	E 	E 	X 	X  )+V& P A A 1 1 Z Z    &1P$ L ? ? 2 2 V V Z Z  2 9%( (r"   r   c                       ] tR tRtRtRtR# )r   i  z-General Exception during shortcut processing.r   Nr!  r"  r#  r$  r%  r(  r   r"   r   r   r     s    7r"   r   c                       ] tR tRtRtRtR# )InvalidShortcutExceptioni  zInvalid shortcut.

This should only be thrown from the constructor of a ShortcutHandler
subclass, and only to indicate that the provided shortcut is invalid
for that ShortcutHandler class.
r   Nr,  r   r"   r   r.  r.    s     	r"   r.  )r   r   r  rE   r@   aptsources.distror   aptsources.sourceslistr   r   r   
contextlibr   r   rL   urllib.parser	   softwareproperties.sourceutilsr
   r   r   initr   objectr   	Exceptionr   r.  r   r"   r   <module>r7     sl   $  	 	   ( P P    !J J
 QG(f G(T		 	
	0 	r"   