
    `gj7s                       U d Z ddlmZ ddlZddlZddlZddlZddlZddl	m
Z
mZ ddlmZmZ ddlmZmZmZ ed   ZdZd	Zdad
ed<    ej.                         Z e
d       G d d             Z e
d       G d d             Z e
d       G d d             Z e
d       G d d             Zd5d6dZd5d6dZdddd	 	 	 	 	 	 	 	 	 d7dZ	 	 	 	 	 	 	 	 d8dZ 	 	 	 	 	 	 	 	 d9dZ!d:dZ"dd	d	 	 	 	 	 d;d Z#	 	 	 	 	 	 	 	 d<d!Z$	 	 	 	 d=d"Z%	 	 	 	 	 	 	 	 d>d#Z&d?d$Z'd@d%Z(	 d5	 	 	 	 	 dAd&Z)	 	 	 	 	 	 	 	 	 	 dBd'Z*	 	 	 	 	 	 	 	 dCd(Z+dDd)Z,dEd*Z-dFd+Z.ddd,	 	 	 	 	 	 	 	 	 dGd-Z/dHd.Z0dId/Z1dJd0Z2dKd1Z3dLd2Z4dMd3Z5dJd4Z6y)Nz3Normalized Nous Portal account entitlement helpers.    )annotationsN)	dataclassfield)datetimetimezone)AnyLiteralOptional)jwtaccount_apiinference_keynoneerror)	firecrawlfalz	fal-videozopenai-audiozbrowser-usemodal<   z1tuple[str, float, 'NousPortalAccountInfo'] | None_account_info_cacheT)frozenc                  p    e Zd ZU dZded<   dZded<   dZded<   dZded<   dZded	<   dZ	ded
<   dZ
ded<   y)NousPortalSubscriptionInfoNOptional[str]planOptional[int]tierOptional[float]monthly_chargemonthly_creditscurrent_period_endcredits_remainingrollover_credits)__name__
__module____qualname__r   __annotations__r   r   r   r   r    r!        J/root/.hermes/venv/lib/python3.12/site-packages/hermes_cli/nous_account.pyr   r   $   sK    D-D-&*NO*'+O_+(,,)--(,o,r'   r   c                      e Zd ZU dZded<   dZded<   dZded<   dZded<   dZded	<   dZ	ded
<   dZ
ded<   dZded<   dZded<   dZded<   dZded<   dZded<   y)NousPaidServiceAccessInfoNOptional[bool]allowedpaid_accessr   reasonorganisation_idr   effective_at_mshas_active_subscriptionactive_subscription_is_paidsubscription_tierr   subscription_monthly_chargesubscription_credits_remainingpurchased_credits_remainingtotal_usable_credits)r"   r#   r$   r,   r%   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r&   r'   r(   r*   r*   /   s    "G^""&K& FM %)O])%)O]).2^2266'+}+3776:"O:377,0/0r'   r*   c                  <    e Zd ZU dZdZded<    ee      Zded<   y)	NousToolAccessInfoa/  Free tool-pool entitlement, decoupled from paid/billing access.

    Mirrors the Portal's ``tool_access`` claim/field: ``enabled`` is true when a
    positive tool-pool balance is live and not gated off; ``coverage`` maps each
    tool category to whether the pool funds it (FAL video is excluded).
    Fboolenabled)default_factoryzdict[str, bool]coverageN)	r"   r#   r$   __doc__r;   r%   r   dictr=   r&   r'   r(   r9   r9   ?   s"     GT %d ;Ho;r'   r9   c                     e Zd ZU ded<   ded<   ded<   dZded<   dZded	<   dZded
<   dZded<   dZded<   dZ	ded<   dZ
ded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZd ed!<   dZd ed"<   dZded#<   ed(d$       Zed(d%       Zed(d&       Zd)d'Zy)*NousPortalAccountInfor:   	logged_inNousAccountInfoSourcesourcefreshNr   user_idorg_idorg_slugorg_name	client_id
product_idnous_clientportal_base_urlinference_base_urlFinference_credential_presentcredential_sourcezOptional[datetime]
expires_atemail	privy_did$Optional[NousPortalSubscriptionInfo]subscriptionr+   paid_service_access#Optional[NousPaidServiceAccessInfo]paid_service_access_infoOptional[NousToolAccessInfo]tool_accessOptional[dict[str, Any]]
raw_claimsraw_accountr   c                    | j                   du S )NTrV   selfs    r(   is_paidzNousPortalAccountInfo.is_paidg   s    ''4//r'   c                    | j                   du S )NFr_   r`   s    r(   is_free_tierz"NousPortalAccountInfo.is_free_tierk   s    ''500r'   c                l    | j                   du ry| j                  duxr | j                  j                  S )zCoarse "entitled to any managed tool" gate: paid access OR a live
        free tool pool. Use :meth:`tool_gateway_entitled_for` to gate a specific
        tool category (the pool does not cover every category).TN)rV   rZ   r;   r`   s    r(   tool_gateway_entitledz+NousPortalAccountInfo.tool_gateway_entitledo   s7    
 ##t+t+H0@0@0H0HHr'   c                    | j                   du ry| j                  }t        |xr+ |j                  xr |j                  j                  |      du       S )zWhether a specific tool category is entitled. Paid users are entitled
        everywhere; free tool-pool users only where ``coverage[category]`` is
        true (e.g. image but not video).T)rV   rZ   r:   r;   r=   get)ra   categorytas      r(   tool_gateway_entitled_forz/NousPortalAccountInfo.tool_gateway_entitled_forx   sK     ##t+BK2::K"++//(*Ct*KLLr'   )returnr:   )ri   strrl   r:   )r"   r#   r$   r%   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rU   rV   rX   rZ   r\   r]   r   propertyrb   rd   rf   rk   r&   r'   r(   rA   rA   L   s1   O!!K!G]! FM "Hm""Hm"#I}# $J$!%K%%)O])(,,). $.'+}+%)J")E=#I}#9=L6=*..DHAH04K-4+/J(/,0K)0E=0 0 1 1 I IMr'   rA   c                    	 ddl m} d}| | j                  }t	        |t
              r|j                         s|}|j                  d       dS # t        $ r d}Y Sw xY w)z>Return the billing URL for a normalized Nous account snapshot.r   )DEFAULT_NOUS_PORTAL_URLhttps://portal.nousresearch.comN//billing)hermes_cli.authrp   	ExceptionrM   
isinstancerm   striprstrip)account_inforp   bases      r(   nous_portal_billing_urlr{      sj    D; D++dC 

&kk#x((  D"CDs   A AAc                    t        |       }|dt        d        }| t        | dd      nd}t        |t              r4|j                         r$ddlm} | d ||j                         d       d	S | d	S )
aN  Return the portal top-up URL that auto-opens the top-up modal.

    Prefers the org-pinned page ``{base}/orgs/{slug}/billing?topup=open`` (skips
    the legacy shim's re-resolution + multi-org disambiguation). Falls back to the
    legacy ``{base}/billing?topup=open`` when the account has no ``org_slug`` (the
    portal's ``slug`` is nullable; the legacy page forwards the param through to
    the org-pinned page). Never builds ``/orgs/None/billing``.

    The ``?topup=open`` query is the NAS enabler that lands the user in the
    top-up flow rather than just on the billing page.
    Nrs   rH   r   )quotez/orgs/ )safez/billing?topup=open)r{   lengetattrrv   rm   rw   urllib.parser}   )ry   base_billingrz   slugr}   s        r(   nous_portal_topup_urlr      s}     +<8L*3z?*+D6B6N7<T2TXD$&veDJJLr:;;NOOV&''r'   zthis feature)
capabilityinclude_refresh_hintcoverage_categoryc               @   t        |       }| 5|&| j                  |      ry| j                  r| d| dS | j                  ry| 	d| d| dS | j                  s| j                  r	d| d| dS d| d	| dS | j
                  7d
| d}| j                  r|d| j                   dz  }|r|dz  }|d| dz  }|S | j                  }|r|j                  nd}|dk(  rd| dS |dk(  s| j
                  du r"t        | ||      }|r| j                  s|dz  }|S d| d| dS )u   Return user-facing guidance for a missing Nous tool-gateway entitlement.

    ``None`` means the account is entitled to use the capability — via paid
    service access OR a live free tool pool that covers it. The message works
    from normalized entitlement fields rather than subscription price alone:
    purchased credits without a subscription still count as paid access, while a
    paid subscription with exhausted usable credits does not.

    ``coverage_category`` scopes the check to a single tool category (e.g.
    ``"fal-video"``). When given, a user who is entitled overall but whose
    access does not fund that category gets a neutral billing nudge instead of a
    message implying their credits are exhausted. The pool-vs-paid distinction is
    never surfaced to the user.
    Nzd isn't included with your current Nous Portal access. Add credits or a subscription to enable it at .z9Hermes could not verify your Nous Portal entitlement, so zO is unavailable. Run `hermes model` to refresh your login, or check billing at zeNous inference credentials are configured, but Hermes cannot verify your Nous Portal paid access for zc. Log in with `hermes model` to enable Portal-managed features. Billing and credits are managed at zLog in to Nous Portal to use z9: run `hermes model`. Billing and credits are managed at z9Hermes could not verify your Nous Portal paid access, so z is unavailable.z Account lookup failed: z, Run `hermes model` to refresh your session.z Check billing at account_missingzOHermes could not find a Nous Portal account or organisation for this login, so zi is unavailable. Run `hermes model` to authenticate again; if the problem persists, contact Nous support.no_usable_creditsFzF If you recently bought credits, run `hermes model` to refresh Hermes.zIYour Nous Portal account does not currently have paid service access, so 2 is unavailable. Add credits or update billing at )r{   rk   rf   rB   rO   rV   r   rX   r.   _no_paid_access_messagerE   )	ry   r   r   r   billing_urldetailaccessr.   messages	            r(   &format_nous_portal_entitlement_messager      s   * *,7K(556GH11
 "l #MMXMYZ\ //G
| T%a)	
 !!4444>< @**5a9 ,J< 822=aA	

 ''/G
| T  	 01C1C0DAFFFDDF&{m15522F$V]]$F""# %QR	
 $$(H(HE(Q),
KP(:(:__G\KK=XY	[r'   c                ~   | j                   }|r|j                  nd }|r|j                  nd }|r|j                  nd }|r|j                  nd }|r|j
                  nd }|r|rt        |||      }	d|	 d| d| dS |r|du r	d| d| dS |du rt        |||      }	d|	 d| d	| dS t        |||      }	d
|	 d| d| dS )Nz&Your Nous Portal credits are exhaustedz, so z, is unavailable. Top up or renew credits at r   FzGYour current Nous Portal plan does not include paid service access, so z+ is unavailable. Upgrade or add credits at zEYour Nous Portal account has no active subscription or usable creditsz- is unavailable. Subscribe or add credits at z3Your Nous Portal account has no usable paid creditsr   )rX   r1   r2   r7   r5   r6   _credit_detail)
ry   r   r   r   r1   r2   total_usablesubscription_creditspurchased_creditscredit_details
             r(   r   r     s:   
 22F@Ff<<DHN&"D"DTX286..dLDJ6@@PT>D::$#>&|5IK\]4]O5 U::EaI	

 #>%#GHUVX	

 %'&|5IK\]SoU:, /a!	
 #<1EGXYM
=m_E,HUV	Xr'   c                    g }| |j                  d| d       ||j                  d|d       ||j                  d|d       |syddj                  |       dS )	Nzusable $z.2fzsubscription $zpurchased $r~   z (z, ))appendjoin)r   r   r   partss       r(   r   r   +  s~    
 ExS123'~&:3%?@A${#4S"9:;		% !##r'   c                     da y)z7Clear the short-lived account-info cache used by tests.N)r   r&   r'   r(   $reset_nous_portal_account_info_cacher   <  s
     r'   F)force_freshmin_jwt_ttl_secondsc                   	 ddl m}  |d      xs i }|j	                  d      }t        |      }t        |t              r|j                         s0t        | ||      }||S t        |      }||S t        dd	d|
      S | st        ||||      }	|	|	S t        || |      S # t        $ r}t        |d      cY d}~S d}~ww xY w)af  Return normalized Nous Portal account entitlement information.

    By default, a valid unexpired OAuth access JWT is used as a low-latency
    local account snapshot. ``force_fresh=True`` always calls
    ``/api/oauth/account`` and bypasses the short-lived cache. JWT claims are
    decoded locally for UX gating only; server APIs remain authoritative.
    r   )get_provider_auth_statenousF)r   rB   Naccess_token)r   r   rM   r   )rB   rD   rE   rM   staterM   r   )r   r   rM   )rt   r   ru   _error_inforh   _portal_base_urlrv   rm   rw   _info_from_oauth_pool_info_from_inference_key_poolrA   _info_from_valid_jwt_fresh_account_info)
r   r   r   r   excr   rM   pool_oauth_info	pool_infojwt_infos
             r(   get_nous_portal_account_infor   B  s    7;'/52 99^,L&u-OlC(0B0B0D/# 3+

 &""1/B	 $+	
 	
 '+ 3	
 O' C  7667s   B# #	C,B>8C>Cc           	        	 ddl m}m}  |       } |d      xs | }t        |      xs |}t	        ||      }t
        5  |s>t        8t        \  }}	}
||k(  r)t        j                         |	z
  t        k  r|
cd d d        S d d d        t        ||      }|st        dd|      S t        |j                  d      t              r"t        |j                  d      xs dd||	      S t        |||
      }t
        5  |t        j                         |fad d d        |S # 1 sw Y   xY w# 1 sw Y   |S xY w# t         $ r0}t        |t#        | j                  d            |      cY d }~S d }~ww xY w)Nr   )r   resolve_nous_access_tokenr   empty_account_responseTr   rB   rM   r   account_response_errorr   rB   rM   r]   r   rM   r   )rt   r   r   r   
_cache_key_ACCOUNT_INFO_CACHE_LOCKr   time	monotonic_ACCOUNT_INFO_CACHE_TTL_fetch_nous_account_infor   rv   rh   rm   _info_from_account_payloadru   r:   )r   r   rM   r   r   r   refreshed_state	cache_key
cached_key	cached_atcached_infopayloadinfor   s                 r(   r   r   z  st   *
V021&9BU*?;N|_=	% 	'#6#B5H2
I{*0@90LPg/g&		' 	' 	' +<I. / 
 gkk'*C0kk'*F.F /#	  *!+

 & 	F#,dnn.>"E	F9	' 	'4	F 
599^45+
 	

se   <D3 7D5	D3 ?#D3 #A D3 $D3 8D&	D3 D#D3 &D0+D3 0D3 3	E,<%E'!E,'E,c                h   	 t               }|yt        |dd      xs t        |dd      }t        |t              r|j	                         syt        dddt        |dd      xs | t        |dd      xs t        |d	d      xs t        |d
d      ddt        |dd       d      S # t        $ r Y yw xY w)zEReturn an explicit unknown-entitlement snapshot for opaque Nous keys.Nruntime_api_keyr   r~   Fr   rM   rN   runtime_base_urlbase_urlTpool:labelunknownportal_oauth_missing)rB   rD   rE   rM   rN   rO   rP   r   )_select_nous_pool_entryr   rv   rm   rw   rA   ru   )rM   entryruntime_keys      r(   r   r     s    ')=e%6=cP^`bAc+s+;3D3D3F$"0$7 #" 3T: 45"4d;45*d3)- %geWi&H%IJ(
 	
