+
    "i                       R t ^ RIHt ^ RIHt ^ RIHtHt ^ RIt^ RIt^ RI	t	^ RI
t
^ RIHtHt ^ RIt^ RIHtHtHt ^ RIHt ^ RIt^ RIHtHt ^R	IHt ^R
IHtHt ^RI H!t!H"t"H#t#H$t$ ^RI%H&t& ^RI'H(t( ^RI)H*t* ^RI+H,t, ^RI-H.t.H/t/H0t0 ^RI1H2t2 ^RI3H4t4 ^RI5H6t6 ^RI7H8t8 ^RI9H:t: ^RI;H<t< ^RI=H>t> ^RI?H@t@HAtA ^RIBHCtC ^RIDHEtEHFtF ^RIGHHtH ]'       d   ^RIIHJtJ R/tKR0R1R2R3R4R5R6R7R8R9R:R;R<R. 33tLR. 3R=3tM ! R R 4      tN]P                  ! R!R"7       ! R# R$4      4       tP]P                  ! R!R"7       ! R% R&4      4       tQ ! R' R(4      tR ! R) R*4      tS ! R+ R,4      tT ! R- R.4      tUR# )>zRepository.)annotations)sleep)UTCdatetimeN)TYPE_CHECKINGAny)AIOGitHubAPIException AIOGitHubAPINotModifiedExceptionGitHubReleaseModel)AIOGitHubAPIRepository)device_registryissue_registry)DOMAIN)HacsDispatchEventRepositoryFile)HacsExceptionHacsNotModifiedExceptionHacsRepositoryArchivedExceptionHacsRepositoryExistException)DownloadableContent)Backup)decode_content)
concurrent)async_existsasync_removeasync_remove_directory)!filter_content_return_one_of_type)GET_REPOSITORY_RELEASES)
json_loads)LOGGER)is_safe)QueueManager)async_remove_store)github_archivegithub_release_asset)Validate)'version_left_higher_or_equal_then_rightversion_left_higher_then_right)DOMAIN_OVERRIDES)HacsBasetopicscountryc                       ] tR t^tRtR tRtR# )FileInformationzFileInformation.c                	*    Wn         W n        W0n        R # N)download_urlpathname)selfurlr1   r2   s   &&&&3/config/custom_components/hacs/repositories/base.py__init__FileInformation.__init__   s    		    )r0   r2   r1   N)__name__
__module____qualname____firstlineno____doc__r6   __static_attributes__ r8   r5   r-   r-      s
    r8   r-   T)auto_attribsc                  *   ] tR t^t$ RtRtR]R&   . tR]R&   RtR]R	&   Rt	R]R
&   Rt
R]R&   RtR]R&   RtR]R&   ^ tR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   ^ tR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   ^ tR]R &   RtR]R!&   RtR]R"&   RtR]R#&   ^ tR]R$&   Rt R]R%&   . t!R]R&&   Rt"R]R'&   Rt#R]R(&   Rt$R]R)&   ^ t%R]R*&   . t&R]R+&   ]'R, 4       t(R- t)]*R3R. R/ ll4       t+R3R0 R1 llt,R2t-R# )4RepositoryDatazRepositoryData class.Fboolarchived	list[str]authors strcategoryconfig_flowNdefault_branchdescriptiondomainint	downloadsetag_repositoryetag_releases	file_namefirst_install	full_namehideT
has_issuesidinstalled_commitinstalled_version	installedlast_commitr   last_fetchedlast_updatedlast_versionmanifest_namenewopen_issues
prereleasepublished_tagsreleasesselected_tag	show_betastargazers_countr*   c                    V P                   R8X  d   V P                  # V P                  P                  R4      R,          # )zReturn the name.integration/)rI   rM   rT   splitr3   s   &r5   r2   RepositoryData.name   s4     ==M);;~~##C(,,r8   c                4    \         P                  ! V R R7      # )Export to json.c                     V P                   R 8g  # )r\   r2   )attrvalues   &&r5   <lambda>(RepositoryData.to_json.<locals>.<lambda>   s    DII<Wr8   )filterrs   asdictrm   s   &r5   to_jsonRepositoryData.to_json   s    {{4(WXXr8   c               $    V ^8  d   QhRRRRRR/# )   sourcedictactionrC   returnrB   r?   )formats   "r5   __annotate__RepositoryData.__annotate__   s!       t  r8   c                <    \        4       pVP                  W4       V# )Set attributes from dicts.)rB   update_data)r~   r   datas   && r5   create_from_dictRepositoryData.create_from_dict   s     (r8   c               $    V ^8  d   QhRRRRRR/# )r}   r   r   r   rC   r   Noner?   )r   s   "r5   r   r      s!     * * *d *t *r8   c           
     (   VP                  4        F  w  r4W0P                  9  d   K  VR8X  d>   \        V\        4      '       d(   \	        W\
        P                  ! V\        4      4       K[  VR8X  d   \	        W\        V4      4       Ky  VR8X  d4   \        V\        4      '       d   \	        WV.4       K  \	        WV4       K  VR8X  d3   V'       g+   \	        YV Uu. uF  qU\        9  g   K  VNK  	  up4       K  \	        WV4       K  	  R# u upi )zUpdate data of the repository.r\   rW   r+   r*   N)
items__dict__
isinstancefloatsetattrr   fromtimestampr   rH   TOPIC_FILTER)r3   r   r   keyrt   topics   &&&   r5   r   RepositoryData.update_data   s    **,JC--'n$E5)A)A8#9#9%#EF3u:.	!eS))Dw/Du-u#Zue\@YEEu#Z[ 5)# ' $[s   D.Dr?   F).r9   r:   r;   r<   r=   rD   __annotations__rF   rI   rJ   rK   rL   rM   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   r*   propertyr2   rz   staticmethodr   r   r>   r?   r8   r5   rB   rB      s   HdGYHcKNCKFCIsOSM3IsM4IsD$JBK c !s!ItK!L(!L#L#M3CKJ "NI"HdL#ItcFI- -Y  * *r8   rB   c                      ] tR t^t$ RtRtR]R&   . tR]R&   RtR]R	&   Rt	R]R
&   Rt
R]R&   RtR]R&   / tR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   R t]R R l4       tR R ltRtR# )HacsManifestzHacsManifest class.FrC   content_in_rootrE   r+   NrH   filenamehacshide_default_branchhomeassistantr   manifestr2   persistent_directoryrender_readmezip_releasec                .    \         P                  ! V 4      # )rp   rx   rm   s   &r5   to_dictHacsManifest.to_dict   s    {{4  r8   c                   V ^8  d   QhRR/# )r}   r   r   r?   )r   s   "r5   r   HacsManifest.__annotate__   s      D r8   c                   V f   \        R4      h\        4       pV P                  4        UUu/ uF0  w  r#W!P                  9   g   K  W1P	                  V4      8w  g   K.  W#bK2  	  uppVn        VP
                  P                  4        FO  w  rEVR8X  d&   \        V\        4      '       d   \        WV.4       K1  WAP                  9   g   KC  \        WV4       KQ  	  V# u uppi )r   zMissing manifest datar+   )	r   r   r   r   __getattribute__r   r   rH   r   )r   manifest_datakvr   rt   s   &     r5   	from_dictHacsManifest.from_dict   s      788$ !("
