+
     hZ  c                  s   ^ RI Ht ^ RIt^ RIHtHtHtHt ^ RIt^RI	H
t
HtHtHt ^RIHtHt ^RIHtHtHtHtHtHt ]'       d	   ^RIHtHt . ROtRRR	RR
^/R R lltR R ltR/ /R R lltR R ltR t R R lt!R R lt"R R lt#R# )i    )annotationsN)TYPE_CHECKINGAnyTupleUnion)
PartialTag
ResultListTag_parse_results)	FrontPageMember)BASE_URLgenerate_login_cookiesget_pageget_page_typerequestsoup)RSSTypeSearchCategoryquerysortpagec          
     s,    V ^8  d   QhRRRRRRRRR	R
/# )   categoryr   r   strr   zTuple[str, str]r   Zintreturnr    Zformat   "//usr/lib/python3.14/site-packages/moddb/base.py__annotate__r      sC     D DD D 	D
 D D    c               s
   V'       d   V^ ,           RV^,           2MRpVP                  RR4      pV'       d   VP                  MRp\         RV P                   RV 2pVP	                  4        UU	u/ uF%  w  r\        V	R4      '       g   K  WP                  bK'  	  p
pp	RRR	VR
VRVRVP                  RR4      /V
Cp\        VVR7      p\        V4      w  rpp\        VVVV\         RV P                   2VR7      # u up	pi )a)  Search for for a certain type of models and return a list of thumbnails of that
model. This function was created to make full use of moddb's filter and sorting system as
long as the appropriate parameters are passed. Because this function is a single one for every
model type in moddb the parameters that can be passed vary between model type but the
documentation will do its best to document all the possibilities. All the objects listed in this
function are enumerations. Finally it is key to note that the result attribute of the returned search
object is not a list of the parsed pages but a list of Thumbnail objects containing the image, url,
name and type of the object on which. Call the thumbnail's parse method and it will return the full model.

Parameters
------------
category : SearchCategory
    The model type that you want to search
query : str
    String to search for in the model title
sort : Tuple[str, str]
    The tuple to sort by, look at the models your are searching for documentation
    on sorting.
page : int
    The page of results to get first
filters : dict
    Search filters

Returns
--------
ResultList
    The search object containing the current query settings (so at to be able to redo the search easily),
    pagination metadata and helper methods to navigate the list of results.
-NgameZ/z/page/valuefilterZtZkwr   ZyearZyearsparams)resultstotal_pagescurrent_pager%   urltotal_results)
ZgetZidr   nameZitemsZhasattrr"   r   r   r   )r   r   r   r   filtersZ
sort_readyr!   r)   keyr"   Zfilter_parsedr%   htmlr&   r(   r'   r*   s   &$$$,            r   searchr/      s   J ,0DG9Ad1gY'TJ;;vt$D477DJafTF
3C8?c*#7SXZaKb%S++%Mc 	#e
GT* F D
 9Gt8L5G;!j(--)# % ds   3C?C?c               s     V ^8  d   QhRRRR/# )r   r)   r   r   r   r   r   r   r   r   r   Z   s      C C r   c                s    \        V 4      p\        V 4      p\        \        P                  R,          VP
                  P                  4       4      ! V4      pV# )zParse a url and return the appropriate object.

Parameters
------------
url : str
    The url to parse

Returns
--------
Model
    The parsed page as the instance of the model the page represents, can be anything like
    Mod or Game
moddb)r   r   Zgetattrsysmodulesr+   Ztitle)r)   r.   Z	page_typeZmodels   &   r   
parse_pager3   Z   sC     C=Dc"ICKK()..*>*>*@A$GELr   r%   c               s$    V ^8  d   QhRRRRRR/# )r   r)   r   r%   Zdictr   r   r   r   r   r   r   r   p   s!     & &s &t &Z &r   c          	     s   \        \        P                  ! RWR7      4      p\        VP                  4      p\        V4      w  rErgVP                  P                  R4      pV^ ,          P                  R4      ^ ,          p / p	\        V4      ^8  d7   V^,          P                  R4       F  p
V
P                  R4      w  rWV&   K  	  \        VVVV VV	R7      # )a'  Parse a list of results and return them as a
list of thumbnails.