"  s   B% <B% AB% %	B10B1c           
        	 t               }|t        |      sy t        |dd       }t	        |t
              r|j                         sy t        |dd       xs |}|t        |dd       t        |dd       xs t        |dd       xs t        |dd       t        |dd       dt        |d	d
       d}| st        ||||      }||S 	 t        ||      }|st        dd|      S t	        |j                  d      t
              r"t        |j                  d      xs dd||      S t        |||      S # t        $ r Y y w xY w# t        $ r}	t        |	d|      cY d }	~	S d }	~	ww xY w)Nr   rM   rJ   rN   r   r   	agent_keyr   r   r   )r   rJ   rN   r   rP   r   Tr   r   r   r   r   r   )r   ru   _pool_entry_is_portal_oauthr   rv   rm   rw   r   r   r   rh   r   )
r   r   rM   r   r   entry_portal_urlr   r   r   r   s
             r(   r   r     s   ') }7>5.$7LlC(0B0B0D 	($/ 	 
 %UK6E/6 0u0$70uj$/UK6$WUGY%G$HI
E ', 3	
 O
*<9IJ *,
 	

 '++g&,++g&B*B,	
 	
 &( q  J  
,
 	

s/   
D/ D> /	D;:D;>	EEEEc                     ddl m}   | d      }|r|j                         sy t        |j	                               }|sy dd}t        ||      S )Nr   )	load_poolr   c                    t        t        | dd             xs d}t        t        | dd             xs d}t        t        | dd      xs d      }||| fS )Nagent_key_expires_atg        rQ   priorityr   )_parse_iso_timestampr   int)r   	agent_exp
access_expr   s       r(   _entry_sort_keyz0_select_nous_pool_entry.<locals>._entry_sort_key!  s]    (8NPT)UV]Z]	)'%t*LMTQT
wuj!49::y11r'   )key)r   r   rl   ztuple[float, float, int])agent.credential_poolr   has_credentialslistentriesmax)r   poolr   r   s       r(   r   r     sJ    /VDt++-4<<>"G2 wO,,r'   c                    t        | dd       }t        |t              r|j                         syt        t        | dd      xs d      j                         j	                         }t        | dd       }|j                  d      xs t        |      S )Nr   F	auth_typer~   refresh_tokenoauth)r   rv   rm   rw   lower
startswithr:   )r   r   r   r   s       r(   r   r   *  s{    5.$7LlC(0B0B0DGE;39r:@@BHHJIE?D9M(?D,??r'   c                ~   |xs dj                  d      }| d}d|  dd}t        j                  j                  ||      }t        j                  j	                  |d	      5 }t        j                  |j                         j                               }d d d        t        t              r|S i S # 1 sw Y   xY w)
Nrq   rr   z/api/oauth/accountzBearer zapplication/json)AuthorizationAccept)headers   )timeout)rx   urllibrequestRequesturlopenjsonloadsreaddecoderv   r?   )r   rM   rz   urlr   reqrespr   s           r(   r   r   3  s     @@HHMDF$
%C"<.1$G ..
 
 g
 
6C			Q		/ 34**TYY[//123 $/77R73 3s   %2B33B<c          
        	 ddl m}  ||       }|sy t        |j	                  d            }|-|t        j
                         t        dt        |            z   k  ry t        |j	                  d            }t        |j	                  d            }t        ||t        |j	                  d            |      }	t        di dd	d
