
    i                        S SK r S SKrS SKJr  S SKJrJrJrJrJ	r	J
r
JrJrJr  S SKrS SKJr  S SKJr  S SKJr  S SKJr  S SKJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$  S S	K%J&r&J'r'J(r(J)r)  S S
K*J+r+J,r,  S SK-J.r.J/r/J0r0J1r1  S SK2J3r3  S SK4J5r5J6r6  Sr7S\8S\\   SS4S jr9S\8S\
\\:\:\:4      S\84S jr; " S S\/5      r<\ Rz                   " S S5      5       r>S\\\?4   S\,S\?4S jr@S\3S\84S jrAg)    N)	timedelta)	TYPE_CHECKINGAnyDictIterableListOptionalTupleUnionoverload)Self)exc)	copy_self)	ParamDict)CategoryContentLayout	FileEntry
InfoFilterRatioLimitsSeedingTimeLimitsShareLimitActionStopConditionTorrentInfoTorrentPropertiesTorrentSSLParametersTrackerWebSeed)InfoHash
InfoHashesInfoHashesOrAll_info_hash_str)MinutesTimeUnit)	APIClientAPIGroupsincevirtual)StrPath)
APIVersionClientVersion)AddFormBuilderTorrentsAPIparamvaluereturnc                 L    [        U[        5      (       a  [        U < S35      eg)z.Explicitly reject ``str`` as ``Iterable[str]``z refused str as iterableN)
isinstancestr
ValueError)r-   r.   s     @/app/mltbenv/lib/python3.13/site-packages/aioqbt/api/torrents.py_check_iterable_except_strr5   '   s'    %E9$<=>>     filterapi_versionc                    Sn[         R                  " US5      S:  aN  U [        R                  :X  a  Sn[        R                  n OoU [        R
                  :X  a  Sn[        R                  n OHU [        R                  :X  a  [        R                  n U [        R                  :X  a  [        R
                  n Ub  SSKnUR                  U[        SS9  U $ )zO
Normalize info filter across qBittorrent versions
and issue warnings about it
N      r   r   z3Please migrate RESUMED to RUNNING in qBittorrent v5z2Please migrate PAUSED to STOPPED in qBittorrent v5   
stacklevel)
r)   comparer   RESUMEDRUNNINGPAUSEDSTOPPEDwarningswarnDeprecationWarning)r7   r8   msgrE   s       r4   _adapt_info_filterrI   -   s     C+z2a7Z'''GC''Fz(((FC''FZ'''''FZ'''&&F
c-!<Mr6   c                      \ rS rSrSrS\4S jr        SjS\\   S\\   S\\   S	\\	   S
\\   S\\   S\\
   S\\   S\\   4S jjrS\S\4S jrS\S\\   4S jrS\S\\   4S jr SkS\S\\\      S\\   4S jjrS\S\\   4S jrS\S\\   4S jrS\
SS4S jrS\
SS4S jrS\
SS4S jrS\
SS4S jrS\
S\	SS4S jrS\
SS4S jrS\
SS4S jr S\!RD                  SS4S  jr#S\S!\\   SS4S" jr$\%" S#5      S\S$\S%\SS4S& j5       r&S\S'\\   SS4S( jr'S\(S)\\   SS4S* jr)S\
SS4S+ jr*S\
SS4S, jr+S\
SS4S- jr,S\
SS4S. jr-S\S/\\   S0\SS4S1 jr.S\
S\/\\4   4S2 jr0S\
S
\SS4S3 jr1 SkS\
S4\2\3\44   S5\2\5\\64   S6\2\5\\6S4   SS4
S7 jjr7S\
S\/\\4   4S8 jr8S\
S
\SS4S9 jr9S\
S:\:SS4S; jr;S/\
S<\:SS4S= jr<S/\
S<\:SS4S> jr=S\S?\SS4S@ jr>S\
S\SS4SA jr?S\/\\@4   4SB jrAS\SC\:SS4SD jrBS\SC\:SS4SE jrCSF\\   SS4SG jrD\%" SH5      S\
SI\\   SS4SJ j5       rE\%" SH5      S\
SI\\   SS4SK j5       rF\%" SH5      S\\   4SL j5       rG\%" SH5      SI\\   SS4SM j5       rH\%" SH5      SI\\   SS4SN j5       rIS\
SO\	SS4SP jrJS\
SS4SQ jrK\LS\
SR\	SS4SS j5       rMS\
SS4ST jrN\LS\
SR\	SS4SU j5       rOS\
SV\	SS4SW jrPS\
SR\	SS4SX jrQ\RS\S/\S?\SS4SY j5       rS\RS\SZ\S[\SS4S\ j5       rSS\S]\TS^\TSS4S_ jrS\%" S`5      S\SZ\S[\SS4Sa j5       rUS\S\V4Sb jrW\%" Sc5      S\S\X4Sd j5       rY\%" Sc5      S\Se\Sf\Sg\SS4
Sh j5       rZSir[g)lr,   Q   z!
API methods under ``torrents``.
r/   c                 X   #    U R                  SS5      I Sh  vN n[        U5      $  N7f)z
Get the number of torrents
GETztorrents/countN)_request_textint)selfresults     r4   countTorrentsAPI.countV   s3     
 ))
 
 6{	
s   *(*Nr7   categorysortreverselimitoffsethashestagc	                   #    Ub.  [        XR                  5       R                  5      n[        U5      nUc  [	        5       n	O[        R
                  " U5      n	U	R                  SU5        U	R                  SU5        U	R                  SU5        U	R                  SU5        U	R                  SU5        U	R                  SU5        Ub  U	R                  SU5        U R                  [        S	S
U	S9I Sh  vN $  N7f)a  
Get a list of :class:`.TorrentInfo`.

To obtain a list of completed torrents sorted by name::

    torrents = await client.torrents.info(
        filter=InfoFilter.COMPLETED,
        sort="name",
    )

See also :APIWiki:`torrents/info <#get-torrent-list>`
for filter and result meanings.

:param filter: State filter: :class:`.InfoFilter` or ``str``.
:param category: category filter.
:param sort: Sort results by an attribute/field.
:param reverse: Reverse the results.
:param limit: Maximum number of returned results.
:param offset: Results starting from the ``offset``-th torrents.
:param hashes: A list of info hashes, or a str ``all``.
:param tag: Tag filter.
Nr7   rT   rU   rV   rW   rX   rZ   rM   ztorrents/infoparams)rI   _clientr8   r2   r   with_hashesoptional_stroptional_booloptional_int_request_mapped_listr   )
rP   r7   rT   rU   rV   rW   rX   rY   rZ   r]   s
             r4   infoTorrentsAPI.infoa   s     D '0J0JKF[F>[F**62FHf-J1FD)Y0GU+Hf-?s+..	 / 
 
 	
 
s   C0C92C73C9hashc                    #    U R                  [        SS[        R                  " U5      S9I Sh  vN n[	        US5      (       d  [        U5      Ul        U$  N'7f)zGet properties of a torrent.rM   ztorrents/propertiesr\   Nrf   )_request_mapped_objectr   r   	with_hashhasattrr!   rf   )rP   rf   propss      r4   
propertiesTorrentsAPI.properties   s]      11!&&t,	 2 
 
 uf%%'-EJ
s   .AA(Ac                 r   #    U R                  [        SS[        R                  " U5      S9I Sh  vN $  N7f)zTrackers in a torrent.rM   ztorrents/trackersr\   N)rc   r   r   ri   rP   rf   s     r4   trackersTorrentsAPI.trackers   s@      ..&&t,	 / 
 
 	
 
   .757c                 r   #    U R                  [        SS[        R                  " U5      S9I Sh  vN $  N7f)zWeb seeds in a torrent.rM   ztorrents/webseedsr\   N)rc   r   r   ri   ro   s     r4   webseedsTorrentsAPI.webseeds   s>     ..&&t,	 / 
 
 	
 
rr   indexesc                    #    [         R                  " U5      nUb  UR                  SUS5        U R                  [        SSUS9I Sh  vN $  N7f)zFiles in a torrent.Nrv   |rM   ztorrents/filesr\   )r   ri   optional_listrc   r   )rP   rf   rv   r]   s       r4   filesTorrentsAPI.files   s]      $$T*  GS9..	 / 
 
 	
 
s   AAA	Ac                 h   #    U R                  SS[        R                  " U5      S9I Sh  vN $  N7f)z
A list of piece states in a torrent.

To compare results, use following constants from :class:`~.PieceState` enum:

* :attr:`.PieceState.UNAVAILABLE`
* :attr:`.PieceState.DOWNLOADING`
* :attr:`.PieceState.DOWNLOADED`

rM   ztorrents/pieceStatesr\   N_request_jsonr   ri   ro   s     r4   piece_statesTorrentsAPI.piece_states   s=      ''"&&t, ( 
 
 	
 
   )202c                 h   #    U R                  SS[        R                  " U5      S9I Sh  vN $  N7f)z&
A list of piece hashes in a torrent.
rM   ztorrents/pieceHashesr\   Nr}   ro   s     r4   piece_hashesTorrentsAPI.piece_hashes   s=     
 ''"&&t, ( 
 
 	
 
r   c                    #    U R                  5       n[        R                  " UR                  S5      S:  a  SnOSnU R	                  SU[
        R                  " U5      S9I Sh  vN   g N7f)zf
Stop torrents.

Torrents can be specified by their info hashes.
Passing ``all`` stops all torrents.

r:   r   ztorrents/stopztorrents/pausePOSTdataNr^   r)   r@   r8   rN   r   with_hashes_or_allrP   rY   clientendpoints       r4   stopTorrentsAPI.stop   sh      f00*=B&H'H  --f5 ! 
 	
 	
   A#A-%A+&A-c                 @   #    U R                  U5      I Sh  vN $  N7f)zAlias of :meth:`.stop`.N)r   rP   rY   s     r4   pauseTorrentsAPI.pause  s     YYv&&&&   c                    #    U R                  5       n[        R                  " UR                  S5      S:  a  SnOSnU R	                  SU[
        R                  " U5      S9I Sh  vN   g N7f)zh
Start torrents.

Torrents can be specified by their info hashes.
Passing ``all`` starts all torrents.

r:   r   ztorrents/startztorrents/resumer   r   Nr   r   s       r4   startTorrentsAPI.start
  sh      f00*=B'H(H  --f5 ! 
 	
 	
r   c                 @   #    U R                  U5      I Sh  vN $  N7f)zAlias of :meth:`.start`.N)r   r   s     r4   resumeTorrentsAPI.resume   s     ZZ''''r   delete_filesc                    #    US:w  a  [        SU5        [        R                  " U5      nUR                  SU5        U R	                  SSUS9I Sh  vN   g N7f)z
Delete torrents.

Torrents can be specified by their info hashes.
Passing ``all`` deletes all torrents.

Pass ``True`` to ``delete_files`` to remove downloaded content.
allrY   deleteFilesr   ztorrents/deleter   N)r5   r   r   required_boolrN   )rP   rY   r   r   s       r4   deleteTorrentsAPI.delete$  s^      U?&x8++F3=,7   ! 
 	
 	
   AAAAc                 j   #    U R                  SS[        R                  " U5      S9I Sh  vN   g N7f)zRecheck torrents.r   ztorrents/recheckr   NrN   r   r   r   s     r4   recheckTorrentsAPI.recheck:  s8        --f5 ! 
 	
 	
   )313c                 j   #    U R                  SS[        R                  " U5      S9I Sh  vN   g N7f)zReannounce torrents.r   ztorrents/reannouncer   Nr   r   s     r4   
reannounceTorrentsAPI.reannounceC  s8     
   !--f5 ! 
 	
 	
r   formc                 b  #    U R                  SSUS9I Sh  vN nU ISh  vN   UR                  5       I Sh  vN nUS:w  a7  [        R                  R	                  U5      nUR                  S5      Ul        UeSSS5      ISh  vN   g Nu Nl NV N! , ISh  vN  (       d  f       g= f7f)a  
Add torrents by URLs, info hashes, and/or file blobs.

See :class:`.AddFormBuilder` on how to configure and build
:class:`~aiohttp.FormData` to submit.

.. note::

    :exc:`~.exc.AddTorrentError` may raise if no *new* torrents
    are added.

:param form: form data to submit.
r   ztorrents/addr   Ns   Ok.zutf-8)_requestreadr   AddTorrentErrorfrom_responsedecodemessage)rP   r   respbodyexs        r4   addTorrentsAPI.addN  s      ]] # 
 
 4$Dv~((66t<![[1
 44
 $ 444se   B/B
B/BB/BBAB<B/BB/B/BB/B,BB,(B/rp   c                    #    [        SU5        [        R                  " U5      nUR                  SUS5        U R	                  SSUS9I S h  vN   g  N7f)Nrp   urls
r   ztorrents/addTrackersr   r5   r   ri   required_listrN   )rP   rf   rp   r   s       r4   add_trackersTorrentsAPI.add_trackersk  sW     ":x8""4(68T2  " ! 
 	
 	
   A
AAA)r;   r;   r   orig_urlnew_urlc                    #    [         R                  " U5      nUR                  SU5        UR                  SU5        U R                  SSUS9I S h  vN   g  N7f)NorigUrlnewUrlr   ztorrents/editTrackerr   r   ri   required_strrN   )rP   rf   r   r   r   s        r4   edit_trackerTorrentsAPI.edit_trackerw  s]      ""4()X.(G,  " ! 
 	
 	
r   r   c                    #    [        SU5        [        R                  " U5      nUR                  SUS5        U R	                  SSUS9I S h  vN   g  N7f)Nr   rx   r   ztorrents/removeTrackersr   r   )rP   rf   r   r   s       r4   remove_trackersTorrentsAPI.remove_trackers  sY     "640 ""4(64-  % ! 
 	
 	
r   peersc                    #    [        SU5        [        R                  " U5      nUR                  SUS5        U R	                  SSUS9I S h  vN   g  N7f)Nr   rx   r   ztorrents/addPeersr   )r5   r   r_   r   rN   )rP   rY   r   r   s       r4   	add_peersTorrentsAPI.add_peers  sW     "7E2$$V,7E3/   ! 
 	
 	
r   c                 j   #    U R                  SS[        R                  " U5      S9I S h  vN   g  N7f)Nr   ztorrents/topPrior   r   r   s     r4   top_prioTorrentsAPI.top_prio  s6       --f5 ! 
 	
 	
r   c                 j   #    U R                  SS[        R                  " U5      S9I S h  vN   g  N7f)Nr   ztorrents/bottomPrior   r   r   s     r4   bottom_prioTorrentsAPI.bottom_prio  s6       !--f5 ! 
 	
 	
r   c                 j   #    U R                  SS[        R                  " U5      S9I S h  vN   g  N7f)Nr   ztorrents/increasePrior   r   r   s     r4   increase_prioTorrentsAPI.increase_prio  6       #--f5 ! 
 	
 	
r   c                 j   #    U R                  SS[        R                  " U5      S9I S h  vN   g  N7f)Nr   ztorrents/decreasePrior   r   r   s     r4   decrease_prioTorrentsAPI.decrease_prio  r   r   idpriorityc                    #    [        U[        5      (       a  U4n[        R                  " U5      nUR	                  SUS5        UR                  SU5        U R                  SSUS9I Sh  vN   g N7f)z
Prioritize files in a torrent.

:param hash: Info hash
:param id: A list of file indices to prioritize.
:param priority: Priority, :class:`.FilePriority`.
r   rx   r   r   ztorrents/filePrior   N)r1   rO   r   ri   r   required_intrN   )rP   rf   r   r   r   s        r4   	file_prioTorrentsAPI.file_prio  ss      b#B""4(4S)*h/   ! 
 	
 	
s   A(A2*A0+A2c                 p   #    [         R                  " U5      nU R                  SSUS9I Sh  vN nU$  N7f)z
Get torrent download limits.

The result is a dict mapping info hash to download speed limit
in bytes/second.

:param hashes: A list of info hashes or ``all`` for all torrents.
rM   ztorrents/downloadLimitr\   Nr   r   r~   )rP   rY   r]   rQ   s       r4   download_limitTorrentsAPI.download_limit  sF      --f5))$ * 
 

 
s   +646c                    #    [         R                  " U5      nUR                  SU5        U R                  SSUS9I Sh  vN   g N7f)z
Update torrent download limits.