Parameters
-----------
url : str
    The url of the result list to parse

Returns
--------
ResultList
    The list of thumbnails, wrapped in a ResultList
    so as to benefit from the helper methods that
    help with navigation
ZGETr$   Z?z/pageZ&Z=)r&   r'   r(   r)   r*   r%   )
r   requestsZRequestr   Ztextr   r)   ZsplitZlenr   )r)   r%   Zrespr.   r&   r(   r'   r*   Zpartsr,   r#   r-   r"   s   &$           r   parse_resultsr5   p   s    " 8##E3>?D		?D8Ft8L5G;HHNN3E
(..
!!
$CG
5zA~AhnnS)Fc*JC CL * !# r   c               s$    V ^8  d   QhRRRRRR/# )r   usernamer   passwordr   r
   r   r   r   r   r   r      s&     P PC P3 P6 Pr   c           
     s    \        W4      \        P                  R,          P                  n        \        \        \         RV P                  RR4       24      4      # )a  Login the user to moddb through the library, this allows user to see guest comments and see
private groups they are part of.

Parameters
-----------
username : str
    The username of the user
password : str
    The password associated to that username

Raises
-------
ValueError
    The password or username was incorrect

Returns
--------
Member
    The member you are logged in as
r0   z	/members/Z_r    )	r   r1   r2   SESSIONcookiesr
   r   r   Zreplace)r6   r7   s   &&r   loginr:      sJ    , ,B(+UCKK  ((hZy1A1A#s1K0LMNOOr   c                 sx    \         P                  R,          P                  P                  P	                  4        R# )zLogs the user out by clearing the cookies, all unapproved guest comments will be hidden and
all private groups will be hidden once more
r0   N)r1   r2   r8   r9   Zclearr   r   r   logoutr;      s%     KK  ((..0r   c                   V ^8  d   QhRR/# )r   r   r	   r   r   r   r   r   r      s      I r   c                 s6    \        \        4      p \        V 4      # )zThis returns a model representing the front page of  May sound fancy but it is no more
than a collection of popular mods, files, games and articles. In addition jobs are listed
and a poll.

Returns
--------
FrontPage
    The front page object.

)r   r   r	   )r.   s    r   
front_pager=      s     HDT?r   c               r<   )r   rss_typer   r   r   r   r   r   r      s     A A' Ar   c                s"    RV P                    R2# )zGet the RSS feed url for the entire site depending on which feed type you want

Parameters
-----------
rss_type : RSSType
    The type of feed you desire to get

Returns
--------
str
    URL for the feed type
zhttps://rss.moddb.com/z/feed/rss.xml)r+   )r>   s   &r   rssr?      s     $HMM?-@@r   c               r<   )r   tagzUnion[str, PartialTag, Tag]r   r   r   r   r   r      s      0 r   c                sr    \        V \        \        34      '       d   V P                  p RV  2p\	        V4      # )zSearch for entities tagged with a tag-id or Tag.

Parameters
-----------
tag : Union[str, PartialTag, Tag]
    Either a name-id or the Tag to search for

Returns
--------
ResultList[Thumbnail]
    List of entities tagged with this
zhttps://www.moddb.com/tags/)Z
isinstancer   r   Zname_idr5   )r@   r)   s   & r   search_tagsrA      s6     #Z())kk'u
-Cr   )r/   r3   r:   r;   r=   r5   )$Z
__future__r    r1   Ztypingr   r   r   r   r4   Zboxesr   r   r   r   Zpagesr	   r
   Zutilsr   r   r   r   r   r   Zenumsr   r   Z__all__r/   r3   r5   r:   r;   r=   r?   rA   r   r   r   <module>rB      s    " 
 3 3  > > $ [ [. UD D !	D
 DN,&b &RP41A r   