ddddt        |j	                  d            dt        |j	                  d            dt        |j	                  d      xs |j	                  d            dt        |j	                  d            dt        |j	                  d            d|dt        |j	                  d            dd	dt        |j	                  d            xs ddt        j                  |t        j                         d|d|	dt#        |j	                  d            dt%        |      S # t        $ r Y y w xY w)Nr   )_decode_jwt_claimsexpr-   r3   rG   )r,   r-   r/   r3   rB   TrD   r   rE   FrF   subrJ   rK   rL   rM   rN   rO   rP   
auth_storerQ   )tzrV   rX   rZ   r\   r&   )rt   r  ru   _coerce_floatrh   r   r   r   _coerce_bool_coerce_intr*   _coerce_strrA   r   fromtimestampr   utc_tool_access_from_valuer?   )
tokenr   rM   r   r  claimsr  r-   r3   access_infos
             r(   r   r   C  s   6  &F


5)
*C
{cTYY[3q#6I2J+KKKvzz-89K#FJJ/B$CD+#FJJx$89+	K !   FJJu-.	
 6::h/0 fjj5O;9OP vzz,78  

= 9: ( 'uyy1E'FG &* &eii0C&DEU ))#(,,? ( "-  ,FJJ},EF!" <# )  s   G7 7	HHc          
         | j                  d      }t        |t              r|ni }| j                  d      }t        |t              r|ni }t        | j                  d            }t	        | j                  d            }|r|j
                  nd }	|	||j                  }	t        di ddddd	dd
