
    dh                        S SK Jr  S SKJrJrJrJrJrJr  S SK	J
r
  S SKJr  S SKJr  \(       a
  S SKJrJrJr   " S S\5      rg	)
    )annotations)TYPE_CHECKINGAnyIteratorLiteralOptionalTuple)Document)get_from_env)
BaseLoader)BoardCardTrelloClientc                      \ rS rSrSrSSSSSS.             SS jjr\SSS	.         SS
 jj5       rSS jrSS jr	SS jr
Srg)TrelloLoader   z!Load cards from a `Trello` board.Tall)due_datelabelslistclosed)include_card_nameinclude_commentsinclude_checklistcard_filterextra_metadatac               X    Xl         X l        X0l        X@l        XPl        Xpl        X`l        g)ai  Initialize Trello loader.

Args:
    client: Trello API client.
    board_name: The name of the Trello board.
    include_card_name: Whether to include the name of the card in the document.
    include_comments: Whether to include the comments on the card in the
        document.
    include_checklist: Whether to include the checklist on the card in the
        document.
    card_filter: Filter on card status. Valid values are "closed", "open",
        "all".
    extra_metadata: List of additional metadata fields to include as document
        metadata.Valid values are "due_date", "labels", "list", "closed".

N)client
board_namer   r   r   r   r   )selfr   r   r   r   r   r   r   s           c/var/www/html/shao/venv/lib/python3.13/site-packages/langchain_community/document_loaders/trello.py__init__TrelloLoader.__init__   s,    6 $!2 0!2,&    Napi_keytokenc                    SSK Jn  U=(       d    [        SS5      nU=(       d    [        SS5      nU" X#S	9nU " Xq40 UD6$ ! [         a  n[        S5      UeSnAff = f)
a4  Convenience constructor that builds TrelloClient init param for you.

Args:
    board_name: The name of the Trello board.
    api_key: Trello API key. Can also be specified as environment variable
        TRELLO_API_KEY.
    token: Trello token. Can also be specified as environment variable
        TRELLO_TOKEN.
    include_card_name: Whether to include the name of the card in the document.
    include_comments: Whether to include the comments on the card in the
        document.
    include_checklist: Whether to include the checklist on the card in the
        document.
    card_filter: Filter on card status. Valid values are "closed", "open",
        "all".
    extra_metadata: List of additional metadata fields to include as document
        metadata.Valid values are "due_date", "labels", "list", "closed".
r   )r   zWCould not import trello python package. Please install it with `pip install py-trello`.Nr&   TRELLO_API_KEYr'   TRELLO_TOKENr%   )trellor   ImportErrorr   )clsr   r&   r'   kwargsr   exr   s           r!   from_credentialsTrelloLoader.from_credentials4   ss    8	+ F\)5EF>g~>g;6000  	B 	s   A 
AAAc              #  P  #     SSK Jn  U R                  5       nUR	                  5        Vs0 sH  oDR
                  UR                  _M     nnUR                  U R                  S9nU H  nU R                  Xu5      v   M     g! [         a  n[        S5      UeSnAff = fs  snf 7f)zLoads all cards from the specified Trello board.

You can filter the cards, metadata and text included by using the optional
    parameters.

 Returns:
    A list of documents, one for each card in the board.
r   BeautifulSoupzK`beautifulsoup4` package not found, please run `pip install beautifulsoup4`N)r   )
bs4r4   r,   
_get_board
list_listsidname	get_cardsr   _card_to_doc)r    r4   r/   board	list_item	list_dictcardscards           r!   	lazy_loadTrelloLoader.lazy_load\   s     	) !CHCSCSCUVCUi\\9>>1CU	VD,<,<=D##D44   	0 	 Ws2   B&B "B&B!8B&
BBBB&c                   ^  [        U 4S jT R                  R                  5        5       S 5      nU(       d  [        ST R                   S35      eU$ )Nc              3  \   >#    U H"  oR                   TR                  :X  d  M  Uv   M$     g 7f)N)r9   r   ).0br    s     r!   	<genexpr>*TrelloLoader._get_board.<locals>.<genexpr>x   s"     O11VVt5NQQ1s   ,	,zBoard `z` not found.)nextr   list_boards
ValueErrorr   )r    r<   s   ` r!   r6   TrelloLoader._get_boardu   sH    O//1OQU
 wt&7|DEEr$   c                Z   SSK Jn  SnU R                  (       a  UR                  S-   nUR                  R                  5       (       a#  XC" UR                  S5      R                  5       -  nU R                  (       ap  UR                   H`  nUR                  (       d  M  UR                   Vs/ sH  ofS    SUS    3PM     nnUSUR                   S3SR                  U5      -   -  nMb     U R                  (       aM  UR                   Vs/ sH   nU" US	   S
   S5      R                  5       PM"     n	nUSSR                  U	5      -   -  nUR                  UR                  UR                  S.n
SU R                  ;   a(  UR                    Vs/ sH  oR                  PM     snU
S'   SU R                  ;   a!  UR"                  U;   a  X!R"                     U
S'   SU R                  ;   a  UR$                  U
S'   SU R                  ;   a  UR&                  U
S'   [)        XJS9$ s  snf s  snf s  snf )Nr   r3    
lxmlr9   :statedatatextz	Comments:)titler8   urlr   r   r   r   )page_contentmetadata)r5   r4   r   r9   descriptionstripget_textr   
checklistsitemsjoinr   commentsr8   rV   r   r   list_idr   r   r
   )r    r@   r>   r4   text_content	checklistitemr]   commentr_   rX   labels               r!   r;   TrelloLoader._card_to_doc~   s   %!!99t+L!!##M$*:*:FCLLNNL!!!__	???FOooFUd<.$w-9o   !b(8$;dii>N$NNL -     $}},G gfof5v>GGI,   K$))H*===L YY''88
 t***:>++!F+**+!FHXT(((||y(#,\\#: t***!%HX,,,#'==HZ \EE? "Gs   ,H&H#H()r   r   r   r   r   r   r   )r   r   r   strr   boolr   rh   r   rh   r   z Literal['closed', 'open', 'all']r   zTuple[str, ...])
r   rg   r&   Optional[str]r'   ri   r.   r   returnr   )rj   zIterator[Document])rj   r   )r@   r   r>   dictrj   r
   )__name__
__module____qualname____firstlineno____doc__r"   classmethodr0   rA   r6   r;   __static_attributes__ r$   r!   r   r      s    + #'!%"&8=*R!'!' !'
  !' !'  !' 6!' (!'F 
 "&#%1%1 	%1
 %1 %1 
%1 %1N52+Fr$   r   N)
__future__r   typingr   r   r   r   r   r	   langchain_core.documentsr
   langchain_core.utilsr   )langchain_community.document_loaders.baser   r+   r   r   r   r   rs   r$   r!   <module>ry      s0    " I I - - @00[F: [Fr$   