:param hashes: A list of info hashes or ``all`` for all torrents.
:param limit: Download limit in bytes/second.
rW   r   ztorrents/setDownloadLimitr   Nr   r   r   rN   rP   rY   rW   r   s       r4   set_download_limitTorrentsAPI.set_download_limit  sM      ++F3'5)  ' ! 
 	
 	
   =AA Aratio_limitseeding_time_limitinactive_seeding_time_limitc                 
  #    U R                  5       n[        R                  " U5      nUR                  SU5        UR	                  SU[
        R                  5        Ub!  UR	                  SU[
        R                  5         UR                  SSUS9I Sh  vN   g N! [        R                   aO  nUcF  [        R                  " UR                  S5      S	:  a!  S
n[        R                  " XxUR                  S9  e SnAff = f7f)a  
Set share limits for torrents.

:param hashes: A list of info hashes or ``all`` for all torrents.
:param ratio_limit: A number or :attr:`.RatioLimits.UNSET`.
:param seeding_time_limit: :class:`~datetime.timedelta`, or
        :class:`.SeedingTimeLimits` constants.
:param inactive_seeding_time_limit: :class:`~datetime.timedelta`, or
        :class:`.InactiveSeedingTimeLimits` constants.
        Required since qBittorrent v4.6.0 (API 2.9.2).

ratioLimitseedingTimeLimitNinactiveSeedingTimeLimitr   ztorrents/setShareLimitsr   )r;   	   r;   r   zJArgument 'inactive_seeding_time_limit' is required since qBittorrent 4.6.0logger)r^   r   r   required_floatrequired_durationr#   MINUTESrequest_textr   BadRequestErrorr)   r@   r8   	_add_note_logger)	rP   rY   r   r   r   r   r   r   notes	            r4   set_share_limitsTorrentsAPI.set_share_limits  s     & ++F3L+613ExGWGWX&2""*,GIYIY	%%) &   
 "" 	+3&&v'9'99EJcbv~~>	s=   A>DB BB DB D 1A
C;;D  Dc                 l   #    [         R                  " U5      nU R                  SSUS9I Sh  vN $  N7f)z
Get torrent upload limits.

The result is a dict mapping info hash to upload speed limit
in bytes/second.

:param hashes: A list of info hashes or ``all`` for all torrents.
rM   ztorrents/uploadLimitr\   Nr   )rP   rY   r]   s      r4   upload_limitTorrentsAPI.upload_limit#  sB      --f5''" ( 
 
 	
 