t        |j                  d            xs |r|j                  nd dt        |j                  d            dt        |j                  d            dt        |j                  d            d|dt        |j                  d            dt        |j                  d      xs |j                  d            dt        |j                  d            xs ddt        |j                  d            dt        |j                  d            d|d|	d|dt        | j                  d            dt        |       S )NuserorganisationrU   rV   rB   TrD   r   rE   rG   idrH   r   rI   namerJ   rM   rN   rO   r   r   rP   r  rR   rS   rX   rZ   r]   r&   )rh   rv   r?   _subscription_from_payload!_paid_service_access_from_payloadr,   r-   rA   r	  r/   r:   r  )
r   r   rM   raw_userr  raw_orgr  rU   r   r-   s
             r(   r   r   u  s    {{6"H'1(D'A8rDkk.)G.8$.G7RL-gkk..IJL.w{{;P/QRF$*&..Kv1((    <++D12bQWv7M7M]a	
 \--f56 \--f56 eii45 ( 'uyy1E'FG &*%))N*C*]uyyQ\G]%^ &eii0C&DEU $((7+, dhh{34 " (  "(!" ,GKK,FG#$ M% r'   c                   t        | t              syt        | j                  d            du }| j                  d      }i }t        |t              r0|j	                         D ]  \  }}t        |t
              s|du ||<    t        ||      S )zParse a Portal ``tool_access`` object (from the JWT claim or the account
    API) into :class:`NousToolAccessInfo`. Fails closed: a non-object value
    yields ``None``, and only literal ``true`` counts for ``enabled`` and each
    coverage entry.Nr;   Tr=   )r;   r=   )rv   r?   r  rh   itemsrm   r9   )valuer;   raw_coverager=   r   vals         r(   r  r    s    
 eT"599Y/0D8G99Z(L "H,%$**, 	,HC#s# #t	, gAAr'   c                   t        | t              sy t        t        | j	                  d            t        | j	                  d            t        | j	                  d            t        | j	                  d            t        | j	                  d            t        | j	                  d            t        | j	                  d                  S )	Nr   r   r   r   r   r    r!   )r   r   r   r   r   r    r!   )rv   r?   r   r	  rh   r  r  r  s    r(   r  r    s    eT"%6*+6*+$UYY/?%@A%eii0A&BC&uyy1E'FG'		2E(FG&uyy1C'DE r'   c                   t        | t              sy t        | j                  d            }t        | j                  d            }t	        ||t        | j                  d            t        | j                  d            t        | j                  d            t        | j                  d            t        | j                  d            t        | j                  d            t        | j                  d	            t        | j                  d
            t        | j                  d            t        | j                  d                  S )Nr,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   )r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   )rv   r?   r  rh   r*   r	  r  r  )r  r,   r-   s      r(   r  r    s    eT"599Y/0Guyy78K$599X./#EII.?$@A#EII.?$@A ,UYY7P-Q R$0;X1Y$Z%eii0C&DE$1%))<Y2Z$['4UYY?_5`'a$1%))<Y2Z$[*5995K+LM r'   )rM   r]   c           
     6    t        |dd||t        |             S )Nr   F)rB   rD   rE   rM   r]   r   )rA   rm   r   s       r(   r   r     s'     !'%j r'   c                    | j                  d      }t        |t              r|j                         sy |j                         j	                  d      S )NrM   rr   )rh   rv   rm   rw   rx   )r   r  s     r(   r   r     s=    II'(EeS!;;=$$r'   c                |    t        j                  | j                  d            j                         }|xs d d| S )Nzutf-8r~   :)hashlibsha256encode	hexdigest)r   rM   digests      r(   r   r     s;    ^^L//89CCEF#$AfX..r'   c                    t        | t              r| sy | j                         }|j                  d      r|d d dz   }	 t	        j
                  |      j                         S # t        $ r Y y w xY w)NZz+00:00)rv   rm   rw   endswithr   fromisoformat	timestampru   )r  texts     r(   r   r     si    eS!;;=D}}SCRy8#%%d+5577 s   "A! !	A-,A-c                ,    t        | t              r| r| S y N)rv   rm   r  s    r(   r	  r	    s    %%r'   c                *    t        | t              r| S d S r2  )rv   r:   r  s    r(   r  r    s    ud+555r'   c                l    t        | t              ry 	 | y t        |       S # t        t        f$ r Y y w xY wr2  )rv   r:   r   	TypeError