(*** /04R4RST4U/U AD("
 (00668JCiJuc$:$:UG4...E2	 9
 "
s   CCCc                    V ^8  d   QhRRRR/# )r}   r   r   r   r   r?   )r   s   "r5   r   r     s     * * * *r8   c                    VP                  4        F]  w  r#W P                  9  d   K  VR8X  d4   \        V\        4      '       d   \	        WV.4       KC  \	        WV4       KQ  \	        WV4       K_  	  R# )zUpdate the manifest data.r+   N)r   r   r   rH   r   )r3   r   r   rt   s   &&  r5   r   HacsManifest.update_data  sV    **,JC--'ieS))Dw/Du-5) 'r8   r?   )r9   r:   r;   r<   r=   r   r   r+   r   r   r   r   r   r2   r   r   r   r   r   r   r   r>   r?   r8   r5   r   r      s    !OT!GYHcD# %%M3HdD# $#$M4K!  &* *r8   r   c                  >    ] tR tRt$ RtRtRt. t. tR]	R&   Rt
RtRtR# )RepositoryReleasesi  zRepositoyReleases.Nlist[GitHubReleaseModel]objectsFr?   )r9   r:   r;   r<   r=   last_releaselast_release_objectrc   r   r   rd   rO   r>   r?   r8   r5   r   r     s*    LN(*G%*HIr8   r   c                  8    ] tR tRt$ RtRtR]R&   RtR]R&   RtR# )RepositoryPathi  zRepositoryPath.N
str | Nonelocalremoter?   )	r9   r:   r;   r<   r=   r   r   r   r>   r?   r8   r5   r   r     s    E:FJr8   r   c                  6    ] tR tRt$ RtRtR]R&   . t. tRt	Rt
R# )RepositoryContenti"  zRepositoryContent.NzRepositoryPath | Noner1   Fr?   )r9   r:   r;   r<   r=   r1   r   filesr   singler>   r?   r8   r5   r   r   "  s    "&D
&EGFr8   r   c                     ] tR tRtRtR R ltR R lt]R R l4       t]R	 R
 l4       t	]R R l4       t
]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       tR R lt]! ^
^R7      RrR  R! ll4       tRsR" R# lltR$ R% lt]! ^
^R7      RtR& R' ll4       tR( R) ltR* R+ ltRuR- R. lltR/ tRuR0 R1 lltR2R,/R3 R4 lltR5 R6 ltR7 R8 lt R9 R: lt!R; R< lt"]! ^
R=7      RuR> R? ll4       t#R@ RA lt$RB RC lt%RD RE lt&R2R,/RF RG llt'RH RI lt(RJ t)RK t*RL RM lt+R2R,/RN RO llt,RuRP RQ llt-RR RS lt.RT RU lt/RvRV RW llt0RwRX RY llt1RZ R[ lt2RuR\ R] llt3]! ^
R=7      R^ R_ l4       t4R` Ra lt5Rb Rc lt6RdR,R2R,/Re Rf llt7Rg Rh lt8Ri Rj lt9RkR,/Rl Rm llt:Rn^/Ro Rp llt;Rqt<R,# )xHacsRepositoryi+  zHacsRepository.c                    V ^8  d   QhRRRR/# )r}   r   r)   r   r   r?   )r   s   "r5   r   HacsRepository.__annotate__.  s      X $ r8   c                   Wn         RV n        \        4       V n        \	        4       V n        \        4       V P
                  n        RV n        RV n	        RV n
        RV n        / V n        \        P                  / 4      V n        \!        4       V n        \%        4       V n        RV n        . V n        . V n        RV n        \0        V n        R# )zSet up HacsRepository.rG   NF)r   additional_inforB   r   r   contentr   r1   repository_objectupdated_infostateforce_branchintegration_manifestr   r   repository_manifestr%   validater   rd   pending_restarttree	treefilesrefr   logger)r3   r   s   &&r5   r6   HacsRepository.__init__.  s    	!"$	(**,@D!
!$&!#/#9#9"#=  
*,$	r8   c                   V ^8  d   QhRR/# r}   r   rH   r?   )r   s   "r5   r   r   C  s       r8   c                    V P                   # )1Return a string representation of the repository.)stringrm   s   &r5   __str__HacsRepository.__str__C  s    {{r8   c                   V ^8  d   QhRR/# r   r?   )r   s   "r5   r   r   H  s     G G Gr8   c                    RV P                   P                  P                  4        RV P                   P                   R2# )r   < >)r   rI   titlerT   rm   s   &r5   r   HacsRepository.stringG  s8     499%%++-.a		0C0C/DAFFr8   c                   V ^8  d   QhRR/# r   r?   )r   s   "r5   r   r   M  s     ^ ^c ^r8   c                   V P                   P                  e   V P                   P                  # V P                  P                  R8X  dS   V P                  P                  e   V P                  P                  # RV P
                  9   d   V P
                  R,          # V P                  P                  P                  R4      R,          P                  RR4      P                  RR4      P                  4       # )zReturn display name.ri   r2   rj   -r   _rk   )
r   r2   r   rI   r_   r   rT   rl   replacer   rm   s   &r5   display_nameHacsRepository.display_nameL  s     ##((4++00099.yy&&2yy...2220088yy""((-b199#sCKKCQTU[[]]r8   c                   V ^8  d   QhRR/# r}   r   rC   r?   )r   s   "r5   r   r   [  s     - -$ -r8   c                J   V P                   P                  '       d   R# V P                  P                  P                  P                  4       pVR8X  d   R# V P                  P                  ;'       g    .  Uu. uF  q"P                  4       NK  	  ppV'       g   R# W9  # u upi )z!Return True if hidden by country.Fall)r   rZ   r   configurationr+   lowerr   )r3   r   entryr   s   &   r5    ignored_by_country_configuration/HacsRepository.ignored_by_country_configurationZ  s     99		//77==?E!/3/G/G/O/O/U/USU/UV/UeKKM/UV,, Ws   8B c                   V ^8  d   QhRR/# r   r?   )r   s   "r5   r   r   i  s       r8   c                    V P                   P                  '       d   RpV# V P                  '       d   RpV# V P                  '       d   RpV# V P                   P                  '       d   RpV# RpV# )zReturn display_status.r`   zpending-restartzpending-upgraderZ   default)r   r`   r   pending_updaterZ   )r3   statuss   & r5   display_statusHacsRepository.display_statush  s{     99===F  !!!&F     &F
 	 YY    F  Fr8   c                   V ^8  d   QhRR/# r   r?   )r   s   "r5   r   r   x  s     	 	3 	r8   c                    V P                   P                  e   V P                   P                  pM1V P                   P                  e   V P                   P                  pMRp\        V4      # zReturn display_authorsrG   )r   rY   rX   rH   )r3   rZ   s   & r5   display_installed_version(HacsRepository.display_installed_versionw  sQ     99&&2		33Iyy))5 II66		9~r8   c                   V ^8  d   QhRR/# r   r?   )r   s   "r5   r   r     s      3 r8   c                n   V P                   P                  '       d0   V P                   P                  e   V P                   P                  pM`V P                   P                  e   V P                   P                  pM1V P                   P                  e   V P                   P                  pMRp\        V4      # r   )r   rf   rb   r^   r[   rH   )r3   	availables   & r5   display_available_version(HacsRepository.display_available_version  s     99499#7#7#C		,,IYY##/		..Iyy$$0 II11		9~r8   c                   V ^8  d   QhRR/# r   r?   )r   s   "r5   r   r     s     ! !3 !r8   c                J    V P                   P                  '       d   RpV# RpV# )z-Does the repositoriy use releases or commits?versioncommit)r   rd   )r3   version_or_commits   & r5   display_version_or_commit(HacsRepository.display_version_or_commit  s0     99 ) !  !)  r8   c                   V ^8  d   QhRR/# r   r?   )r   s   "r5   r   r     s       r8   c                   V P                   P                  '       d   V P                   P                  ec   V P                   P                  V P                   P                  8X  d4   V P                   P                  V P                   P
                  8w  d   R# R# V P                  R8X  d(   \        V P                  V P                  4      ;p e   V# V P                  V P                  8w  d   R# R# )zReturn True if pending update.TFr
  )