s   +424c                    #    [         R                  " U5      nUR                  SU5        U R                  SSUS9I Sh  vN   g N7f)z
Update torrent upload limits.

:param hashes: A list of info hashes or ``all`` for all torrents.
:param limit: Upload limit in bytes/second.
rW   r   ztorrents/setUploadLimitr   Nr   r   s       r4   set_upload_limitTorrentsAPI.set_upload_limit4  sM      ++F3'5)  % ! 
 	
 	
r   locationc                    #    [         R                  " U5      nUR                  SU5        U R                  SSUS9I Sh  vN   g N7f)z
Change location (save path) for torrents.

This method also turns off auto torrent management (AutoTMM)
for torrents.

See also :meth:`~.set_save_path`.

:param hashes: A list of info hashes or ``all`` for all torrents.
:param location: Location.
r  r   ztorrents/setLocationr   Nr   r   required_pathrN   )rP   rY   r  r   s       r4   set_locationTorrentsAPI.set_locationD  sM       ++F3:x0  " ! 
 	
 	
r   pathc                    #    [         R                  " USS9nUR                  SU5        U R                  SSUS9I Sh  vN   g N7f)a#  
Change save path (location) for torrents.

This method causes no effect to torrents with auto torrent
management (AutoTMM) enabled.

Available since qBittorrent v4.4.0.

