+\h%6dZddlmZddlmZmZmZddlmZm Z m Z m Z ddl m Z ddlmZddlmZddlmZmZer2dd lmZdd lmZdd lmZdd lmZdd lmZddlm Z ddlm!Z!ddl"m#Z#m$Z$dZ%GddZ&Gdde&Z'Gdde'Z(Gdde&Z)y)z;Perform aggregation operations on a collection or database.) annotations)CallableMappingMutableMapping) TYPE_CHECKINGAnyOptionalUnion)common)validate_collation_or_none)ConfigurationError)ReadPreference _AggWritePref)AsyncClientSession)AsyncCollection)AsyncCommandCursor) AsyncDatabase)AsyncConnection)Server) _ServerMode) _DocumentType _PipelineFceZdZdZ d d dZed dZed dZddZeddZ ddZ dd Z y)_AggregationCommandaThe internal abstract base class for aggregation cursors. Should not be called directly by application developers. Use :meth:`pymongo.asynchronous.collection.AsyncCollection.aggregate`, or :meth:`pymongo.asynchronous.database.AsyncDatabase.aggregate` instead. Nc d|vr td||_tjd|}||_d|_|rd|dvsd|dvrd|_tj d ||tj d |||d <| | |d <||_tjd |jjd d|_ |jjd i|j(|j s|j|jd d <||_ ||_ ||_||_t!|jdd|_|jdd|_d|_y)NexplainzGThe explain option is not supported. Use AsyncDatabase.command instead.pipelineFz$outz$mergeToptionsletcomment batchSizecursor collationmaxAwaitTimeMS)r _targetr validate_list _pipeline_performs_writevalidate_is_mapping_options%validate_non_negative_integer_or_nonepop _batch_size setdefault _cursor_class_explicit_session _user_fields_result_processorr _collation_max_await_time_ms_write_preference) selftarget cursor_classrrexplicit_sessionr user_fieldsresult_processorr!s c/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pymongo/asynchronous/aggregation.py__init__z_AggregationCommand.__init__/so  $Y  '' H=!$ 8B</8x|3K#'D ""9g6 ?  & &uc 2 GEN  !(GI  "GG **;=    2.    '0D0D373C3CDMM( #K 0)!1'!14W[[d5ST")++.>"E:>ct)z.The argument to pass to the aggregate command.NotImplementedErrorr7s r=_aggregation_targetz'_AggregationCommand._aggregation_targeth "!r?ct)z4The namespace in which the aggregate command is run.rArCs r=_cursor_namespacez%_AggregationCommand._cursor_namespacemrEr?ct:The AsyncCollection used for the aggregate command cursor.rA)r7 cursor_docs r=_cursor_collectionz&_AggregationCommand._cursor_collectionrs!!r?ct)z:The database against which the aggregation command is run.rArCs r= _databasez_AggregationCommand._databasevrEr?c|jr |jS|jj|}|jr%|tj k7rt |x|_}|SN)r6r&_read_preference_forr)rPRIMARYr)r7sessionprefs r=get_read_preferencez'_AggregationCommand.get_read_preference{sZ  ! !)) )||009   DN,B,B$B,9$,? ?D "T r?c K|j|jd}|j|jd|vr2|jr|j dk\r|j j}nd}d|vr(|jr|j j|}nd}|j|jj|||j jd|||j||jj|j d{}|j r|j!||d|vr|d} n d|j#d g|j$d } |j'|j)| | |j*|j,xsd|j.||j0|jj#d  } | j3|d{| S77w) N) aggregater readConcern writeConcernT)parse_write_concern_error read_concern write_concernr$rSclientr;r#rresult)id firstBatchnsr!) batch_sizemax_await_time_msrSr:r!)rDr(updater+r)max_wire_versionr&r\_write_concern_forcommandrNname codec_optionsr4r^r2r3getrGr0rLaddressr.r5r1_maybe_pin_connection) r7rSserverconnread_preferencecmdr\r]r_r# cmd_cursors r= get_cursorz_AggregationCommand.get_cursors!44$..Q 4==!  $$$)>)>!)C<<44LL  $)=)= LL;;GDM M|| NN     LL & &&*%'oo>>(())$     ! !  " "64 0 v H%F$jj26,,F''  # #F +  LL'',1"55!33MM%%i0(  ..t444Q  N 5s%D G% G! C G%G#G%#G%)NNNN)r8z%Union[AsyncDatabase, AsyncCollection]r9ztype[AsyncCommandCursor]rrrzMutableMapping[str, Any]r:boolr zOptional[Mapping[str, Any]]r;z"Optional[MutableMapping[str, Any]]r<z>Optional[Callable[[Mapping[str, Any], AsyncConnection], None]]r!rreturnNone)ruzUnion[str, int]rustr)rKMapping[str, Any]rurrur)rSOptional[AsyncClientSession]ruz!Union[_AggWritePref, _ServerMode]) rSr{rnrrorrprruz!AsyncCommandCursor[_DocumentType]) __name__ __module__ __qualname____doc__r>propertyrDrGrLrNrUrsr?r=rr's,0:>[_7?57?/7? 7? * 7?  7?)7?87?Y7?7? 7?r"""""""3 *G-GG G % G + Gr?rcVeZdZUded<eddZeddZd dZed dZy) _CollectionAggregationCommandrr&c.|jjSrPr&rirCs r=rDz1_CollectionAggregationCommand._aggregation_targets||   r?c.|jjSrP)r& full_namerCs r=rGz/_CollectionAggregationCommand._cursor_namespaces||%%%r?c|jSrIr&)r7r#s r=rLz0_CollectionAggregationCommand._cursor_collection ||r?c.|jjSrP)r&databaserCs r=rNz'_CollectionAggregationCommand._databases||$$$r?Nrwr#ryrurrz) r|r}r~__annotations__rrDrGrLrNrr?r=rrsG  !!&&%%r?rc eZdZdfd ZxZS) _CollectionRawAggregationCommandcbt||i||jsd|jdd<yy)Nrr#r")superr>r)r+)r7argskwargs __class__s r=r>z)_CollectionRawAggregationCommand.__init__s8 $)&)##34DMM( #K 0$r?)rrrrrurv)r|r}r~r> __classcell__)rs@r=rrs 55r?rcVeZdZUded<eddZed dZed dZd dZy) _DatabaseAggregationCommandrr&cy)NrrCs r=rDz/_DatabaseAggregationCommand._aggregation_targetsr?c4|jjdS)Nz.$cmd.aggregaterrCs r=rGz-_DatabaseAggregationCommand._cursor_namespaces,,##$O44r?c|jSrPrrCs r=rNz%_DatabaseAggregationCommand._databaserr?c~|jd|jjdd\}}|j|S)rJrb.r)rkrGsplitrN)r7r#_collnames r=rLz._DatabaseAggregationCommand._cursor_collections: jjt'='=>DDS!L 8~~h''r?N)ruintrwrzr) r|r}r~rrrDrGrNrLrr?r=rrsG  55(r?rN)*r __future__rcollections.abcrrrtypingrrr r pymongor pymongo.collationr pymongo.errorsr pymongo.read_preferencesrr#pymongo.asynchronous.client_sessionrpymongo.asynchronous.collectionr#pymongo.asynchronous.command_cursorrpymongo.asynchronous.databaserpymongo.asynchronous.poolrpymongo.asynchronous.serverrrpymongo.typingsrr_IS_SYNCrrrrrr?r=rszB"==668-BF?F;9248 eeP%$7%(5'D5("5(r?