internal 1.0.102__py3-none-any.whl → 1.0.103__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of internal might be problematic. Click here for more details.
internal/utils.py
CHANGED
|
@@ -58,21 +58,30 @@ def get_current_utc() -> datetime:
|
|
|
58
58
|
def get_lpr_data_list_redis_key(organization_id, plate_no):
|
|
59
59
|
return f"{REDIS_LPR_DATA_LIST_PREFIX}_{organization_id}_{plate_no}"
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
|
|
62
|
+
async def mask_name(input_string: str, start_index: int = 1, end_index: int = None, mask_char: str = "o"):
|
|
62
63
|
"""
|
|
63
64
|
将姓名的前 start_index 个字符保留,其余字符替换为 'o',用于隐码处理。
|
|
64
65
|
|
|
66
|
+
:param mask_char: 隱碼替換字符
|
|
65
67
|
:param input_string: 要隐码的姓名字符串
|
|
66
68
|
:param start_index: 从第几位开始进行隐码处理(默认值为 1)
|
|
69
|
+
:param end_index: 从第几位結束进行隐码处理(默认值为 None)
|
|
67
70
|
:return: 隐码处理后的字符串
|
|
68
71
|
"""
|
|
69
72
|
if not input_string:
|
|
70
|
-
return
|
|
73
|
+
return None
|
|
74
|
+
|
|
75
|
+
if end_index is None or end_index > len(input_string):
|
|
76
|
+
end_index = len(input_string)
|
|
71
77
|
|
|
72
78
|
# 保留前 start_index 个字符
|
|
73
|
-
|
|
79
|
+
visible_part_start = input_string[:start_index]
|
|
80
|
+
|
|
81
|
+
# 保留从 end_index 之后的字符
|
|
82
|
+
visible_part_end = input_string[end_index:]
|
|
74
83
|
|
|
75
|
-
# 创建隐码部分,其余字符替换为
|
|
76
|
-
masked_part = mask_char * (
|
|
84
|
+
# 创建隐码部分,其余字符替换为 mask_char
|
|
85
|
+
masked_part = mask_char * (end_index - start_index)
|
|
77
86
|
|
|
78
|
-
return
|
|
87
|
+
return visible_part_start + masked_part + visible_part_end
|
|
@@ -33,8 +33,8 @@ internal/middleware/log_request.py,sha256=bXAxmvvsYDhObXzfUw4ZNreKAWOo8ee_vpb6Xi
|
|
|
33
33
|
internal/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
34
|
internal/model/base_model.py,sha256=NWjysNOp2MfXvAHGFqaQA_l8ZfTFvJbXQPUPuOXN_2g,5361
|
|
35
35
|
internal/model/operate.py,sha256=QSM6yXYXpJMwrqkUGEWZLrEBaUgqHwVHY_Fi4S42hKc,3190
|
|
36
|
-
internal/utils.py,sha256=
|
|
36
|
+
internal/utils.py,sha256=i6YZdiXsiWnOjRdlJ6afNCGpyMe3Uo9mhm3xlQBy3Ls,2824
|
|
37
37
|
internal/validator_utils.py,sha256=5ZLcNIgw1hvkYOj1f6gS9AYxe7Y3ufW9FyDxUS7FsMQ,1226
|
|
38
|
-
internal-1.0.
|
|
39
|
-
internal-1.0.
|
|
40
|
-
internal-1.0.
|
|
38
|
+
internal-1.0.103.dist-info/METADATA,sha256=hOAjVDnr39M_B3ABah0C55kg34CcefHGLKBaNx5WsME,757
|
|
39
|
+
internal-1.0.103.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
|
40
|
+
internal-1.0.103.dist-info/RECORD,,
|
|
File without changes
|