See also :meth:`~.set_location`.

:param id: A list of info hashes or ``all`` for all torrents.
:param path: Save path.
r   keyr  r   ztorrents/setSavePathr   Nr
  rP   r   r  r   s       r4   set_save_pathTorrentsAPI.set_save_path]  sO     & ++BD964(  " ! 
 	
 	
   <AAAc                    #    [         R                  " USS9nUR                  SU5        U R                  SSUS9I Sh  vN   g N7f)z
Change download path for torrents.

Available since qBittorrent v4.4.0.

:param id: A list of info hashes or ``all`` for all torrents.
:param path: Download path.
r   r  r  r   ztorrents/setDownloadPathr   Nr
  r  s       r4   set_download_pathTorrentsAPI.set_download_pathy  sO      ++BD964(  & ! 
 	
 	
r  namec                    #    [         R                  " U5      nUR                  SU5        U R                  SSUS9I Sh  vN   g N7f)zRename a torrent.r  r   ztorrents/renamer   Nr   )rP   rf   r  r   s       r4   renameTorrentsAPI.rename  sK     ""4(&$'   ! 
 	
 	
r   c                    #    [         R                  " U5      nUR                  SU5        U R                  SSUS9I Sh  vN   g N7f)z
Change torrents' category.

:param hashes: A list of info hashes or ``all`` for all torrents.
:param category: Category name. An empty string indicates no category.
rT   r   ztorrents/setCategoryr   N)r   r   r   rN   )rP   rY   rT   r]   s       r4   set_categoryTorrentsAPI.set_category  sM      --f5J1  " ! 
 	
 	
r   c                 L   #    U R                  [        SS5      I Sh  vN $  N7f)zR
Get categories.

A dict mapping category name to :class:`.Category` is returned.
rM   ztorrents/categoriesN)_request_mapped_dictr   rP   s    r4   
categoriesTorrentsAPI.categories  s-      ..!
 
 	
 
s   $"$	save_pathc                    #    [        5       nUR                  SU5        UR                  SU5        U R                  SSUS9I Sh  vN   g N7f)zCreate category.rT   savePathr   ztorrents/createCategoryr   Nr   r   r  rN   rP   rT   r%  r   s       r4   create_categoryTorrentsAPI.create_category  sR     {*h/:y1  % ! 
 	
 	
   AAAAc                    #    [        5       nUR                  SU5        UR                  SU5        U R                  SSUS9I Sh  vN   g N7f)zEdit category.rT   r'  r   ztorrents/editCategoryr   Nr(  r)  s       r4   edit_categoryTorrentsAPI.edit_category  sT     
 {*h/:y1  # ! 
 	
 	
r,  r#  c                    #    [        SU5        [        5       nUR                  SUS5        U R                  SSUS9I Sh  vN   g N7f)zRemove category.r#  r   r   ztorrents/removeCategoriesr   Nr5   r   r   rN   )rP   r#  r   s      r4   remove_categoriesTorrentsAPI.remove_categories  sN     "<<{<T:  ' ! 
 	
 	
   >A AA)r;   r=   r   tagsc                    #    [        SU5        [        R                  " U5      nUR                  SUS5        U R	                  SSUS9I S h  vN   g  N7f)Nr5  ,r   ztorrents/addTagsr   r5   r   r   r   rN   rP   rY   r5  r   s       r4   add_tagsTorrentsAPI.add_tags  sW     "640++F364-   ! 
 	
 	
r   c                    #    [        SU5        [        R                  " U5      nUR                  SUS5        U R	                  SSUS9I S h  vN   g  N7f)Nr5  r7  r   ztorrents/removeTagsr   r8  r9  s       r4   remove_tagsTorrentsAPI.remove_tags  sW     "640++F364-  ! ! 
 	
 	
r   c                 B   #    U R                  SS5      I S h  vN $  N7f)NrM   ztorrents/tags)r~   r"  s    r4   r5  TorrentsAPI.tags  s(     ''
 
 	
 
s   c                    #    [        SU5        [        5       nUR                  SUS5        U R                  SSUS9I S h  vN   g  N7f)Nr5  r7  r   ztorrents/createTagsr   r1  rP   r5  r   s      r4   create_tagsTorrentsAPI.create_tags  N     "640{64-  ! ! 
 	
 	
r4  c                    #    [        SU5        [        5       nUR                  SUS5        U R                  SSUS9I S h  vN   g  N7f)Nr5  r7  r   ztorrents/deleteTagsr   r1  rB  s      r4   delete_tagsTorrentsAPI.delete_tags  rE  r4  enablec                    #    [         R                  " U5      nUR                  SU5        U R                  SSUS9I S h  vN   g  N7f)NrI  r   ztorrents/setAutoManagementr   )r   r   ra   rN   )rP   rY   rI  r   s       r4   set_auto_managementTorrentsAPI.set_auto_management  sK     ++F38V,  ( ! 
 	
 	
r   c                 n   #    [         R                  " U5      nU R                  SSUS9I Sh  vN   g N7f)z$Flip ``seq_dl`` values for torrents.r   z!torrents/toggleSequentialDownloadr   N)r   r   rN   )rP   rY   r   s      r4   toggle_sequential_download&TorrentsAPI.toggle_sequential_download#  s;     ++F3  / ! 
 	
 	
s   +535r.   c                    #    U R                  US9I Sh  vN n/ nU H0  nUR                  U:w  d  M  UR                  UR                  5        M2     U(       a  U R	                  U5      I Sh  vN   gg N^ N7f)z
Change ``seq_dl`` for torrents.

.. note::

    This method is implemented by querying torrent ``seq_dl`` values, and
    :meth:`toggling <.TorrentsAPI.toggle_sequential_download>` them if needed.

rY   N)rd   seq_dlappendrf   rN  rP   rY   r.   torrentstargetsrd   s         r4   set_sequential_download#TorrentsAPI.set_sequential_download-  sm      &11D{{e#tyy)  11':::  2 ;&   A8A4A8:A8-A6.A86A8c                 j   #    U R                  SS[        R                  " U5      S9I Sh  vN   g N7f)z,Flip ``f_l_piece_prio`` values for torrents.r   z!torrents/toggleFirstLastPiecePrior   Nr   r   s     r4   toggle_first_last_piece_prio(TorrentsAPI.toggle_first_last_piece_prioB  s6       /--f5 ! 
 	
 	
r   c                    #    U R                  US9I Sh  vN n/ nU H0  nUR                  U:w  d  M  UR                  UR                  5        M2     U(       a  U R	                  U5      I Sh  vN   gg N^ N7f)z
Change ``f_l_piece_prio`` for torrents.

.. note::

    This method is implemented by querying torrent ``f_l_piece_prio`` values, and
    :meth:`toggling <.TorrentsAPI.toggle_first_last_piece_prio>` them if needed.

