L ihddlmZddlmZmZmZddlmZddlZddl m Z ddl m Z m Z mZmZmZmZmZmZddlmZmZmZmZmZmZdd lmZdd lmZmZdd l m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*dd l+m,Z,m-Z-dd l.m/Z/m0Z0ddl1m2Z2m3Z3ddl4m5Z5ddl6m7Z7ddl8m9Z9ddgZ:GddeZ;GddeZ<GddZ=GddZ>GddZ?GddZ@y)) annotations)ListMappingcast)chainN)_legacy_response)BodyOmitQueryHeadersNotGiven FileTypesomit not_given)is_given extract_filesmaybe_transformstrip_not_givendeepcopy_minimalasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource) BinaryAPIResponseAsyncBinaryAPIResponseStreamedBinaryAPIResponseAsyncStreamedBinaryAPIResponseto_streamed_response_wrapperto_custom_raw_response_wrapper"async_to_streamed_response_wrapper#to_custom_streamed_response_wrapper$async_to_custom_raw_response_wrapper)async_to_custom_streamed_response_wrapper)SyncPage AsyncPage)file_list_paramsfile_upload_params)AsyncPaginatormake_request_options) DeletedFile) FileMetadata)AnthropicBetaParamFiles AsyncFilesc .eZdZed dZed dZeeeeddded d dZeddded ddZ eddded ddZ eddded dd Z eddded dd Z y)r.ct|Sa This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers )FilesWithRawResponseselfs d/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/anthropic/resources/beta/files.pywith_raw_responsezFiles.with_raw_response&s$D))ct|Sz An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response )FilesWithStreamingResponser4s r6with_streaming_responsezFiles.with_streaming_response0s*$//r8Nafter_id before_idlimitbetas extra_headers extra_query extra_bodytimeoutc@itdt|r#djtd|Ddgnti|xsi}ddi|xsi}|j dt tt||||t|||dtjtS) FList Files Args: after_id: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object. before_id: ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object. limit: Number of items to return per page. Defaults to `20`. Ranges from `1` to `1000`. betas: Optional header to specify the beta version(s) you want to use. extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds anthropic-beta,c32K|]}t|ywNstr.0es r6 zFiles.list..c5Lc!f5Lfiles-api-2025-04-14/v1/files?beta=truer>r?r@rBrCrDrEquerypageoptionsmodel) rrjoinrr _get_api_listr%r,r*rr'FileListParams r5r>r?r@rArBrCrDrEs r6listz Files.list9sN  $'*hhu5Le5LOeNf/g&h"  "  *+A[mFYWY[ !! !,'(+'%%$,%.!& %33  #"  r8rArBrCrDrEc |std|itdt|r#djt d|Ddgnt i|xsi}ddi|xsi}|j d|dt||||t S)  Delete File Args: file_id: ID of the File. betas: Optional header to specify the beta version(s) you want to use. extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds 6Expected a non-empty value for `file_id` but received rHrIc32K|]}t|ywrKrLrNs r6rQzFiles.delete..rRrSrT /v1/files/ ?beta=truerBrCrDrEr[cast_to ValueErrorrrr]rr_deleter*r+r5file_idrArBrCrDrEs r6deletez Files.deletes8UV]U`ab b  $'*hhu5Le5LOeNf/g&h"  "  *+A[mFYWY[ ||  ,(+Q[el   r8c *|std|ddi|xsi}itdt|r#djt d|Ddgnt i|xsi}ddi|xsi}|j d|d t|||| t S)  Download File Args: file_id: ID of the File. betas: Optional header to specify the beta version(s) you want to use. extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds reAcceptapplication/binaryrHrIc32K|]}t|ywrKrLrNs r6rQz!Files.download..rRrSrTrg/content?beta=truerirj) rmrrr]rr_getr*rros r6downloadzFiles.downloads8UV]U`ab b!#7QM.rRrSrTrgrhrirj rmrrr]rrrxr*r,ros r6retrieve_metadatazFiles.retrieve_metadatas8UV]U`ab b  $'*hhu5Le5LOeNf/g&h"  "  *+A[mFYWY[ yy  ,(+Q[el!   r8c itdt|r#djtd|Ddgnti|xsi}ddi|xsi}t d|i}t ttttf|dgg}d|d<|jd t|tj|t|||| t S)  Upload File Args: file: The file to upload betas: Optional header to specify the beta version(s) you want to use. extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds rHrIc32K|]}t|ywrKrLrNs r6rQzFiles.upload..2rRrSrTfilepathsmultipart/form-data Content-TyperUribodyfilesr[rk)rrr]rrrrrrrMobject_postrr(FileUploadParamsr*r, r5rrArBrCrDrErrs r6uploadz Files.uploads8  $'*hhu5Le5LOeNf/g&h"  "  *+A[mFYWY[ /d73;#7>xjQ)> n%zz ! '9'J'JK(+Q[el!  r8)returnr3)rr;)r> str | Omitr?rr@ int | OmitrAList[AnthropicBetaParam] | OmitrBHeaders | NonerC Query | NonerD Body | NonerE'float | httpx.Timeout | None | NotGivenrzSyncPage[FileMetadata]rprMrArrBrrCrrDrrErrr+)rprMrArrBrrCrrDrrErrrrprMrArrBrrCrrDrrErrr,rrrArrBrrCrrDrrErrr, __name__ __module__ __qualname__rr7r<rrrarqryr~rr8r6r.r.%s#**00 $ $ 15)-$("&;DD D  D  D / D &D "D  D 9D  D T26)-$("&;D/ / / / &/ "/  / 9/  / j26)-$("&;D0 0 / 0 &0 "0  0 90  0 l26)-$("&;D/ / / / &/ "/  / 9/  / j26)-$("&;D5 5 / 5 &5 "5  5 95  5 r8c .eZdZed dZed dZeeeeddded d dZeddded ddZ eddded ddZ eddded dd Z eddded dd Z y)r/ct|Sr2)AsyncFilesWithRawResponser4s r6r7zAsyncFiles.with_raw_responseLs)..r8ct|Sr:)AsyncFilesWithStreamingResponser4s r6r<z"AsyncFiles.with_streaming_responseVs/t44r8Nr=c@itdt|r#djtd|Ddgnti|xsi}ddi|xsi}|j dt tt||||t|||dtjtS) rGrHrIc32K|]}t|ywrKrLrNs r6rQz"AsyncFiles.list..rRrSrTrUrVrWrY) rrr]rrr^r&r,r*rr'r_r`s r6razAsyncFiles.list_sN  $'*hhu5Le5LOeNf/g&h"  "  *+A[mFYWY[ !! !<((+'%%$,%.!& %33  #"  r8rbc 2K|std|itdt|r#djt d|Ddgnt i|xsi}ddi|xsi}|j d|dt||||t d {S7w) rdrerHrIc32K|]}t|ywrKrLrNs r6rQz$AsyncFiles.delete..rRrSrTrgrhrirjNrlros r6rqzAsyncFiles.deletes8UV]U`ab b  $'*hhu5Le5LOeNf/g&h"  "  *+A[mFYWY[ \\  ,(+Q[el "    BBBBc FK|std|ddi|xsi}itdt|r#djt d|Ddgnt i|xsi}ddi|xsi}|j d|d t|||| t d {S7w) rsrertrurHrIc32K|]}t|ywrKrLrNs r6rQz&AsyncFiles.download..rRrSrTrgrwrirjN) rmrrr]rrrxr*rros r6ryzAsyncFiles.downloads8UV]U`ab b!#7QM.)rRrSrTrgrhrirjNr}ros r6r~zAsyncFiles.retrieve_metadatas8UV]U`ab b  $'*hhu5Le5LOeNf/g&h"  "  *+A[mFYWY[ YY  ,(+Q[el!     rc Kitdt|r#djtd|Ddgnti|xsi}ddi|xsi}t d|i}t ttttf|dgg}d|d<|jd t|tjd {|t|||| t d {S7%7w) rrHrIc32K|]}t|ywrKrLrNs r6rQz$AsyncFiles.upload..XrRrSrTrrrrrUNrir)rrr]rrrrrrrMrrrr(rr*r,rs r6rzAsyncFiles.upload9s8  $'*hhu5Le5LOeNf/g&h"  "  *+A[mFYWY[ /d73;#7>xjQ)> n%ZZ !,T3E3V3VWW(+Q[el!    W s$B7C#9C : C#C!C#!C#)rr)rr)r>rr?rr@rrArrBrrCrrDrrErrz5AsyncPaginator[FileMetadata, AsyncPage[FileMetadata]]r)rprMrArrBrrCrrDrrErrrrrrrr8r6r/r/Ks#//55 $ $ 15)-$("&;DD D  D  D / D &D "D  D 9D  ?D T26)-$("&;D/ / / / &/ "/  / 9/  / j26)-$("&;D0 0 / 0 &0 "0  0 90  0 l26)-$("&;D/ / / / &/ "/  / 9/  / j26)-$("&;D5 5 / 5 &5 "5  5 95  5 r8ceZdZddZy)r3cp||_tj|j|_tj|j|_t |j t|_tj|j|_tj|j|_ yrK) _filesr to_raw_response_wrapperrarqr ryrr~rr5rs r6__init__zFilesWithRawResponse.__init__rs $<< JJ  '>> LL  7 NN   "2!I!I  # #" '>> LL  r8Nrr.rNonerrrrrr8r6r3r3q r8r3ceZdZddZy)rcp||_tj|j|_tj|j|_t |j t|_tj|j|_tj|j|_ yrK) rr async_to_raw_response_wrapperrarqr#ryrr~rrs r6rz"AsyncFilesWithRawResponse.__init__s $BB JJ  'DD LL  = NN "  "2!O!O  # #" 'DD LL  r8Nrr/rrrrr8r6rrrr8rceZdZddZy)r;c ||_t|j|_t|j|_t |j t |_t|j|_t|j|_yrK) rrrarqr"ryrr~rrs r6rz#FilesWithStreamingResponse.__init__sv 0 JJ  3 LL  < NN %  ">  # #" 3 LL  r8Nrrrr8r6r;r;rr8r;ceZdZddZy)rc ||_t|j|_t|j|_t |j t |_t|j|_t|j|_yrK) rr!rarqr$ryrr~rrs r6rz(AsyncFilesWithStreamingResponse.__init__sx 6 JJ  9 LL  B NN *  "D  # #" 9 LL  r8Nrrrr8r6rrrr8r)A __future__rtypingrrr itertoolsrhttpxr _typesr r r r rrrr_utilsrrrrrr_compatr _resourcerr _responserrrrrr r!r"r#r$ paginationr%r& types.betar'r( _base_clientr)r*types.beta.deleted_filer+types.beta.file_metadatar,types.anthropic_beta_paramr-__all__r.r/r3rr;rrr8r6rs#&& VVVxx&:   .>@24< L !c Oc L c !c L   ,  ,  ,  r8