ADD file via upload
This commit is contained in:
parent
fb5004791c
commit
b2bb8c4bcd
|
@ -0,0 +1,124 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# @Time : 2021/9/27 20:40
|
||||||
|
# @Author : Flora.Chen
|
||||||
|
# @File : handler.py
|
||||||
|
# @Software: PyCharm
|
||||||
|
# @Desc:
|
||||||
|
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
class MidHandler:
|
||||||
|
# 系统中的管理员用户
|
||||||
|
super_login = None
|
||||||
|
super_id = None
|
||||||
|
super_nickname = None
|
||||||
|
super_password = None
|
||||||
|
|
||||||
|
# 默认用户是作为项目的管理员权限角色用户
|
||||||
|
user_id = None
|
||||||
|
login = None
|
||||||
|
nickname = None
|
||||||
|
password = None
|
||||||
|
cookies = None
|
||||||
|
|
||||||
|
# 项目中的开发者权限角色用户
|
||||||
|
developer_login = None
|
||||||
|
developer_id = None
|
||||||
|
developer_nickname = None
|
||||||
|
developer_password = None
|
||||||
|
developer_cookies = None
|
||||||
|
|
||||||
|
# 项目中的报告者权限角色用户
|
||||||
|
reporter_login = None
|
||||||
|
reporter_id = None
|
||||||
|
reporter_nickname = None
|
||||||
|
reporter_password = None
|
||||||
|
report_cookies = None
|
||||||
|
|
||||||
|
# 项目名称
|
||||||
|
project_name = None
|
||||||
|
# 项目描述
|
||||||
|
project_description = None
|
||||||
|
# 项目标识
|
||||||
|
identifier = None
|
||||||
|
|
||||||
|
# 仓库的owner+identifier
|
||||||
|
project_full_name = None
|
||||||
|
|
||||||
|
# fork仓库的相关字段
|
||||||
|
fork_project_origin_branch = None
|
||||||
|
fork_project_id = None
|
||||||
|
fork_project_identifier = None
|
||||||
|
# 错误的fork仓库id
|
||||||
|
fork_project_id_wrong = None
|
||||||
|
|
||||||
|
# 错误的user_id
|
||||||
|
user_id_wrong = None
|
||||||
|
# 已被使用的项目名称
|
||||||
|
project_name_used = None
|
||||||
|
# 项目名称长度超过50
|
||||||
|
project_name_51 = None
|
||||||
|
# 项目名称含有特殊字符
|
||||||
|
project_name_characters = None
|
||||||
|
# 项目标识含有特殊字符
|
||||||
|
identifier_characters = None
|
||||||
|
# 项目标识长度超过100
|
||||||
|
identifier_101 = None
|
||||||
|
|
||||||
|
# 合并请求标题
|
||||||
|
pr_title = None
|
||||||
|
# 合并请求的内容
|
||||||
|
pr_content = None
|
||||||
|
|
||||||
|
# 合并请求的审查人员
|
||||||
|
reviewer_user_id = None
|
||||||
|
reviewer_user_login = None
|
||||||
|
reviewer_user_name = None
|
||||||
|
|
||||||
|
# 合并请求所属里程碑
|
||||||
|
version_id = None
|
||||||
|
version_name = None
|
||||||
|
# 合并请求标记 (列表嵌套字典)
|
||||||
|
issue_tags = None
|
||||||
|
issue_tag_ids = None
|
||||||
|
# 合并请求的优先级
|
||||||
|
priority_id = None
|
||||||
|
priority_name = None
|
||||||
|
# 合并请求的源分支
|
||||||
|
origin_branch = None
|
||||||
|
# 合并请求的目标分支
|
||||||
|
target_branch = None
|
||||||
|
# 合并请求的文件数量
|
||||||
|
files_count = None
|
||||||
|
# 合并请求的提交数量
|
||||||
|
commits_count = None
|
||||||
|
# 合并请求标题长度超过255
|
||||||
|
pr_title_256 = None
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def replace_data(cls, string, pattern=r"#(.*?)#"):
|
||||||
|
"""
|
||||||
|
动态替换数据的方法
|
||||||
|
:param string: 需要替换的字符串
|
||||||
|
:param pattern: 正则表达式匹配规则
|
||||||
|
:return: 替换后的字符串
|
||||||
|
"""
|
||||||
|
res = re.finditer(pattern=pattern, string=string)
|
||||||
|
for i in res:
|
||||||
|
string = string.replace(i.group(), str(getattr(cls, i.group(1))))
|
||||||
|
return string
|
||||||
|
|
||||||
|
# @classmethod
|
||||||
|
# def replace_data(cls, string, pattern=r"$(.*?)$"):
|
||||||
|
# """
|
||||||
|
# 动态替换数据的方法
|
||||||
|
# :param string: 需要替换的字符串
|
||||||
|
# :param pattern: 正则表达式匹配规则
|
||||||
|
# :return: 替换后的字符串
|
||||||
|
# """
|
||||||
|
# res = re.finditer(pattern=pattern, string=string)
|
||||||
|
# for i in res:
|
||||||
|
# string = string.replace(i.group(), str(getattr(cls, i.group(1))))
|
||||||
|
# return string
|
Loading…
Reference in New Issue