rQ  N)rd   f_l_piece_priorS  rf   r[  rT  s         r4   set_first_last_piece_prio%TorrentsAPI.set_first_last_piece_prioJ  so      &11D""e+tyy)  33G<<<  2 =rY  forcec                    #    [         R                  " U5      nUR                  SU5        U R                  SSUS9I Sh  vN   g N7f)z'Set ``force_start`` flags for torrents.r.   r   ztorrents/setForceStartr   Nr   r   r   rN   )rP   rY   ra  r   s       r4   set_force_startTorrentsAPI.set_force_start_  sK     ++F37E*  $ ! 
 	
 	
r   c                    #    [         R                  " U5      nUR                  SU5        U R                  SSUS9I Sh  vN   g N7f)z)Set ``super_seeding`` flags for torrents.r.   r   ztorrents/setSuperSeedingr   Nrc  )rP   rY   r.   r   s       r4   set_super_seedingTorrentsAPI.set_super_seedingj  sK     ++F37E*  & ! 
 	
 	
r   c                    #    g7f)zavailable until client 4.3.3N )rP   rf   r   r  s       r4   rename_fileTorrentsAPI.rename_filev          old_pathnew_pathc                    #    g7f)z)available since client 4.3.3 or API 2.7.0Nrj  )rP   rf   ro  rp  s       r4   rk  rl  z  rm  rn  argskwargsc           
        #    U R                  5       n[        R                  " UR                  S5      S:  n[	        U5      nUS:  a  [        S5      eUS:X  a  OUS:X  a2  [        US   [        5      (       a  SOSn X#R                  U5      4-  nOk S