r   rZ   re   rK   rX   r[   r  r'   r  r  )r3   results   & r5   r   HacsRepository.pending_update  s     99yy%%199))TYY-E-EEyy11TYY5J5JJ# --:<6666 F  "M--1O1OOr8   c                   V ^8  d   QhRR/# r   r?   )r   s   "r5   r   r     s     	 	d 	r8   c                   V P                   P                  em   V P                  P                  '       dQ   \	        V P
                  P                  P                  P                  V P                   P                  4      '       g   R# R# )zReturn True if we can download.FT)	r   r   r   rd   r&   r   core
ha_versionr   rm   s   &r5   can_downloadHacsRepository.can_download  sa     ##11=yy!!!>IINN--44,,::  !r8   c                   V ^8  d   QhRR/# )r}   r   r   r?   )r   s   "r5   r   r     s      : r8   c                    R# )zReturn localpath.Nr?   rm   s   &r5   	localpathHacsRepository.localpath  s     r8   c                   V ^8  d   QhRR/# r   r?   )r   s   "r5   r   r     s      T r8   c                   V P                   P                  '       dS   V P                   P                  P                  R4      '       d(   V P                  V P
                  P                  8w  d   R# V P                  V P
                  P                  8X  d   R# V P
                  P                  R9  d   R# V P
                  P                  '       g   R# R# )z@Return a boolean indicating whether to download releases or not.z.zipTF)plugintheme)	r   r   r   endswithr   r   rK   rI   rd   rm   s   &r5   should_try_releases"HacsRepository.should_try_releases  s     ##///''0099&AA88tyy77788tyy///99%88yy!!!r8   c                   V ^8  d   QhRR/# r}   r   r   r?   )r   s   "r5   r   r     s      4 r8   c                   "   R# 5i)z	Validate.Nr?   rm   s   &r5   validate_repository"HacsRepository.validate_repository          )concurrenttasksbackoff_timec                   V ^8  d   QhRR/# r%  r?   )r   s   "r5   r   r     s     $ $4 $r8   c                   "   R# 5i)zUpdate the repositoryNr?   )r3   ignore_issuesforces   &&&r5   update_repository HacsRepository.update_repository  r)  r*  c                    V ^8  d   QhRRRR/# )r}   r/  rC   r   r   r?   )r   s   "r5   r   r     s      4 D r8   c                z  "   V P                   P                  P                  4        V P                  P	                  RV P
                  4       V P                  VR7      G Rj  xL
  \        P                  V P                   Uu. uF  q"P                  NK  	  up9   d   V P                  4       G Rj  xL
 ;p'       dp   \        P                  V4      V n        V P                  P!                  V P                  P#                  4       V P$                  P&                  P(                  R7       R# R# R#  Lu upi  L5i)z*Common validation steps of the repository.z%s Checking repository.)r/  Nr   )r   errorsclearr   debugr   common_update_datar   	HACS_JSONr   r   async_get_hacs_jsonr   r   r   r   r   r   r   systemr   )r3   r/  xr   s   &&  r5   common_validateHacsRepository.common_validate  s     ""$ 	3T[[A%%M%BBB ##DII'FIq

I'FF!%!9!9!;;;x;+7+A+A(+K(		%%,,44699++22 &  < G 	C (G;s7   A D;"D2#!D;D4D;2D93D;?A4D;4D;c                   V ^8  d   QhRR/# r%  r?   )r   s   "r5   r   r     s     7 74 7r8   c                  "   V P                   f    T P                  V P                  P                  '       d   RMV P                  P                  R7      G Rj  xL
 w  V n         pV P                  P                  V P                   P                  V P                  P                  P                  R7       WP                  n        V P                   '       da   V P                   P                  P                  R^ 4      V P                  n        \         P"                  ! \$        4      V P                  n        R# R#  L  \         d+    T P                  P                  RT P                  4        R# i ; i5i)z,Common registration steps of the repository.Netagr5  +%s Did not update, content was not modified	pushed_at)r   "async_get_legacy_repository_objectr   rZ   rP   r   
attributesr   r<  r   r   r   r8  r   getr]   r   nowr   r\   )r3   rC  s   & r5   common_registration"HacsRepository.common_registration  s"     !!)595\5\!%!4!4!4$)):S:S 6] 6 0,& 		%%**5599++22 &  -1		)
 !!!%)%;%;%F%F%J%J;XY%ZDII"%-\\#%6DII" "0 , !!"OQUQ\Q\]sG   E3&D;  D; D9A+D; E3A"E39D; ;1E0,E3/E00E3c                   V ^8  d   QhRR/# r   r?   )r   s   "r5   r   r     s     / /\` /r8   c                  "   V P                   P                  RV P                  4       V P                  P                  p V P                  VVVR7      G Rj  xL
  V P                  P                  '       gK   W@P                  P                  8X  d1   V'       g)   V P                   P                  RV P                  4       R# V P                  '       d}   V P                  P                  P                  R^ 4      V P                  n        V P                  P#                  4       G Rj  xL
  V P                  P$                  V P                  n        \&        P(                  V P*                   Uu. uF  qUP,                  NK  	  up9   d   V P/                  4       G Rj  xL
 ;p'       dn   \0        P3                  V4      V n        V P                  P7                  V P4                  P9                  4       V P                  P:                  P<                  R7       V P?                  4       G Rj  xL
 V n         \B        PD                  ! \F        4      V P                  n$        R	#  EL  \         dj    T P                  P                  P                  T P                  P                  ,          T P                  n
        T P                  YR7      G Rj  xL 
   ELw\         d    T'       g   T'       g    R#  ELi ; i ELu upi  ELd L5i)
z2Common information update steps of the repository.z!%s Getting repository information)r/  r0  skip_releasesN)r/  r0  FrD  rE  r5  T)%r   r8  r   r   rP   r9  r   r   commonrenamed_repositoriesrT   r   rZ   r   rG  rH  r]   set_last_commitr[   r   r:  r   r   r;  r   r   r   r   r   r<  r   async_get_info_file_contentsr   r   rI  r   r\   )r3   r/  r0  rN  current_etagr=  r   s   &&&&   r5   common_updateHacsRepository.common_update  s<     	=t{{K yy00	))++ *    yy"""		8Q8Q(Q[`KKKT[[Y !!!%)%;%;%F%F%J%J;XY%ZDII" ((88:::$($:$:$F$FDII! ##DII'FIq

I'FF!%!9!9!;;;x;+7+A+A(+K(		%%,,44699++22 &  &*%F%F%HH "*c!2		Q
 , 	T"&))"2"2"G"G		H[H["\DII)))SSS 	 	 ; (G;  Is   =L I  II  L8!L9LAL&K7'AL-K:LK?L(B L(L)4LI   A*K4
KK4LK4K4%K4-L3K44L:LLc                    V ^8  d   QhRRRR/# )r}   r   r%   r   r   r?   )r   s   "r5   r   r   /  s       d r8   c                  "    V P                  \        V P                  P                  \	        V P
                  P                  V P                  V P                  P                  R7      R7      V4      G Rj  xL
  R#  L  \         d8    TP                  P                  RT P                  P                   R24        R# i ; i5i)-Download ZIP archive from repository release.)
repositoryr
  r   )r2   r4   NzDownload of z was not completed)async_download_zip_filer   r   r   r$   r   rT   r   BaseExceptionr6  append)r3   r   s   &&r5   download_zip_files!HacsRepository.download_zip_files/  s     	..#11::,#'99#6#6 $!%!9!9!B!B 
 
 
  	OO"",,5576HJ	s;   CA2A? 6A=7A? ;C=A? ?>C=C CCc               $    V ^8  d   QhRRRRRR/# )r}   r   r   r   r%   r   r   r?   )r   s   "r5   r   r   E  s-     &A &A$&A &A 
	&Ar8   c                  a aa"    S P                   P                  VR,          4      G Rj  xL
 pVf(   VP                  P                  RVR,           24       R# S P                   P                  P                  \        P                  4      G Rj  xL
 oS RS P                  P                   2oS P                   P                  SV4      G Rj  xL
 pV V3R lpS P                   P                  P                  V4      G Rj  xL
  V V3R lpV'       d^   S P                  P                  RS P                  VR,          4       S P                   P                  P                  V4      G Rj  xL
  R# VP                  P                  R	VR,           R
24       R#  ELr EL L L L8  \         d     TP                  P                  R4        R# i ; i5i)rX  r4   NzFailed to download rj   c                    < \         P                  ! SR 4      ;_uu_ 4       p V P                  SP                  P                  P
                  4       RRR4       R#   + '       g   i     R# ; i)rN)zipfileZipFile
extractallr   r1   r   )zip_filer3   	temp_files    r5   _extract_zip_fileAHacsRepository.async_download_zip_file.<locals>._extract_zip_fileW  sC    __Y44''(9(9(?(?@ 5444s   0AA,	c                    < \         P                  P                  S4      '       d@   S P                  P	                  RS P
                  S4       \        P                  ! S4       R# R# zCleanup temp_dir.z%s Cleaning up %sNosr1   existsr   r8  r   shutilrmtreer3   temp_dirs   r5   cleanup_temp_dir@HacsRepository.async_download_zip_file.<locals>.cleanup_temp_dir]  sB    77>>(++KK%%&94;;QMM(+ ,r8   %s Download of %s completedr2   [z] was not downloadedzDownload was not completed)r   async_download_filer6  r\  hassasync_add_executor_jobtempfilemkdtempr   r   async_save_filer   infor   r[  )	r3   r   r   filecontentr  rh  rs  rr  rg  s	   f&&    @@r5   rZ  &HacsRepository.async_download_zip_fileE  sy     	A $		 = =gen MMK"&&)<WU^<L'MN!YY^^BB8CSCSTTH#*Ad&>&>&G&G%HII9944YLLFA ))..778IJJJ,   !>WU[_]iinn;;<LMMMOO""Qwv&77K#LM9 N U M K N
  	AOO""#?@	As   G%F* F-F* G6F* F!>F* F$3F* F&F* AF* /F(0F* 4G6&F* GF* !F* $F* &F* (F* *&GGGGNc                    V ^8  d   QhRRRR/# )r}   r
  zstring | Noner   r   r?   )r   s   "r5   r   r   m  s     #' #'m #'t #'r8   c                  "   RpV P                   P                  '       g   V P                  P                  '       gd   V P                  P
                  P                  eB   V P                  P                  RV P                  4        V P                  4       G Rj  xL
  R# V P                   P                  '       d<   V P                  P                  RV P                  V P                   P                  4       V P                  P
                  P                  R8X  d   Ve   V P                  V4      G Rj  xL
 pV'       g   V P!                  4       pV'       g   \        R4      h\#        V P$                  P&                  R7      pV F  pV P                   P(                  '       dD   V P                   P                  '       d(   VP*                  V P                   P                  8w  d   Kb  VP-                  V P/                  V4      4       K  	  VP1                  4       G Rj  xL
  R#  EL  \         d'   pT P                  P                  T4        Rp?ELRp?ii ; i EL) L@5i)z$Download the content of a directory.Nz!%s Downloading repository archive%s %sreleasezNo content to downloadrx  )r   r   r   rR   r   r1   r   r   r}  r   download_repository_zipr   	exceptionr   r8  release_contentsgather_files_to_downloadr!   r   rx  r   r2   adddowload_repository_contentexecute)r3   r
  contentsr  download_queuer   s   &&    r5   download_contentHacsRepository.download_contentm  s    15((444II'''!!((4KK@$++N122444 ##,,,KKgt{{D4L4L4U4UV<<##y0W5H!227;;H446H 899%499>>:G''777D<T<T<]<]<]<<4#;#;#D#DDt>>wGH	   $$&&&3 5  1%%i001 <  	's   :I"AI"H) H&H) I"<A8I"4I5I"I"A'I"AI"I  I"&H) )I4II"II" I"c                J  a aa"   S P                    P                  RR4      pV'       g   \        R4      hS P                  P	                  \        S P                  P                  VRR7      RRR7      G Rj  xL
 pVfF   S P                  P	                  \        S P                  P                  VR	R7      RR
7      G Rj  xL
 pVf   \        RS  R24      hS P                  P                  P                  \        P                  4      G Rj  xL
 oS RS P                  P                   2oS P                  P                  SV4      G Rj  xL
 pV'       g   \        R4      hV V3R lpS P                  P                  P                  V4      G Rj  xL
  V V3R lpS P                  P                  P                  V4      G Rj  xL
  S P                  P!                  RS P"                  S P$                  P&                  P(                  4       R#  EL ELW EL L L LX5i)z+Download the zip archive of the repository.tags/rG   zMissing required elements.tags)rY  r
  variantT)keep_urlnologNheads)r  rv  z] Failed to download zipballrj   zCould not save ZIP filec                   < \         P                  ! SR 4      ;_uu_ 4       p . pV P                   F  pRP                  VP                  P                  R4      R,          4      pVP                  SP                  P                  P                  4      '       g   Kk  VSP                  P                  P                  8w  g   K  VP                  SP                  P                  P                  R4      Vn        VP                  R8X  d   K  VP                  V4       K  	  \        V4      ^ 8X  d   \        R4      hV P                  SP                  P                  P                  V4       RRR4       R#   + '       g   i     R# ; i)rb  rj   :   NNrG   zNo content to extractN)rc  rd  filelistjoinr   rl   
startswithr   r1   r   r   r\  lenr   re  r   )rf  extractabler1   r   r3   rg  s       r5   rh  AHacsRepository.download_repository_zip.<locals>._extract_zip_file  s   C00H $--D"xx(;(;C(@(DEH ++DLL,=,=,D,DEE$(9(9(@(@@(0(8(89J9J9Q9QSU(V==C/$#**40 . {#q('(?@@##DLL$5$5$;$;[I! 1000s   A5E4"E4B(E44F	c                    < \         P                  P                  S4      '       d@   S P                  P	                  RS P
                  S4       \        P                  ! S4       R# R# rk  rl  rq  s   r5   rs  @HacsRepository.download_repository_zip.<locals>.cleanup_temp_dir  sB    ww~~h''!!"5t{{HMh' (r8   z%s Content was extracted to %s)r   r   r   r   rw  r#   r   rT   rx  ry  rz  r{  r   r   r|  r   r}  r   r   r1   r   )r3   r   r~  r  rh  rs  rr  rg  s   f     @@r5   r  &HacsRepository.download_repository_zip  s    
##GR0 <== II99dii&9&93PVW : 
 
  $		 = =$))*=*=sT[\ !> ! K !D6)E FGG>>x?O?OPPj$":":"C"C!DE	yy00KHH 9::	J& iinn334EFFF	( iinn334DEEE94;;HYHYH_H_`a
 QH. 	G 	Fsu   A2H#7H8AH# HAH#H>H#HH#:H#H3H#H!	AH#H#H#H#H#!H#c                    V ^8  d   QhRRRR/# )r}   r   rH   r   zdict[str, Any] | Noner?   )r   s   "r5   r   r     s      S <Q r8   c                  "    V P                   P                  ! R	RV P                   P                  P                  P                  P
                  RRRV P                  P                  R\        P                  /RRT;'       g    V P                  4       //B G Rj  xL
 pV'       d)   \        \        VP                  P                  4      4      # R#  L6  \         d     R# i ; i5i)
z&Get the content of the hacs.json file.methodraise_exceptionFrY  r1   paramsr   Nr?   )r   async_github_api_method	githubapireposr  rH  r   rT   r   r:  version_to_downloadr   r   r   r[  )r3   r   responses   && r5   r;  "HacsRepository.async_get_hacs_json  s     	!YY>> yy**0099== %  99.. $--	
 eS%F%FD,D,D,FGH H !.1F1F"GHH   		sA   C&BC CC ('C C&C C#C&"C##C&r
  c                    V ^8  d   QhRRRR/# )r}   r
  r   r   rH   r?   )r   s   "r5   r   r     s     [ [Z []` [r8   c                  "   R R lpV! 4        Uu. uF  qDV P                   9   g   K  VNK  	  ppV'       g   R# V P                  V^ ,          VR7      G Rj  xL
 ;'       g    R# u upi  L5i)z$Get the content of the info.md file.c                   V ^8  d   QhRR/# )r}   r   ztuple[str, ...]r?   )r   s   "r5   r   AHacsRepository.async_get_info_file_contents.<locals>.__annotate__  s     		 		_ 		r8   c                     R p V P                  4        R2V  R2V  R2V P                  4        R2V P                  4       V 3# )readmez.mdz.MD)upperrr   s    r5   _info_file_variantsHHacsRepository.async_get_info_file_contents.<locals>._info_file_variants  sO     D::<.$&&::<.$

 r8   rG   )r   r
  N)r   get_documentation)r3   r
  kwargsr  r   
info_filess   &$,   r5   rR  +HacsRepository.async_get_info_file_contents  sl     		 0C/Dc/D8TXTbTbHbhh/D
c++Z]G+TTZZXZZ d
 Us&   A.A'A')A.A,
A.$	A.c                   V ^8  d   QhRR/# r%  r?   )r   s   "r5   r   r     s     4 4 4r8   c                2   V P                   P                  P                  \        V P                  P
                  4      R7      '       dN   V P                  P                  RV P                  4       V P                   P                  P                  V 4       R# R# )zRun remove tasks.)repository_idz%s Starting removalN)
r   repositoriesis_registeredrH   r   rW   r   r}  r   
unregisterrm   s   &r5   removeHacsRepository.remove  sd    99!!//c$)),,>O/PPKK2DKK@II""--d3 Qr8   c                   V ^8  d   QhRR/# r%  r?   )r   s   "r5   r   r     s     Q Q Qr8   c                H  "   V P                   P                  RV P                  4       V P                  4       G Rj  xL
 '       g   \	        R4      hRV P
                  n        V P                  4       G Rj  xL
  \        V P                  P                  RV P
                  P                   R24      G Rj  xL
  RV P
                  n        RV P
                  n        V P                  P                  \        P                   RRR	R
RV P
                  P"                  RV P
                  P                  /4       V P%                  4       G Rj  xL
  \&        P(                  ! V P                  P                  \*        RV P
                  P                   24       R#  EL\ EL% L LU5i)zRun uninstall tasks.z%s RemovingNzCould not uninstallFzhacs/z.hacsrW   9  r   	uninstallrY  r  removed_)r   r}  r   remove_local_directoryr   r   rZ   _async_post_uninstallr"   r   rx  rW   rY   rX   async_dispatchr   
REPOSITORYrT   async_remove_entity_deviceirasync_delete_issuer   rm   s   &r5   r  HacsRepository.uninstall  s/    400222 566#		((*** 5e1LMMM&*		#%)		"		  ((d+dii11		
 --///
diinnf6OP' 3 	+M 	0sM   :F"F	F"/F"6F7?F"6F7BF"
F AF"F"F" F"c                   V ^8  d   QhRR/# r%  r?   )r   s   "r5   r   r     s     4 4d 4r8   c                  "    V P                   P                  R8X  d<   V P                  P                  P                   RV P                   P
                   2pEM V P                   P                  R8X  d<   V P                  P                  P                   RV P                   P
                   2pEMV P                   P                  R8X  d   V P                  P                  P                   RV P                  P                  P                   RV P                   P                   R2p\        V P                  P                  VRR7      G Rj  xL
  V P                  P                  P                  pEMV P                   P                  R	8X  d   V P                   P                  '       g   \        P                   ! V P                   P"                  4      ;p'       d7   W0P                   n        V P$                  V P                  P                  n        M(V P&                  P)                  R
V P*                  4       R# V P                  P                  P                  pM V P                  P                  P                  p\-        V P                  P                  V4      G Rj  xL
 '       Ed   \/        V P                  V4      '       g*   V P&                  P)                  RV P*                  V4       R# V P&                  P1                  RV P*                  V4       V P                   P                  R9   d*   \        V P                  P                  V4      G Rj  xL
  M(\3        V P                  P                  V4      G Rj  xL
  \-        V P                  P                  V4      G Rj  xL
 '       d   \5        ^4      G Rj  xL
  KC   R# V P&                  P1                  RV P*                  V4        R#  EL ELW L L| LV L?  \6         d4   pT P&                  P1                  RT P*                  XT4        Rp?R# Rp?ii ; i5i)zCheck the local directory.python_scriptrj   templater   z.yamlT)
missing_okNri   z%s Missing domainFz"%s Path %s is blocked from removalz%s Removing %sz0%s Presumed local content path %s does not existz%s Removing %s failed with %s)r  r  )r   rI   r   r1   r   rR   r   r  config_pathr   
theme_pathr2   r   rx  rM   r(   rH  rT   r  r   errorr   r   r    r8  r   r   r[  )r3   
local_pathr1   rM   r  s   &    r5   r  %HacsRepository.remove_local_directory  s    0	yy!!_4 $ 1 1 7 78$)):M:M9NO
##z1 $ 1 1 7 78$)):M:M9NO
##w.yy~~112!yy..99:!yy~~&e- 
 #499>>4DIII!\\..44
##}4yy'''!1!5!5dii6I6I!JJvJ+1		(26..))/))*=t{{K$!\\..44
!\\..44
!$))..*===tyy*55KK%%&JDKKYcd !!"2DKKL99%%)FF&tyy~~zBBB0LLL(DDD(NN E  !!FU_ M J > CLD" 	 KK=t{{JXab	s   Q EO? O1AO? )1O? AO? 7Q 9A$O? O4
O? )AO? ,Q .A%O? O7(O? <O9='O? $O;%	O? /O? =O=>O? Q 'O? .Q 1O? 4O? 7O? 9O? ;O? =O? ?P=
(P82Q 8P==Q c                   V ^8  d   QhRR/# r%  r?   )r   s   "r5   r   r   D  s     * *d *r8   c                   "   R# 5i)zRun pre registration steps.Nr?   rm   s   &r5   async_pre_registration%HacsRepository.async_pre_registrationD  r)  r*  )r+  c                   V ^8  d   QhRR/# r%  r?   )r   s   "r5   r   r   H  s     - -D -r8   c                z  "   V P                  4       G Rj  xL
  Ve   WP                  n        Wn        RV n        V P                  4       G Rj  xL
 '       g   R# V P                  4       G Rj  xL
  V P                  V P                  P                  n
        V P                  4       G Rj  xL
  R#  L Le LG L5i)zRun registration steps.NTF)r  r   re   r   r   r'  rJ  r  r   r1   r   async_post_registration)r3   r   s   &&r5   async_registration!HacsRepository.async_registrationG  s      ))+++?%(II"H $D--/// &&((( #'.. **,,,# 	, 0 	) 	-sK   B;B38B;B5	B;B;/B70<B;,B9-B;5B;7B;9B;c                   V ^8  d   QhRR/# r%  r?   )r   s   "r5   r   r   ]  s     E Et Er8   c                   "   V P                   P                  P                  '       g   R# V P                   P                  P	                  V 4      G Rj  xL
  R#  L5i)zRun post registration steps.N)r   r<  r   
validationasync_run_repository_checksrm   s   &r5   r  &HacsRepository.async_post_registration]  s<     yy&&&ii"">>tDDDs   AAAAc                   V ^8  d   QhRR/# r%  r?   )r   s   "r5   r   r   c  s     % % %r8   c                   "   R# 5i)Run pre install steps.Nr?   rm   s   &r5   async_pre_install HacsRepository.async_pre_installc  r)  r*  c                   V ^8  d   QhRR/# r%  r?   )r   s   "r5   r   r   f  s     M M$ Mr8   c                   "   V P                   P                  RV P                  4       V P                  4       G Rj  xL
  V P                   P                  RV P                  4       R#  L,5i)r  z!%s Running pre installation stepsNz#%s Pre installation steps completed)r   r}  r   r  rm   s   &r5   _async_pre_install!HacsRepository._async_pre_installf  sN     <dkkJ$$&&&>L 	's   :A+A)-A+c                    V ^8  d   QhRRRR/# r}   r
  r   r   r   r?   )r   s   "r5   r   r   l  s     
 
j 
 
r8   c                 "   V P                  4       G Rj  xL
  V P                  P                  \        P                  RV P
                  P                  R^/4       V P                  P                  RV P                  4       V P                  VR7      G Rj  xL
  V P                  P                  \        P                  RV P
                  P                  R^Z/4       V P                  P                  RV P                  4       V P                  4       G Rj  xL
  V P                  P                  \        P                  RV P
                  P                  RR/4       R#  ELK L LM5i)zRun install steps.NrY  progressz%s Running installation stepsr
  z%s Installation steps completedF)r  r   r  r   REPOSITORY_DOWNLOAD_PROGRESSr   rT   r   r}  r   async_install_repository_async_post_install)r3   r
  r   s   &$,r5   async_installHacsRepository.async_installl  s    %%'''		  ::499..
B?	
 	8$++F++G+<<<		  ::499..
B?	
 	:DKKH&&(((		  ::499..
EB	
 	( 	= 	)s6   E(E!BE(E$A?E(E&A	E($E(&E(c                   V ^8  d   QhRR/# r%  r?   )r   s   "r5   r   r     s     & &t &r8   c                   "   R# 5i)Run post install steps.Nr?   rm   s   &r5   async_post_installation&HacsRepository.async_post_installation  r)  r*  c                   "   R# 5izRun post uninstall steps.Nr?   rm   s   &r5   async_post_uninstall#HacsRepository.async_post_uninstall  r)  r*  c                B   "   V P                  4       G Rj  xL
  R#  L5ir   )r  rm   s   &r5   r  $HacsRepository._async_post_uninstall  s     '')))s   c                   V ^8  d   QhRR/# r%  r?   )r   s   "r5   r   r     s     N N4 Nr8   c                  "   V P                   P                  RV P                  4       V P                  4       G Rj  xL
  RV P                  n        V P                  P                  \        P                  RRRRRV P                  P                  R	V P                  P                  /4       V P                   P                  R
V P                  4       R#  L5i)r  z"%s Running post installation stepsNFrW   r  r   installrY  r  z$%s Post installation steps completed)r   r}  r   r  r   r`   r   r  r   r  rT   rW   rm   s   &r5   r  "HacsRepository._async_post_install  s     =t{{K**,,,				  ((d)dii11		
 	?M 	-s   :CCBCc                    V ^8  d   QhRRRR/# r  r?   )r   s   "r5   r   r     s#     RA RA RATX RAr8   c                 "   RpV P                  VRJ R7      G Rj  xL
  V P                  P                  P                  f   \	        R4      hV P
                  P                  P                  4        T;'       g    V P                  4       pW@P                  P                  8X  d   W@n        M
RV 2V n        V P                  P                  \        P                  RV P                  P                   R^(/4       V P"                  P$                  '       Ed   \'        V P                  P(                  V P                  P                  P                   RV P"                  P$                   24      G Rj  xL
 '       d   \+        V P                  V P                  P                  P                   RV P"                  P$                   2\,        P.                  ! 4       R,           R	7      pV P                  P(                  P1                  VP2                  4      G Rj  xL
  V P                  P4                  '       d   V P                  P6                  '       gm   \+        V P                  V P                  P                  P                  R
7      pV P                  P(                  P1                  VP2                  4      G Rj  xL
  V P                  P8                  P;                  RV P<                  V P                  P                  P                  4       V P                  P8                  P;                  RV P<                  V P                  P                  P>                  4       V P                  P8                  P;                  RV P<                  V4       V P                  P                  \        P                  RV P                  P                   R^2/4       V P"                  P@                  '       dA   V P"                  PB                  '       d%   V PE                  V P
                  4      G Rj  xL
  MV PG                  V4      G Rj  xL
  V P                  P                  \        P                  RV P                  P                   R^F/4       V P
                  P                  '       d   V P
                  P                   F*  pV PH                  PK                  RV P<                  V4       K,  	  V P                  P4                  '       d   V P                  P6                  '       go   V P                  P(                  P1                  XPL                  4      G Rj  xL
  V P                  P(                  P1                  VPN                  4      G Rj  xL
  \	        R4      hV P                  P                  \        P                  RV P                  P                   R^P/4       V P                  P4                  '       dT   V P                  P6                  '       g8   V P                  P(                  P1                  XPN                  4      G Rj  xL
  Veo   V P                  P(                  P1                  VPL                  4      G Rj  xL
  V P                  P(                  P1                  VPN                  4      G Rj  xL
  V P
                  PP                  '       dv   RV P                  n        V P                  PR                  V P                  n*        W@P                  P                  8X  d   RV P                  n+        R# W@P                  n+        R# R#  EL2 EL EL> EL EL4 EL EL EL EL" L L5i)z,Common installation steps of the repository.Nr0  z%repository.content.path.local is Noner  rY  r  rj   z/hacs_persistent_directory/)r   r  backup_path)r   r  z%s Local path is set to %sz%s Remote path is set to %sz%s Version to install: %sr  z'Could not download, see log for detailsT),r1  r   r1   r   r   r   r6  r7  r  r   rK   r   r   r  r   r  rT   r   r   r   rx  r   rz  
gettempdirry  createrZ   r   logr8  r   r   r   r   r]  r  r   r  restorecleanupsuccessr[   rX   rY   )r3   r
  r   r   version_to_installbackupr  s   &$,    r5   r  'HacsRepository.async_install_repository  s3    #$$7d?$;;;<<""* GHH""$$BB(@(@(B!9!99)H123DH		  ::499..
B?	

 ##888!		<<$$**+1T-E-E-Z-Z,[\   (.))//"101$2J2J2_2_1` b ( 3 3 58U U	($ iinn;;<P<W<WXXX99t||':':':t||7H7H7N7NOF))..77FFF		8$++t||GXGXG^G^_		94;;HYHYH`H`a		7FXY		  ::499..
B?	

 ##///D4L4L4U4U4U))$--888''(:;;;		  ::499..
B?	

 ==--!!'4;;> .yy"""4<<+>+>+>iinn;;FNNKKKiinn;;FNNKKK IJJ		  ::499..
B?	

 99t||':':':))..77GGG+))..778L8T8TUUU))..778L8T8TUUU==   "&DII)-)>)>DII&!YY%=%==.2		+.@		+ !Q 	<" Y G 9; LK H VUs  ]-]A]-;B]-A]-0]1	]-;B]-]]-7]-A']-:];D0]-,]-]-&]']- ]A!]-#A]-]-2]-] 6]-]#	A,]-6]-2]-]&:]-?]) 6]-6]+7]-A8]-]-]-]-]-]- ]-#]-&]-)]-+]-c                    V ^8  d   QhRRRR/# )r}   rC  r   r   z)tuple[AIOGitHubAPIRepository, Any | None]r?   )r   s   "r5   r   r     s     : :: 
3:r8   c                  "    V P                   P                  P                  V P                  P                  V4      G Rj  xL
 pW P                   P                  P
                  P                  P                  3#  L9  \         d   p\        T4      ThRp?i\        \        \        3 d   p\        T4      ThRp?ii ; i5i)zReturn a repository object.N)r   githubget_repor   rT   clientlast_responserC  r	   r   
ValueErrorr   	Exceptionr   )r3   rC  rY  r  s   &&  r5   rF  1HacsRepository.async_get_legacy_repository_object  s     
	:#yy//889L9LdSSJyy//66DDIIII T/ 	E*959D19= 	:	*	9	:sL   C=A= A;8A= :C;A= =B>BB>,B>-B99B>>Cc                   V ^8  d   QhRR/# r%  r?   )r   s   "r5   r   r     s     * *$ *r8   c                    R# )zGet the filename to target.Nr?   rm   s   &r5   update_filenamesHacsRepository.update_filenames  s    r8   c                   V ^8  d   QhRR/# )r}   r   rH   r?   )r   s   "r5   r   r     s     : :# :r8   c                   "   V P                   f   \        R4      h V P                   P                  V4      G Rj  xL
 pV#  L  \        \        3 d   p\        T4      ThRp?ii ; i5i)zReturn the repository tree.NzNo repository_object)r   r   get_treer  r   )r3   r   r   r  s   &&  r5   r%  HacsRepository.get_tree  sg     !!) 677	://88==DK >12 	:	*	9	:s8   A)A AA A)A A&A!!A&&A)c                   V ^8  d   QhRR/# )r}   r   r   r?   )r   s   "r5   r   r     s      E] r8   c                  "   V P                   P                  V P                   P                  P                  P                  P
                  V P                  P                  R7      G Rj  xL
 p. pVP                  ;'       g    .  FU  p\        V4      V8X  d    V# VP                  '       g   VP                  '       d   V'       g   KD  VP                  V4       KW  	  V#  Lw5i)zReturn the repository releases.)r  rY  N)r   r  r  r  rd   listr   rT   r  draftrb   r\  )r3   rb   returnlimitr  rd   r  s   &&&   r5   get_releasesHacsRepository.get_releases  s     ::99&&,,55::yy** ; 
 
 }}***G8}+  }}}!3!3!3JOOG$ + 
s*   A'C#)C!*C#*C#.C# C#C#c               $    V ^8  d   QhRRRRRR/# )r}   r/  rC   r0  r   r   r?   )r   s   "r5   r   r     s-     {9 {9{9 {9 
{9r8   c                  "   . p T P                  V'       g   V P                  P                  '       d   RMV P                  P                  R7      G Rj  xL
 w  rgW`n        V P                  P
                  P                  4       VP
                  P                  4       8w  d   VP
                  V P                  P                  P                  V P                  P
                  &   V P                  P                  P                  '       g   \        hV P                  P                  RV P                  VP
                  4       V P                  P!                  VP"                  V P                  P                  P$                  R7       WpP                  n        T P                  P6                  '       d   T'       g   T P0                  P2                  P5                  R4       T P                  P
                  T P                  P                  P8                  9  dD   T P                  P                  P8                  P;                  T P                  P
                  4       \=        T  R24      hT P                  P>                  PA                  T P                  P
                  4      '       d   T P                  P>                  PC                  T P                  P
                  4      p	T	PD                  R	8w  d<   T'       g4   T P0                  P2                  P5                  R
4       \+        T  R24      hT'       EgX    T PG                  R^R7      G Rj  xL
 pT'       Ed3   RT P                  n$        T F{  p
T
PJ                  '       d   K  T
PH                  '       d8   T P                  PH                  f   T
PL                  T P                  n$        K^  K`  T
PL                  T P                  n'         M	  RT P                  n(        T U
u. uFI  p
T
PJ                  '       d   K  T P                  PR                  '       g   T
PH                  '       d   KG  T
NKK  	  pp
YPP                  n*        T Uu. uF  qPL                  NK  	  upT P                  n+        T PX                  '       g   T P[                  4       T n.        T P                  PP                  '       d   T PP                  PT                  ;'       g    .  Fd  p
T
PL                  T P\                  8X  g   K   T
P^                  ;p'       g   K6  \a        \c        T4      4      Pd                  pYP                  n3        Kf  	  MT P                  P                  P                  '       dZ   T P                  '       dH   T P                  Pi                  4       G Rj  xL
  T P                  Pj                  T P                  n5        T P                  Pl                  Po                  RT P                  T P\                  Pq                  RR4      4        T Ps                  T P\                  4      G Rj  xL
 T n:        T Pt                  '       g   \+        R4      h. T n;        T Pt                   F(  pT Pv                  P5                  TPx                  4       K*  	  R#  ELU  \&         d     R# \         d	    \        Rh\(        \*        3 d   pT P                  P,                  P.                  '       d'   T P                  P                  P                  '       d(   T P                  P                  RT P                  T4       T'       g2   T P0                  P2                  P5                  R4       \+        T4      Th Rp?ELRp?ii ; i ELIu up
i u upi   \*         d    RT P                  n(         EL5i ; i EL EL  \(        \*        3 Ed"   pT'       g   T P\                  e   \{        T4      P}                  R4      '       dx   RT P                  n?        T P[                  4       T n.        T P                  P                  RT P                  T P\                  4       T P                  YR4      G Rj  xL 
 u Rp?# T P                  P,                  P.                  '       g0   T'       g(   T P                  P                  RT P                  T4       T'       g   \+        T4      Rh Rp?R# Rp?ii ; i5i)zCommon update data.NrB  z#%s Repository has been renamed - %sr5  r  zRepository does not exist.zRepository is archived.z Repository is archived.r  z,Repository has been requested to be removed.z- Repository has been requested to be removed.T)rb   r+  Fz%s Running checks against %sr  rG   zNo files in treezGitHub returned 404zG%s Selected version/branch %s has been removed, falling back to default)BrF  r   rZ   rP   r   rT   r   r   rO  rP  r<  	generatorr   r   r  r   r   rG  r   r   r   r   r   startupr   r6  r\  rD   archived_repositoriesr  r   r  
is_removedremoved_repositoryremoval_typer,  rb   r*  tag_namer^   rd   rf   r   rc   r   r  r   assetsnextiterdownload_countrO   rQ  r[   r  r8  r   r%  r   r   	full_pathrH   r  re   warningr9  )r3   r/  r0  retryrN  rd   r   rC  r  removedr  filtered_releasesr=  r7  rO   treefiles   &&&&&           r5   r9  !HacsRepository.common_update_data  s     	>,0,S,S"dii&9&9&9Ttyy?X?X -T - '# &7"yy""((*.?.I.I.O.O.QQ%// 		  55dii6I6IJ yy''11166!!94;;HYHcHc II!!!,,yy''.. "  )-II% 99mMM  ''(AByy""$))*:*:*P*PP		  66::499;N;NO1TF:R2STT 99!!,,TYY-@-@AAii,,??		@S@STG##x/$$++,Z[#tf,Y$Z[[ }+!%!2!2dPR!2!SS8+/DII(#+"===$$///#yy33;7>7G7G		 4  < 6=5E5EDII2! $, *.DII& (0)'/G&}}  26))2E2E2EWM_M_  '/ & )
 ->MM)DU/VDUq

DU/VDII,
    //1DH99==0066B6##txx/!(/v//$(f$6$E$E	.7		+	 7
 YY'''D,B,B,B((88:::$($:$:$F$FDII!		*DKK9I9I'SU9V	
	9"mmDHH55DI999#$677DN II%%h&8&89 &{'$ ( 	+ 	9.D8%}5 	>99##+++tyy/?/?/I/I/I!!'4;;	B $$++,HI#I.I= !	>0 T) 0W  +%*		"+ ; 6 &}5 	9HH(	N--.CDD *.		&335##]KKHH
 "44]4PPPP99##+++M!!'4;;	B #I.D8 !#	9s  d.Z-  Z- Z*B3Z- 
BZ- d2d:C-d(Ad:;d7^# ^^# ;^# A+^# ^^7^^^# '^;^# d0dd-dd&Ad?dd._/A4d$_ _	_ A
_ (d*Z- -^8d;^^^A^(.^1^d^d^# 
^# #_?d_d	_ c?B"c: bc:c?d%c:1c:9.c:(c:4d:c??dc                   V ^8  d   QhRR/# )r}   r   zlist[FileInformation]r?   )r   s   "r5   r   r     s     : :*? :r8   c           	        . pV P                   pV P                   P                  RR4      pV P                  P                  pV P
                  P                  pV P                  P                  P                  pV P                  '       d   T;'       g    .  Fl  pW7P                  8X  g   K  VP                  ;'       g    .  F=  pVP                  \        VP                  VP                   VP                   4      4       K?  	  Kn  	  V'       d   V# V P                  P"                  '       dm   V Fd  p	V	P$                  V P
                  P&                  8X  g   K*  VP                  \        V	P(                  V	P*                  V	P$                  4      4       Kf  	  V# VR8X  d   V F  p	V	P                  R	9   g   K  VR8X  d$   V	P$                  P-                  R4      '       g   K@  V'       g7   V	P$                  P/                  R4      '       g   Kk  V	P                  R8w  d   K~  V	P0                  '       d   K  VP                  \        V	P(                  V	P*                  V	P$                  4      4       K  	  V'       d   V# V P2                  P4                  '       d<   V P2                  P$                  '       g    VR8X  d   \7        V P                   RRR4      pV F  p
V
P0                  '       d   K  V
P*                  P-                  V P                  P                  P                  4      '       g   KX  VP                  \        V
P(                  V
P*                  V
P$                  4      4       K  	  V# )
z/Return a list of file objects to be downloaded.r  rG   r  distz.jsr   yamlr;  )rG   rD  )r   r   r   rd   r   r   rI   r   r1   r   r"  r6  r7  r\  r-   browser_download_urlr2   r   r   rR   r0   r;  r  r!  is_directoryr   r   r   )r3   r   r   r   releaseobjectsrI   remotelocationr  assetr@  r1   s   &          r5   r  'HacsRepository.gather_files_to_download  s   yy
##GR0..99%%**11###)//R/***!(!5!52!5+E,F,F

TYT^T^_ "6 0 << $$		(;(;;LL'$1183E3ExGXGX ! Lx ==L0%/8I8I8T8TU[8\8\ )'0099%@@$#==B.$#000+ ( 5 5x7I7I8K\K\ ! ##333++444w&<TYYFT_`DD   ~~(():):)A)ABB_T->->PTP]P]^_	 
 r8   c                    V ^8  d   QhRRRR/# )r}   r
  r   r   zlist[FileInformation] | Noner?   )r   s   "r5   r   r     s     
 
j 
D` 
r8   c           
       "   V P                   P                  V P                   P                  P                  RV P                  P
                   RV 2RR7      G Rj  xL
 pVf   R# VP                  P                  R. 4       Uu. uF>  p\        VP                  R4      VP                  R4      VP                  R4      R	7      NK@  	  up#  Lou upi 5i)
z!Gather the contents of a release.z/repos/z/releases/tags/F)r  endpointr  Nr7  rF  r2   )r4   r1   r2   )r   r  r  genericr   rT   rH  r-   )r3   r
  r  rJ  s   &&  r5   r  HacsRepository.release_contents  s     		9999&&..tyy223?7)L! : 
 

 ? !))(B7
 8 II45YYv&YYv&
 8
 	


s%   ACC(CAC	CCc                    V ^8  d   QhRRRR/# )r}   r   r-   r   r   r?   )r   s   "r5   r   r     s     (U (U (UD (Ur8   c                Z  "    V P                   P                  RV P                  VP                  4       V P                  P                  VP                  4      G Rj  xL
 pVf6   V P                  P                  P                  RVP                   R24       R# V P                  P                  '       g   VP                  f"   V P                  P                  P                  pMVP                  pV P                  P                  '       g2   VP!                  V P                  P                  P"                   R4      pV P                  P                  P                   RV 2pVP%                  R4      pVR RP'                  V4      p\(        P*                  ! V4      P-                  RRR7       V RVP                   2P!                  R	R4      pV P                  P/                  WR4      G Rj  xL
 pV'       d4   V P                   P1                  R
V P                  VP                  4       R# V P                  P                  P                  RVP                   R24       R#  EL Lw  \2         d5   pT P                  P                  P                  RT R24        Rp?R# Rp?ii ; i5i)zDownload content.z%s Downloading %sNrv  z] was not downloaded.rG   rj   T)parentsexist_okz//ru  zDownload was not completed []rk   )r   r8  r   r2   r   rw  r0   r   r6  r\  r   r   r1   r   r   r   r   r   rl   r  pathlibPathmkdirr|  r}  r[  )r3   r   r~  local_directory_content_pathlocal_file_pathr  r  s   &&      r5   r  )HacsRepository.dowload_repository_content  s    &	UKK14;;M $		 = =g>R>R SSK"$$++a~=R,ST ||"""gll&:"&,,"3"3"9"9 !(//???$1$9$9T\\=N=N=U=U<VY[$\M%)\\%6%6%<%<$=Q}o"N"1"7"7"<#B'"%((?"; LL)//t/L"1!2!GLL>BKKDRUVO9944_RRF  !>W\\ZMM  ''!GLL>9N(OP; T2 S 	U MM  ''*FykQR(STT		Us   J+AI) I$;I) J+I) 7AI) C!I) /I'0I) <1I) -J+/3I) "J+$I) 'I) )J(4)J#J+#J((J+c                   V ^8  d   QhRR/# r%  r?   )r   s   "r5   r   r     s     A A$ Ar8   c                  "   \         P                  ! V P                  P                  R7      pVP	                  \
        \        V P                  P                  4      30R7      pVf   R# VP                  VP                  R7       R# 5i)zRemove the entity device.r  )identifiersN)	device_id)
dr	async_getr   rx  async_get_devicer   rH   r   rW   async_remove_device)r3   r   devices   &  r5   r  )HacsRepository.async_remove_entity_device  s`     -/\\tyy~~-N 11DIILLHY?Z>[1\>++fii+@s   BBc                   V ^8  d   QhRR/# r   r?   )r   s   "r5   r   r     s     2 2S 2r8   c                   V P                   P                  e   V P                   P                  em   V P                   P                  V P                   P                  8X  d(   RV P                   n        V P                   P                  # V P                   P                  # V P                   P                  # V P                   P                  e   V P                   P                  V P                   P                  8X  d   V P                   P                  # V P                   P                  V P                   P                  9   d   V P                   P                  # V P                   P                  ;'       g    R# )z$Determine which version to download.Nmain)r   r^   re   rK   rc   rm   s   &r5   r  "HacsRepository.version_to_download  s    99!!-yy%%199))TYY-C-CC-1DII*99111yy---99)))99!!-yy%%)A)AAyy///yy%%)A)AAyy---yy''1161r8   r   c               $    V ^8  d   QhRRRRRR/# )r}   r   r   r
  r   r?   )r   s   "r5   r   r   *  s*     '
 '
 '
 	'
 
'
r8   c                 "   Vf   R# Ve   TpMV P                   P                  '       d6   V P                   P                  ;'       g    V P                   P                  pMHV P                   P                  ;'       g+    V P                   P
                  ;'       g    V P                  pV P                  P                  RV P                  VV4       Vf   R# V P                  P                  RV P                   P                   RV RV 2RR7      G Rj  xL
 pV'       d3   VP                  RR7      P                  R	R
4      P                  RR4      # R#  L@5i)z(Get the documentation of the repository.Nz3%s Getting documentation for version=%s,filename=%s"https://raw.githubusercontent.com/rj   Tr  zutf-8)encodingz<svgz	<disabledz</svgz
</disabled)r   rZ   rY   rX   r^   r[   r   r   r8  r   r   rw  rT   decoder   )r3   r   r
  r  target_versionr  s   &$$,  r5   r   HacsRepository.get_documentation*  s4     $NYY   !YY88VVDII<V<VN!YY33XXtyy7L7LXXPTPXPXNAKK		
 !yy440		##1%$%n%5QxjB 5 
 
  MM7M+WV[)WWl+	

 	

s/   )EE	4E>EA8EEE!5Ec                    V ^8  d   QhRRRR/# )r}   r
  rH   r   zHacsManifest | Noner?   )r   s   "r5   r   r   S  s      c @S r8   c               J  "   V P                   P                  RV P                  V4        V P                  P	                  RV P
                  P                   RV R2RR7      G Rj  xL
 pVf   R# \        P                  \        V4      4      #  L(  \         d     R# i ; i5i)z)Get the hacs.json file of the repository.z#%s Getting hacs.json for version=%srm  rj   z
/hacs.jsonTrn  N)r   r8  r   r   rw  r   rT   r   r   r   r  )r3   r
  r  r  s   &$, r5   get_hacs_jsonHacsRepository.get_hacs_jsonS  s     ?gV
	99884II''5)()'*> 9  F
 ~))*V*<==  		sF   (B#;B &B'B /B#1B B#B B B#B  B#c               $    V ^8  d   QhRRRRRR/# )r}   r   r   r  r   r   r   r?   )r   s   "r5   r   r   b  s"      2  2z  2S  2UY  2r8   c                  "   RpVfB   V P                   '       g.   \        RV P                  P                  P                   R24      hR# WP                  P
                  8X  d   V P                  pMV P                  VR7      G Rj  xL
 pVf1   \        RV RV P                  P                  P                   R24      hVP                  eI   V P                  P                  P                  VP                  8  d   \        RVP                   R	24      hVP                  eA   V P                  P                  VP                  8  d   \        R
VP                   R	24      hR# R#  L5i)z(Ensure that the download can be handled.NzThis z is not available for download.r  zThe version z
 for this z can not be used with HACS.z%This version requires Home Assistant z
 or newer.zThis version requires HACS )r  r   r   rI   rt   r^   r   ru  r   r   r  r  r
  )r3   r   r  target_manifests   &&, r5   _ensure_download_capabilities,HacsRepository._ensure_download_capabilitiesb  si    /3;$$$#		**0021PR  ))((("66O$($6$6s$6$CCO"se:II&&,,..-HJ  ))5		))O,I,II7#11832<>  +		0A0AODXDX0X"=$$>&%/!1 2 2 1Y+! Ds   E'A+E'E%CE'r   c                    V ^8  d   QhRRRR/# )r}   r   r   r   r   r?   )r   s   "r5   r   r     s     ! !j !QU !r8   c          
       "   V P                  V4      G Rj  xL
  V P                  P                  RV4       V P                  R8X  d   V P                  P                  \        P                  RV P                  P                  R^
