
    hh                         d Z ddlmZmZmZ ddlmZ ddlmZ ddl	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ g dZ G d	 d
e          ZdS )zGitLab Toolkit.    )DictListOptional)BaseTool)BaseToolkit)COMMENT_ON_ISSUE_PROMPTCREATE_FILE_PROMPTCREATE_PULL_REQUEST_PROMPTCREATE_REPO_BRANCHDELETE_FILE_PROMPTGET_ISSUE_PROMPTGET_ISSUES_PROMPTGET_REPO_FILES_FROM_DIRECTORYGET_REPO_FILES_IN_BOT_BRANCHGET_REPO_FILES_IN_MAINLIST_REPO_BRANCESREAD_FILE_PROMPTSET_ACTIVE_BRANCHUPDATE_FILE_PROMPTGitLabAction)GitLabAPIWrapper)
get_issues	get_issuecomment_on_issuecreate_pull_requestcreate_file	read_fileupdate_filedelete_filec                       e Zd ZU dZg Zee         ed<   eddde	de
ee                  dd fd            Zdee         fd	ZdS )
GitLabToolkita  GitLab Toolkit.

    *Security Note*: This toolkit contains tools that can read and modify
        the state of a service; e.g., by creating, deleting, or updating,
        reading underlying data.

        For example, this toolkit can be used to create issues, pull requests,
        and comments on GitLab.

        See https://python.langchain.com/docs/security for more information.

    Parameters:
        tools: List[BaseTool]. The tools in the toolkit. Default is an empty list.
    toolsN)included_toolsgitlab_api_wrapperr$   returnc                   ||nt           ddt          dddt          dddt          dd	d
t          dddt
          dddt          dddt          dddt          dddt          dddt          dddt          dddt          dddt          dddt          dg}fd|D             }fd |D             } | |!          S )"zCreate a GitLabToolkit from a GitLabAPIWrapper.

        Args:
            gitlab_api_wrapper: GitLabAPIWrapper. The GitLab API wrapper.

        Returns:
            GitLabToolkit. The GitLab toolkit.
        Nr   z
Get Issues)modenamedescriptionr   z	Get Issuer   zComment on Issuer   zCreate Pull Requestr   zCreate Filer   z	Read Filer   zUpdate Filer    zDelete Filecreate_branchzCreate a new branchlist_branches_in_repozGet the list of branchesset_active_branchzChange the active branchlist_files_in_main_branchz)Overview of existing files in Main branchlist_files_in_bot_branchz+Overview of files in current working branchlist_files_from_directoryz@Overview of files in current working branch from a specific pathc                 (    g | ]}|d          v |S )r(    ).0	operationtools_to_includes     n/var/www/FlaskApp/flask-venv/lib/python3.11/site-packages/langchain_community/agent_toolkits/gitlab/toolkit.py
<listcomp>z9GitLabToolkit.from_gitlab_api_wrapper.<locals>.<listcomp>   s4     
 
 
 $444 444    c                 Z    g | ]'}t          |d          |d         |d                   (S )r)   r*   r(   )r)   r*   r(   api_wrapperr   )r3   actionr%   s     r6   r7   z9GitLabToolkit.from_gitlab_api_wrapper.<locals>.<listcomp>   sS     
 
 
  F^"=1F^.	  
 
 
r8   r#   )DEFAULT_INCLUDED_TOOLSr   r   r   r
   r	   r   r   r   r   r   r   r   r   r   )clsr%   r$   
operationsoperations_filteredr#   r5   s    `    @r6   from_gitlab_api_wrapperz%GitLabToolkit.from_gitlab_api_wrapper<   s   " -8NN>T 	 %$0  $#/  +*6  .-9  &%1  $#/  &%1  &%1  (-1  020  ,20  4C5  3E;  4Z< EG"

P
 
 
 
'
 
 


 
 
 
 .
 
 
 sr8   c                     | j         S )zGet the tools in the toolkit.r<   )selfs    r6   	get_toolszGitLabToolkit.get_tools   s
    zr8   )__name__
__module____qualname____doc__r#   r   r   __annotations__classmethodr   r   strrA   rD   r2   r8   r6   r"   r"   *   s           E4>
 /3	i  i  i ,i  !c+	i 
 
i  i  i  [i V4>      r8   r"   N)rH   typingr   r   r   langchain_core.toolsr   langchain_core.tools.baser   'langchain_community.tools.gitlab.promptr   r	   r
   r   r   r   r   r   r   r   r   r   r   r   %langchain_community.tools.gitlab.toolr   $langchain_community.utilities.gitlabr   r=   r"   r2   r8   r6   <module>rR      sc     ' ' ' ' ' ' ' ' ' ' ) ) ) ) ) ) 1 1 1 1 1 1                                 ? > > > > > A A A A A A
	 	 	 @ @ @ @ @K @ @ @ @ @r8   