U;   a#  UR                  S
5      UR                  S5      4nOASU;   a#  UR                  S5      UR                  S5      4nO[        U(       a  S5      eS
5      eU(       a  [        SUR                  5       < 35      eUu  p[        R                  " U5      n[        U	[        5      (       a%  UR                  SU	5        UR                  SU
5        Om[        U	[        5      (       a%  UR!                  SU	5        UR                  SU
5        O3[        S[#        U5      < S[#        U	5      < S[#        U
5      < S35      e U R%                  SSUS9I S	h  vN   g	! [         a    [        SU< 35      S	ef = f! [         a"  n[        SUR                  S   < 35      S	eS	nAff = f NR! [&        R(                   ah  n[        R                  " U R                  5       R                  S5      S:  a/  Sn[&        R*                  " XU R                  5       R,                  S9  e S	nAff = f7f)a  
Rename a file in torrent.

On qBittorrent v4.3.3 or later, the signature is ``rename_file(hash, old_path, new_path)``.

Below qBittorrent v4.3.3, use ``rename_file(hash, id, name)``, where ``id`` is
the file index from :meth:`~.TorrentsAPI.files`.

Available since qBittorrent v4.2.1 (API 2.4.0).

Signature changed in v4.3.3 (API 2.7.0).

See also: https://github.com/qbittorrent/qBittorrent/pull/13995

)r;      r   r   r;   zToo many arguments   r  rp  zMissing argument Nro  r   zExtra keyword arguments: oldPathnewPathzBad call signature: (z, )r   ztorrents/renameFiler   )r;      r   zFrom qBittorrent 4.2.1, rename_file(hash, id, name) was changed to rename_file(hash, old_path, new_path). BadRequestError may raise if rename_file() was called with inappropriate arguments.r   )r^   r)   r@   r8   len	TypeErrorr1   rO   popKeyErrorrr  keysr   ri   r2   r   r   typerN   r   r   r   r   )rP   rf   rr  rs  r   legacynargsr  r   argarg2r   r   s                r4   rk  rl  ~  s    $ ##F$6$6	BQFD	19011A:aZ&tAw44&*CGC**N'"JJz2FJJz4JKDV^"JJt,fjj.@AD"64BBzBB 77HIJJ	""4(c3i-i.S!!dC(fd+3DJ>DI=PRSWX\S]R``abcc	$$% %   ;  G"3C7 ;<$FG  N"3BGGAJ> BCMN&
 "" 
	!!$,,."<"<iHAM5  bt||~/E/EF
	s   A:K=G= K(H ;K<(H $K%H =C%K#I 7I
8I <K=HK
I%IIK
I K A#KKK)r;      r   c                    #    [         R                  " U5      nUR                  SU5        UR                  SU5        U R                  SSUS9I Sh  vN   g N7f)zRename a folder.rw  rx  r   ztorrents/renameFolderr   N)r   ri   r  rN   )rP   rf   ro  rp  r   s        r4   rename_folderTorrentsAPI.rename_folder  s]     
 ""4(9h/9h/  # ! 
 	
 	
r   c                 0  #    [         R                  " U5      nU R                  5       R                  SSUS9I Sh  vN nU ISh  vN   UR	                  5       I Sh  vN sSSS5      ISh  vN   $  N8 N/ N N! , ISh  vN  (       d  f       g= f7f)zExport a torrent as ``bytes``.rM   ztorrents/exportr\   N)r   ri   r^   requestr   )rP   rf   r]   r   s       r4   exportTorrentsAPI.export  st      $$T*\\^++ , 
 
 4$ 44
 $ 444si   9BA4
BA6B
A<A8A<"B.A:/B6B8A<:B<BBBB)r;   
   rz  c                 v   #    [         R                  " U5      nU R                  [        SSUS9I Sh  vN $  N7f)z
Get SSL parameters
rM   ztorrents/SSLParametersr\   N)r   ri   rh   r   )rP   rf   r]   s      r4   ssl_parametersTorrentsAPI.ssl_parameters  sE      $$T*00 $	 1 
 
 	
 
s   0979ssl_certificatessl_private_keyssl_dh_paramsc                    #    [         R                  " U5      nUR                  SU5        UR                  SU5        UR                  SU5        U R                  SSUS9I Sh  vN   g N7f)z
Set SSL parameters
r  r  r  r   ztorrents/setSSLParametersr   Nr   )rP   rf   r  r  r  r   s         r4   set_ssl_parametersTorrentsAPI.set_ssl_parameters  so      ""4(+_=+_=/=9  ' ! 
 	
 	
s   A!A+#A)$A+rj  )NNNNNNNNN)\__name__
__module____qualname____firstlineno____doc__rO   rR   r	   r2   boolr    r   r   rd   r   r   rl   r   rp   r   rt   r   r   rz   r   r   r   r   r   r   r   r   r   aiohttpFormDatar   r   r&   r   r   r   r   r   r   r   r   r   r   r   r   r   floatr   r   r   r   r  r  r(   r  r  r  r  r  r   r#  r*  r.  r2  r:  r=  r5  rC  rG  rK  rN  r'   rW  r[  r_  rd  rg  r   rk  r   r  bytesr  r   r  r  __static_attributes__rj  r6   r4   r,   r,   Q   s   	S 	 !%"&""&# $,0!;
;
 3-;
 sm	;

 $;
 };
 ;
 );
 c];
 
k	;
zX 2C 	
8 	
W 	

8 
W 
 ,0

 (3-(
 
i	
&
x 
DI 
"	
x 	
DI 	

 
T 
,'/ 'd '
/ 
d 
,(? (t (
? 
$ 
4 
,
O 
 
	
 	
4 	
g.. 4 :

x 

8C= 

T 

 9

 
 	

 

 
 
( 
(3- 
D 


j 

# 

4 


_ 
 

 
D 

/ 
d 

/ 
d 

H 
(3- 
3 
SW 
,? tCH~ "
 
s 
t 
, W[,, 5+-., ")S2C"CD	,
 &+9c;Ld+R%S, 
,\
 
T#s(^ 
"
_ 
S 
T 
 

 
 
	
2

 
 
	
8

 
 
	
.	
 	
 	
 	

 
C 
D 
$

$sH}"5 



c 

g 

$ 


C 
G 
 

(3- 
D 
 9

_ 

HSM 

d 

 

 9	
 	
x} 	
QU 	
 	
 9
DI 
 
 9	
hsm 	
 	
 	
 9	
hsm 	
 	
 	

 
 
RV 

 
4 
 ;O ;D ;UY ; ;(
 
T 
 =o =d =W[ = =(	
O 	
D 	
T 	


o 

d 

t 

 +h +C +s +t + + 8h 8# 8 8QU 8 8Kh Ks Kc Kd KZ 9
 
C 
3 
SW 
 
% %e % :
 
6J 
 
 :

 
 	

 
 

 
r6   r,   c                   L   \ rS rSr% SrSr\\   \S'   Sr	\\
   \S'   \R                  " \S9r\\   \S'   \R                  " \S9r\\\\4      \S'   Sr\\   \S	'   Sr\\   \S
'   Sr\\   \S'   Sr\\   \S'   Sr\\   \S'   Sr\\   \S'   Sr\\   \S'   Sr\\   \S'   Sr\\   \S'   Sr\\   \S'   Sr\\   \S'   Sr \\!   \S'   Sr"\\!   \S'   Sr#\\$   \S'   Sr%\\!   \S'   Sr&\\!   \S'   Sr'\\   \S'   Sr(\\   \S'   Sr)\\   \S'   Sr*\\   \S'   Sr+\\   \S'   Sr,\\   \S'   Sr-\\!   \S'   Sr.\\   \S '   Sr/\\   \S!'   Sr0\\   \S"'   SgS#\\1\!\24      S$\34S% jjr4\4r5\6S&\S$\34S' j5       r7\6SgS(\S)\\   S$\34S* jj5       r8S&\S$\34S+ jr9S)\S(\S$\34S, jr:\6S-\\;   S$\34S. j5       r<\6S/\\;   S$\34S0 j5       r=\6S1\\   S$\34S2 j5       r>\6S3\\   S$\34S4 j5       r?\6S5\\   S$\34S6 j5       r@\6S7\\A\      S$\34S8 j5       rB\6S9\\   S$\34S: j5       rC\6S;\\   S$\34S< j5       rD\6S=\\   S$\34S> j5       rE\6S?\\   S$\34S@ j5       rF\6SA\\   S$\34SB j5       rG\6SC\\!   S$\34SD j5       rH\6SE\\!   S$\34SF j5       rI\6\J" SG5      SH\K\$\LS4   S$\34SI j5       5       rM\6\J" SG5      SJ\K\N\O\PS4   S$\34SK j5       5       rQ\6SL\K\N\O\PS4   S$\34SM j5       rR\6SN\\   S$\34SO j5       rS\6SP\\   S$\34SQ j5       rT\6SR\\   S$\34SS j5       rU\6ST\\   S$\34SU j5       rV\6SV\\W   S$\34SW j5       rX\6SX\\Y   S$\34SY j5       rZ\6SZ\K\!\[S4   S$\34S[ j5       r\\6S\\\   S$\34S] j5       r]\6S^\\   S$\34S_ j5       r^\6S`\\   S$\34Sa j5       r_S$\`R                  4Sb jrb\cScSdS$\34Se j5       rdSfreg)hr+   i  a  
Build :class:`aiohttp.FormData` used in :meth:`.TorrentsAPI.add`.

AddFormBuilder is designed in fluent interface.
Most of its methods return a modified copy of the builder.

Here is an example to illustrate::

    await client.torrent.add(
        # Create a builder with a particular client
        AddFormBuilder.with_client(client)

        # Set torrent category to "linux"
        .category("linux")

        # Set ratio limit to 10
        .ratio_limit(10)

        # Add a torrent by its info hash (debian-11.7.0-amd64-netinst.iso)
        .include_url("6f84758b0ddd8dc05840bf932a77935d8b5b8b93")

        # Add a torrent by URL/magnet link (debian-11.6.0-amd64-netinst.iso)
        .include_url("magnet:?xt=urn:btih:6d4795dee70aeb88e03e5336ca7c9fcf0a1e206d")

        # Upload a torrent with its bytes data and name
        .include_url(file_bytes, "debian-12.0.0-amd64-netinst.iso")

        # Generate FormData object
        .build()
    )

See also :APIWiki:`torrents/add <#add-new-torrent>`.

Nclient_versionr8   )default_factory_urls_files	_savepath_download_path_use_download_path_cookie	_category_tags_skip_checking_paused_stopped_root_folder_rename	_up_limit	_dl_limit_ratio_limit_seeding_time_limit_inactive_seeding_time_limit	_auto_tmm_sequential_download_first_last_piece_prio_add_to_top_of_queue_stop_condition_content_layout_share_limit_action_ssl_certificate_ssl_private_key_ssl_dh_paramsmemodictr/   c                 z    [         R                  " U [        U R                  5      [        U R                  5      S9$ )N)r  r  )dataclassesreplacelistr  r  )rP   r  s     r4   __deepcopy__AddFormBuilder.__deepcopy__V  s0    ""tzz"$
 	
r6   urlc                 <    U R                   R                  U5        U $ )z=
Add a URL, magnet link, or info hash (SHA1/SHA256) to form.
)r  rS  rP   r  s     r4   include_urlAddFormBuilder.include_url_  s     	

#r6   r   filenamec                     Uc  [        U R                  5      S-   S S3nU R                  R                  [        U5      U45        U $ )z
Add a torrent file to form.
rv  dz.torrent)r{  r  rS  r  )rP   r   r  s      r4   include_fileAddFormBuilder.include_fileh  sG     dkk*Q.q1:HE$K23r6   c                 $    U R                  U5      $ )z-deprecated, use :meth:`.include_url` instead.)r  r  s     r4   add_urlAddFormBuilder.add_urlt  s     $$r6   c                 $    U R                  X!5      $ )z.deprecated, use :meth:`.include_file` instead.)r  )rP   r  r   s      r4   add_torrentAddFormBuilder.add_torrenty  s      00r6   savepathc                 >    Uc	  SU l        U $ [        U5      U l        U $ )zSet ``savepath`` value.N)_convert_pathr  )rP   r  s     r4   r  AddFormBuilder.savepath}  s)     "*!1 8EX7Nr6   download_pathc                 >    Uc	  SU l        U $ [        U5      U l        U $ )zu
Set ``downloadPath`` value.

Also use :meth:`use_download_path(True) <.use_download_path>` to enable download path.
N)r  r  )rP   r  s     r4   r  AddFormBuilder.download_path  s,     '4&;d BO}A]r6   use_download_pathc                     Xl         U $ )z 
Set ``useDownloadPath`` value.
)r  )rP   r  s     r4   r   AddFormBuilder.use_download_path  s     #4r6   cookiec                     Xl         U $ )zSet ``cookie`` value.)r  )rP   r  s     r4   r  AddFormBuilder.cookie       r6   rT   c                     Xl         U $ )zSet ``category`` value.)r  )rP   rT   s     r4   rT   AddFormBuilder.category       "r6   r5  c                    Uc	  SU l         U $ [        SU5        [        U5      n/ nU HI  n[        U[        5      (       d  [        S5      eSU;   a  [        SU< 35      eUR                  U5        MK     SR                  U5      U l         U $ )zd
Associate torrents being added with tags.