ValueErrorr  s    r(   r  r    s=    %=5zz"    ! 
! 33c                l    t        | t              ry 	 | y t        |       S # t        t        f$ r Y y w xY wr2  )rv   r:   floatr5  r6  r  s    r(   r  r    s=    %=U|z" r7  r2  )ry   Optional[NousPortalAccountInfo]rl   rm   )
ry   r:  r   rm   r   r:   r   r   rl   r   )ry   rA   r   rm   r   rm   rl   rm   )r   r   r   r   r   r   rl   rm   )rl   None)r   r:   r   r   rl   rA   )r   dict[str, Any]r   r:   rM   r   rl   rA   )rM   r   rl   r:  )r   r:   r   r   rM   r   rl   r:  )rl   zOptional[Any])r   r   rl   r:   )r   rm   rM   r   rl   r<  )
r  rm   r   r<  rM   r   r   r   rl   r:  )r   r<  r   r<  rM   r   rl   rA   )r  r   rl   rY   )r  r   rl   rT   )r  r   rl   rW   )
r   objectrB   r:   rM   r   r]   r[   rl   rA   )r   r<  rl   r   )r   rm   rM   r   rl   rm   )r  r   rl   r   )r  r   rl   r   )r  r   rl   r+   )r  r   rl   r   )7r>   
__future__r   r%  r   	threadingr   urllib.requestr   dataclassesr   r   r   r   typingr   r	   r
   rC   TOOL_COVERAGE_CATEGORIESr   r   r%   Lockr   r   r*   r9   rA   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'   r(   <module>rE     s"   9 "      ( ' ) )   VW    IM F M)9>>+  $- - - $1 1 1 $	< 	< 	< $2M 2M 2Mj)(4 %!%'+X1X X 	X
 %X Xv%'%% % 		%P$!$)$ '$ 		$" !55 5 	5p2
2
 2
 #	2

 2
j"$BDD D #	D
 %DN-&@ &*88"8 8 // / #	/
 / %/d## # #	#
 #LB"2 &*,0  #	
 * "%/
	6r'   