/4       V'       g   V P                  RR7      G Rj  xL
  MWn        WP                  n        VRJV n        V P                  P                  \        P                  RV P                  P                  R^/4        V P                  VR7      G Rj  xL
   RT P                  n        RT n        T P                  P                  \        P                  RT P                  P                  RR/4       R#  ELp L Lf  \         dl   p\        R	T P                  P                   R
T;'       g5    T P                  P                   ;'       g    T P                  P"                   RT R24      ThRp?ii ; i  RT P                  n        RT n        T P                  P                  \        P                  RT P                  P                  RR/4       i ; i5i)z%Download the content of a repository.NzStarting download, %sr
  rY  r  Tr  r  zDownloading z with version z failed with ()F)rz  r   r}  r  r   r  r   r  r   rT   r1  r   re   r   r  r   r^   r[   )r3   r   r   r  s   &$, r5   async_download_repository(HacsRepository.async_download_repository  s    005550#6))Y6II$$!>>tyy22JC ,,4,888%(II" #4DII$$!>>tyy22JC
	$$S$111 &*DII" %DII$$!>>tyy22JF9 	6 9 2 	tyy223>JJ49911JJTYY5J5JBLKYZcYddeg 	 &*DII" %DII$$!>>tyy22JFst   I&FA:I&I&(F
)A&I&F %F&F +AI&
I&F HAG?"G??HH AI##I&firstc                    V ^8  d   QhRRRR/# )r}   r  rN   r   r   r?   )r   s   "r5   r   r     s       >V r8   c                 "   V P                   P                  V P                   P                  P                  P                  P
                  V P                  P                  R^/R7      G Rj  xL
 pVP                  #  L5i)z(Get the last x releases of a repository.per_page)r  rY  r  N)r   r  r  r  rd   r)  r   rT   )r3   r  r  s   &$ r5   async_get_releases!HacsRepository.async_get_releases  sh     ::99&&,,55::yy**# ; 
 

 }}