Available since API v2.6.2.

:param tags: list of tags.
Nr5  zeach tag must be a strr7  zTag cannot contain comma: )r  r5   r  r1   r2   r3   rS  join)rP   r5  partsitems       r4   r5  AddFormBuilder.tags  s     <DJK 	#640DzDdC(( !9::d{ #=dX!FGGLL  XXe_
r6   skip_checkingc                     Xl         U $ )zSet ``skip_checking`` value.)r  )rP   r  s     r4   r  AddFormBuilder.skip_checking  s     ,r6   pausedc                     [         R                  " U R                  S5      S:  a  SSKnUR	                  S[
        SS9  Xl        Xl        U $ )zSet ``paused`` value.r:   r   Nz9use stopped() instead of paused() in API v2.11.0 or laterr=   r>   )r)   r@   r8   rE   rF   rG   r  r  )rP   r  rE   s      r4   r  AddFormBuilder.paused  sM     d..
;q@MMK"  
 #Mr6   stoppedc                 h    [         R                  " U R                  S5      S:  a  Xl        Xl        U $ )zSet ``stopped`` value.r:   r   )r)   r@   r8   r  r  )rP   r  s     r4   r  AddFormBuilder.stopped  s0     d..
;a? #Lr6   root_folderc                     Xl         U $ )zk
Set ``root_folder`` value.

Removed on qBittorrent v4.3.2 and later. Use :meth:`.content_layout` instead.
)r  )rP   r  s     r4   r  AddFormBuilder.root_folder  s     (r6   r  c                     Xl         U $ )z4Set ``rename`` value, which is the new torrent name.)r  )rP   r  s     r4   r  AddFormBuilder.rename  r  r6   up_limitc                     Xl         U $ )zSet ``upLimit`` in bytes/s)r  )rP   r  s     r4   r  AddFormBuilder.up_limit  r  r6   dl_limitc                     Xl         U $ )zSet ``dlLimit`` in bytes/s)r  )rP   r   s     r4   r   AddFormBuilder.dl_limit  r  r6   )r;   r  rv  r   c                 >    Uc	  SU l        U $ [        U5      U l        U $ )zSet ``ratioLimit`` value.N)r  r  )rP   r   s     r4   r   AddFormBuilder.ratio_limit  s+    
 %0$7D >C;=Or6   r   c                 n    Uc	  SU l         U $ [        [        U[        R                  5      5      U l         U $ )zSet ``seedingTimeLimit`` value.N)r  rO   _convert_durationr#   r   )rP   r   s     r4   r   !AddFormBuilder.seeding_time_limit  s=     %'+D$  (++<=OQYQaQa+b'cD$r6   r   c                 n    Uc	  SU l         U $ [        [        U[        R                  5      5      U l         U $ )z'Set ``inactiveSeedingTimeLimit`` value.N)r  rO   r  r#   r   )rP   r   s     r4   r   *AddFormBuilder.inactive_seeding_time_limit  s@     '.04D-
  14!"=x?O?OP1D- r6   auto_tmmc                     Xl         U $ )zSet ``autoTMM`` value.)r  )rP   r
  s     r4   r
  AddFormBuilder.auto_tmm#  r  r6   sequential_downloadc                     Xl         U $ )z!Set ``sequentialDownload`` value.)r  )rP   r  s     r4   r  "AddFormBuilder.sequential_download)  s     %8!r6   first_last_piece_prioc                     Xl         U $ )z!Set ``firstLastPiecePrio`` value.)r  )rP   r  s     r4   r  $AddFormBuilder.first_last_piece_prio/  s     '<#r6   add_to_top_of_queuec                     Xl         U $ )zSet ``addToTopOfQueue`` value)r  )rP   r  s     r4   r  "AddFormBuilder.add_to_top_of_queue5  s     %8!r6   stop_conditionc                 >    Uc	  SU l        U $ [        U5      U l        U $ )zSet ``stopCondition`` value.N)r2   r  )rP   r  s     r4   r  AddFormBuilder.stop_condition<  ,     (6'=t DG~CVr6   content_layoutc                 >    Uc	  SU l        U $ [        U5      U l        U $ )zSet ``contentLayout`` value.N)r2   r  )rP   r  s     r4   r  AddFormBuilder.content_layoutC  r  r6   share_limit_actionc                 .    Ub  [        U5      nXl        U $ )zSet ``shareLimitAction`` value)rO   r  )rP   r  s     r4   r  !AddFormBuilder.share_limit_actionJ  s!     )!$%7!8#5 r6   r  c                     Xl         U $ )zJ
Set ``ssl_certificate`` value.

The certificate is stored in PEM format.
)r  )rP   r  s     r4   r  AddFormBuilder.ssl_certificateT  s     !0r6   r  c                     Xl         U $ )zi
Set ``ssl_private_key`` value.

The private key is stored in PEM format.
RSA and EC keys are supported.
)r  )rP   r  s     r4   r  AddFormBuilder.ssl_private_key^  s     !0r6   r  c                     Xl         U $ )ue   
Set ``ssl_dh_params`` value.

