
    {i                        S r SSKJr  SSKrSSKrSSKrSSKJr  SSKJ	r	  SSK
Jr  SSKJr   " S	 S
5      r " S S5      rg)zAProvides the code to load PRAW's configuration file ``praw.ini``.    )annotationsN)Path)Lock)Any   )ClientExceptionc                  ,    \ rS rSrSS jr\rSS jrSrg)_NotSet   c                    g)NF selfs    E/home/james-whalen/.local/lib/python3.13/site-packages/praw/config.py__bool___NotSet.__bool__   s        c                    g)NNotSetr   r   s    r   __str___NotSet.__str__   s    r   r   N)returnboolr   str)__name__
__module____qualname____firstlineno__r   __nonzero__r   __static_attributes__r   r   r   r
   r
      s     Kr   r
   c                      \ rS rSrSrSr\" 5       r\" 5       r	\
R                  \
R                  S.r\SS j5       r\SS.SS jj5       r\SS j5       r S     SS	 jjrSS
 jrSS.     SS jjrSS jrS rSrg)Config   z7A class containing the configuration for a Reddit site.N)basicextendedc                V    [        U [        5      (       a  U $ U R                  5       S;   $ )N>   1onyestrue)
isinstancer   lower)items    r   _config_booleanConfig._config_boolean$   s&    dD!!Kzz|999r   config_interpolationc                  Ub  U R                   U   " 5       nOSn[        R                  " US9n[        [        R
                  [           R                  5      R                  nS[        R                  ;   a  [        [        R                  S   5      nOgS[        R                  ;   a  [        [        R                  S   5      nO6S[        R                  ;   a   [        [        R                  S   5      S-  nOSn[        US-  5      S/nUb  UR                  S[        US-  5      5        UR                  U5        X0l        g)	z5Attempt to load settings from various praw.ini files.N)interpolationAPPDATAXDG_CONFIG_HOMEHOMEz.configzpraw.inir   )INTERPOLATION_LEVELconfigparserConfigParserr   sysmodulesr   __file__parentosenvironr   insertreadCONFIG)clsr2   interpolator_classconfig
module_diros_config_path	locationss          r   _load_configConfig._load_config*   s     +!$!8!89M!N!P!%**9KL#++h/889@@


"!"**Y"78N"**,!"**->"?@Nrzz!!"**V"45	AN!Nj01:>	%QNZ$? @AI
r   c                f    U R                   U R                  L a  Sn[        U5      eU R                   $ )zMReturn the short url.

:raises: :class:`.ClientException` if it is not set.

zNo short domain specified.)
_short_urlCONFIG_NOT_SETr   )r   msgs     r   	short_urlConfig.short_urlF   s0     ??d111.C!#&&r   c                   [         R                     [         R                  c  U R                  US9  SSS5        X0l        [        [         R                  R                  U5      40 UD6U l        S=U l        =U l	        U l
        S=U l        =U l        U l        S=U l        =U l        U l        U R#                  5         g! , (       d  f       N= f)z'Initialize a :class:`.Config` instance.Nr1   )r#   LOCKrC   rJ   	_settingsdictitemscustom	client_idclient_secret	oauth_url
reddit_urlrefresh_tokenredirect_uripassword
user_agentusername_initialize_attributes)r   	site_namer2   settingss       r   __init__Config.__init__R   s     [[}}$!!7K!L  "6==..y9FXF?CCC+dnCGGG$,t/@:>>>$-##% [s   !B>>
Cc                >    U R                   U   nU R                   U	 U$ N)rW   )r   keyvalues      r   _fetchConfig._fetchf   s!    C KKr   defaultc               F    XR                   ;  a  U$ U R                  U5      $ rg   )rW   rj   )r   rh   rm   s      r   _fetch_defaultConfig._fetch_defaultk   s"     kk!N{{3r   c                    XR                   ;   a  U R                  U5      $ [        R                  " SU 35      nU R	                  U5      nU=(       d    U=(       d    U R
                  $ )Npraw_)rT   rj   r?   getenvro   rN   )r   rh   	env_value	ini_values       r   _fetch_or_not_setConfig._fetch_or_not_setr   sW    .. ;;s##IIcUm,	'',	 <I<)<)<<r   c                   U R                  S5      =(       d    U R                  U l        U R                  U R                  SSS95      U l        U R                  U R                  S5      5      U l        U R                  U R                  SSS95      U l        U R                  U R                  SSS95      U l        U R                  SS	S9U l	        S
 Vs0 s H  nXR                  U S35      _M     snU l        S H  n[        XU R                  U5      5        M      S H  n[        XU R                  U5      5        M      [        [        S.R                  5        H!  u  p$ [        XU" [        X5      5      5        M#     g s  snf ! [          a,    SU SUR"                   S[        X5       S3n[!        U5      S ef = f)NrP   check_for_asyncTrl   check_for_updateswarn_comment_sortwarn_additional_fetch_paramswindow_sizeiX  )commentmessageredditor
submission	subreddittrophy_kind)rX   rY   r]   r\   r^   r_   r`   )rZ   ratelimit_secondsr[   timeout)r   r   z.An incorrect config type was given for option z. The expected type is z, but the given value is .)ro   rN   rM   r/   ry   rv   rz   r{   r|   r}   rj   kindssetattrintrV   getattr
ValueErrorr   )r   x	attributerequired_attribute
conversionrO   s         r   ra   Config._initialize_attributes|   s   --k:Qd>Q>Q#33 14@ 
 "&!5!5""#67"
 "&!5!5 3TB"
 -1,@,@ >M-
)  ..}c.J

 {{aS;''



I DT%;%;I%FG
#
 Ddkk:L.MN#
 "%&
 %'&!I0GD4L)MN&?

J  0FykQhisi|i|h}  ~W  X_  `d  Xp  Wq  qr  s o4/0s   F#F6F>)rT   rM   ry   rz   rX   rY   rW   r   rZ   r^   r[   r]   r\   r_   r`   r|   r{   r}   )r.   z
bool | strr   r   )r2   
str | Noner   rg   )rb   r   r2   r   rc   r   )rh   r   r   r   )rh   r   rm   zbool | float | str | Noner   r   )rh   r   r   zAny | _NotSet)r   r   r   r   __doc__rC   r
   rN   r   rS   r9   BasicInterpolationExtendedInterpolationr8   staticmethodr/   classmethodrJ   propertyrP   rd   rj   ro   rv   ra   r!   r   r   r   r#   r#      s    AFYN6D00 66
 : :
 @D  6 	 	 ,0&& )& 	&( AE  $= 	 =60r   r#   )r   
__future__r   r9   r?   r;   pathlibr   	threadingr   typingr   
exceptionsr   r
   r#   r   r   r   <module>r      s6    G "  	 
    ' Y0 Y0r   