s   A*A?,A=-A?)r   r   r   r   r   r   r   r   r   rd   r   r   r   r   r   r   r   )FFr   )FFFr/   )F   )FFFF)=r9   r:   r;   r<   r=   r6   r   r   r   r   r   r   r  r  r  r   r  r  r"  r'  r   r1  r>  rJ  rT  r]  rZ  r  r  r;  rR  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rF  r!  r%  r,  r9  r  r  r  r  r  r  ru  rz  r  r  r>   r?   r8   r5   r   r   +  sc   * G G ^ ^ - -   	 	   ! !  * 	 	     3$ 4$"7* 3/ 4/b,&AP#'J7ar [$ [*4Q04l* #- $-*E%M
4 
(&(*N RAd RAh:*:{9z:x
& #(U $(UTA2$'
  $'
 #	'
R 2D!4 !Fr  r8   r   ),zadd-onaddonappzappdaemon-apps	appdaemonzcustom-cardzcustom-cardszcustom-componentzcustom-componentscustomcomponentshacktoberfestzhacs-defaultzhacs-integrationzhacs-repositoryr   rx  hassiozhome-assistant-customzhome-assistant-frontendzhome-assistant-hacszhome-assistant-sensorzhome-assistantzhome-automationzhomeassistant-componentszhomeassistant-integrationzhomeassistant-sensorr   homeautomationri   zlovelace-uilovelacezmedia-playermediaplayerr  r  zpython-scriptpythonsensorz
smart-home	smarthomer  	templatesr   themes)rL   rG   )rO       )rM   N)rQ   N)rP   N)rT   rG   )r[   N)r]   r  )r^   N)r_   N)ra   r  )rb   N)rg   r  )r2   N)Vr=   
__future__r   asyncior   r   r   rm  rV  ro  rz  typingr   r   rc  aiogithubapir   r	   r
   aiogithubapi.objects.repositoryr   rs   homeassistant.helpersr   ra  r   r  constr   enumsr   r   
exceptionsr   r   r   r   typesr   utils.backupr   utils.decoder   utils.decoratorr   utils.file_systemr   r   r   utils.filtersr   utils.github_graphql_queryr   
utils.jsonr   utils.loggerr   
utils.pathr    utils.queue_managerr!   utils.storer"   	utils.urlr#   r$   utils.validater%   utils.versionr&   r'   utils.workaroundsr(   baser)   r   REPOSITORY_KEYS_TO_EXPORTHACS_MANIFEST_KEYS_TO_EXPORTr-   srB   r   r   r   r   r   r?   r8   r5   <module>r     sY    "  " 	    %  
 C  M  5  ( ! ) ( R R = @ # !   . , < % 1-f rN! , O	    TJ* J* J*Z T3* 3* 3*l   C Cr8   