File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -121,16 +121,12 @@ def censor_string(text: str) -> str:
121
121
if len_match == 3 :
122
122
return f"**{ text [2 ]} "
123
123
124
- start_privy_len = min (math .ceil (len_match / 6 ), MAXIMUM_CENSOR_LENGTH )
125
- end_privy_len = len_match - min ( math . ceil ( len_match / 6 ), MAXIMUM_CENSOR_LENGTH )
124
+ censor_start = min (math .ceil (len_match / 6 ), MAXIMUM_CENSOR_LENGTH )
125
+ censor_end = len_match - censor_start
126
126
127
127
censored = REGEX_MATCH_HIDE .sub ("*" , text )
128
128
129
- return str (
130
- text [:start_privy_len ]
131
- + censored [start_privy_len :end_privy_len ]
132
- + text [end_privy_len :]
133
- )
129
+ return text [:censor_start ] + censored [censor_start :censor_end ] + text [censor_end :]
134
130
135
131
136
132
def censor_match (match : Match ) -> str :
You can’t perform that action at this time.
0 commit comments