The Diffie–Hellman key exchange parameters is stored in PEM format.
)r  )rP   r  s     r4   r  AddFormBuilder.ssl_dh_paramsi  s     ,r6   c                 
   S[         S[        4S jn[        R                  " 5       nU R                  (       aS  Sn[
        R                  " U R                  S5      S:  a  SnUR                  SS	R                  U R                  5      US
9  U R                   H  u  pEUR                  SUUSS9  M     U R                  b  UR                  SU R                  5        U R                  b  UR                  SU R                  5        U R                  b"  UR                  SU" U R                  5      5        U R                  b  UR                  SU R                  5        U R                  b  UR                  SU R                  5        U R                   b  UR                  SU R                   5        U R"                  b"  UR                  SU" U R"                  5      5        U R$                  b"  UR                  SU" U R$                  5      5        U R&                  b"  UR                  SU" U R&                  5      5        U R(                  b"  UR                  SU" U R(                  5      5        U R*                  b  UR                  SU R*                  5        U R,                  b%  UR                  S[        U R,                  5      5        U R.                  b%  UR                  S[        U R.                  5      5        U R0                  b%  UR                  S[        U R0                  5      5        U R2                  b%  UR                  S[        U R2                  5      5        U R4                  b%  UR                  S[        U R4                  5      5        U R6                  b"  UR                  SU" U R6                  5      5        U R8                  b"  UR                  SU" U R8                  5      5        U R:                  b"  UR                  S U" U R:                  5      5        U R<                  b"  UR                  S!U" U R<                  5      5        U R>                  b  UR                  S"U R>                  5        U R@                  b  UR                  S#U R@                  5        U RB                  b%  UR                  S$[        U RB                  5      5        U RD                  b  UR                  S%U RD                  5        U RF                  b  UR                  S&U RF                  5        U RH                  b  UR                  S'U RH                  5        U$ )(z#
Build :class:`~aiohttp.FormData`.
br/   c                     U (       a  S$ S$ )zboolean to lowercase stringtruefalserj  )r'  s    r4   bool_str&AddFormBuilder.build.<locals>.bool_strx  s    6+G+r6   N)r;      r   r   z
text/plainr   r   )content_typerU  zapplication/x-bittorrent)r  r.  r  downloadPathuseDownloadPathr  rT   r5  r  r  r  r  r  upLimitdlLimitr   r   r   autoTMMsequentialDownloadaddToTopOfQueuefirstLastPiecePriostopConditioncontentLayoutshareLimitActionr  r  r  )%r  r2   r  r  r  r)   r@   r8   	add_fieldr  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  )rP   r+  r   r.  filedatar  s         r4   buildAddFormBuilder.builds  s   
	, 	, 	, !::L!!$"2"2I>B  ,NN6499TZZ#8|NT"&++HNN!7	   #. >>%NN:t~~6*NN>4+>+>?"".NN,ht7N7N.OP<<#NN8T\\2>>%NN:t~~6::!NN64::.*NN?HT5H5H,IJ<<#NN8Xdll%;<==$NN9ht}}&=>(NN=(43D3D*EF<<#NN8T\\2>>%NN9c$..&9:>>%NN9c$..&9:(NN<T->->)?@##/NN-s43K3K/LM,,8NN5s4;\;\7]^>>%NN9ht~~&>?$$0NN/$:S:S1TU$$0NN,ht7P7P.QR&&2NN/$:U:U1VW+NN?D,@,@A+NN?D,@,@A##/NN-s43K3K/LM  ,NN,d.C.CD  ,NN,d.C.CD*NN?D,?,?@r6   r   r$   c                 8    U " UR                   UR                  S9$ )z
Return :class:`.AddFormBuilder` to build :class:`~aiohttp.FormData`
used in :meth:`.TorrentsAPI.add`.

:param client: :class:`.APIClient`.
:return: :class:`.AddFormBuilder`.
r  r8   r?  )clsr   s     r4   with_clientAddFormBuilder.with_client  s#     !00**
 	
r6   )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  )fr  r  r  r  r  r  r	   r*   __annotations__r8   r)   r  fieldr  r  r   r2   r  r
   r  r  r  r  r  r  r  r  r  r  r  r  r  r  rO   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   r  __copy__r   r  r  r  r  r(   r  r  r  r  rT   r   r5  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  r  r  r<  classmethodrA  r  rj  r6   r4   r+   r+     s   !F /3NH]+2(,K*%,"((>E49>&1&7&7&MFDucz"#M#Ix}#$(NHSM()--!GXc]!#Ix}#E8C=%)NHTN)"GXd^"#Hhtn##'L(4.'!GXc]!#Ix}##Ix}#$(L(5/()-#-26 (3-6 $Ix~$+/(4./-1HTN1+/(4./%)OXc])%)OXc]))-#-&*hsm*&*hsm*$(NHSM(
Xd38n%= 
 
 Hs t   	 	(3- 	4 	 	%3 %4 %
1C 1u 1 1 '!2 t  
 8G+<    8D> d   Xc] t  
 # 4  
 (3-0 T  6 8D> d  
 Xd^     	x~ 	$ 	 	 x~ $   Xc] t  
 # 4  
 # 4  
 
9uUK-E'F 4    
9
!)W6G"MN
 

  
 %*9g?PRV+V%W 
  $ D  
 x~ $  
 8D> d  
 x~ $   Xm-D    Xm-D    U3@PRV;V5W \`   x}    x}    8C= T  kw'' kZ 
 
 
 
r6   r+   deltaunitc                     [        U [        5      (       aG  UR                  U R                  5       5      n [        (       a  [        U [
        [        45      (       d   eU $ )z}
Convert duration to float

timedelta is converted to the unit or seconds if not specified.
int/float is returned unchanged.
)r1   r   from_secondstotal_secondsr   rO   r  )rG  rH  s     r4   r  r    sK     %##!!%"5"5"78=ec5\2222Lr6   r  c                 N    [         R                  " U 5      R                  SS5      $ )z+Convert path-like objects to POSIX path str\/)osfsdecoder  )r  s    r4   r  r    s    ;;t$$T3//r6   )Br  rO  datetimer   typingr   r   r   r   r   r	   r
   r   r   r  typing_extensionsr   aioqbtr   aioqbt._decoratorr   aioqbt._paramdictr   aioqbt.api.typesr   r   r   r   r   r   r   r   r   r   r   r   r   aioqbt.bittorrentr   r   r    r!   aioqbt.chronor"   r#   aioqbt.clientr$   r%   r&   r'   aioqbt.typingr(   aioqbt.versionr)   r*   __all__r2   r5   rO   rI   r,   	dataclassr+   r  r  r  rj  r6   r4   <module>r_     s    	  ] ] ]  "  ' '    T S + = = ! 4?c ?(3- ?D ?!!%S#./! 	!H{
( {
| ]
 ]
 ]
@E!"
 &0 0C 0r6   