langchain_community.utilities.gitlab
.GitLabAPIWrapper¶
- class langchain_community.utilities.gitlab.GitLabAPIWrapper[source]¶
Bases:
BaseModel
GitLab API的封装。
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- param gitlab_base_branch: Optional[str] = None¶
GitLab存储库中的基本分支,用于比较。通常为’main’或’master’。默认为’main’。
- param gitlab_branch: Optional[str] = None¶
GitLab存储库中机器人将提交的特定分支。默认为’main’。
- param gitlab_personal_access_token: Optional[str] = None¶
用于GitLab服务的个人访问令牌,用于身份验证。
- param gitlab_repository: Optional[str] = None¶
GitLab存储库的名称,格式为{用户名}/{存储库名称}。
- comment_on_issue(comment_query: str) str [source]¶
- 在gitlab问题中添加注释
# 参数: # comment_query(str): 包含问题编号、两个换行符和注释的字符串。 # 例如: “1
- 正在处理中”
# 将注释”正在处理中”添加到问题1中 # 返回: # str: 成功或失败消息
- Parameters
comment_query (str) –
- Return type
str
- classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) Model ¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
- Parameters
_fields_set (Optional[SetStr]) –
values (Any) –
- Return type
Model
- copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) Model ¶
Duplicate a model, optionally choose which fields to include, exclude and change.
- Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in new model
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include
update (Optional[DictStrAny]) – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data
deep (bool) – set to True to make a deep copy of the model
self (Model) –
- Returns
new model instance
- Return type
Model
- create_file(file_query: str) str [source]¶
- 在gitlab仓库上创建一个新文件
- 参数:
file_query(str): 一个包含文件路径和文件内容的字符串。文件路径是字符串的第一行,内容是字符串的其余部分。 例如, “hello_world.md
- # Hello World!”
- 返回:
str: 一个成功或失败的消息
- Parameters
file_query (str) –
- Return type
str
- create_pull_request(pr_query: str) str [source]¶
- 从机器人的分支向基础分支发起拉取请求
- 参数:
pr_query(str): 包含PR标题和PR正文的字符串。标题是字符串的第一行,正文是字符串的其余部分。 例如,”更新了README
- 进行了添加信息的更改”
- 返回:
str: 成功或失败消息
- Parameters
pr_query (str) –
- Return type
str
- delete_file(file_path: str) str [source]¶
从仓库中删除一个文件 参数:
file_path(str): 文件所在的路径
- 返回:
str: 成功或失败的消息
- Parameters
file_path (str) –
- Return type
str
- dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) DictStrAny ¶
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) –
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) –
by_alias (bool) –
skip_defaults (Optional[bool]) –
exclude_unset (bool) –
exclude_defaults (bool) –
exclude_none (bool) –
- Return type
DictStrAny
- classmethod from_orm(obj: Any) Model ¶
- Parameters
obj (Any) –
- Return type
Model
- get_issue(issue_number: int) Dict[str, Any] [source]¶
获取特定问题及其前10条评论 参数:
issue_number(int): gitlab问题的编号
- 返回:
dict: 包含问题标题、内容和评论的字典,评论以字符串形式表示
- Parameters
issue_number (int) –
- Return type
Dict[str, Any]
- json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) unicode ¶
Generate a JSON representation of the model, include and exclude arguments as per dict().
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().
- Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) –
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) –
by_alias (bool) –
skip_defaults (Optional[bool]) –
exclude_unset (bool) –
exclude_defaults (bool) –
exclude_none (bool) –
encoder (Optional[Callable[[Any], Any]]) –
models_as_dict (bool) –
dumps_kwargs (Any) –
- Return type
unicode
- classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) Model ¶
- Parameters
path (Union[str, Path]) –
content_type (unicode) –
encoding (unicode) –
proto (Protocol) –
allow_pickle (bool) –
- Return type
Model
- parse_issues(issues: List[Issue]) List[dict] [source]¶
从每个问题中提取标题和编号,并将它们放入字典中 参数:
issues(List[Issue]): 一个gitlab问题对象的列表
- 返回:
List[dict]: 一个包含问题标题和编号的字典
- Parameters
issues (List[Issue]) –
- Return type
List[dict]
- classmethod parse_obj(obj: Any) Model ¶
- Parameters
obj (Any) –
- Return type
Model
- classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) Model ¶
- Parameters
b (Union[str, bytes]) –
content_type (unicode) –
encoding (unicode) –
proto (Protocol) –
allow_pickle (bool) –
- Return type
Model
- read_file(file_path: str) str [source]¶
从gitlab仓库中读取文件 参数:
file_path(str): 文件路径
- 返回:
str: 解码为字符串的文件
- Parameters
file_path (str) –
- Return type
str
- classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') DictStrAny ¶
- Parameters
by_alias (bool) –
ref_template (unicode) –
- Return type
DictStrAny
- classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) unicode ¶
- Parameters
by_alias (bool) –
ref_template (unicode) –
dumps_kwargs (Any) –
- Return type
unicode
- update_file(file_query: str) str [source]¶
更新文件内容。 参数:
- file_query(str): 包含文件路径和文件内容。
旧文件内容用OLD <<<<和>>>> OLD包裹 新文件内容用NEW <<<<和>>>> NEW包裹 例如: test/hello.txt OLD <<<< Hello Earth! >>>> OLD NEW <<<< Hello Mars! >>>> NEW
- 返回:
成功或失败消息
- Parameters
file_query (str) –
- Return type
str
- classmethod update_forward_refs(**localns: Any) None ¶
Try to update ForwardRefs on fields based on this Model, globalns and localns.
- Parameters
localns (Any) –
- Return type
None
- classmethod validate(value: Any) Model ¶
- Parameters
value (Any) –
- Return type
Model