Skip to content

Commit

Permalink
Fix dummy processing
Browse files Browse the repository at this point in the history
  • Loading branch information
FNTwin committed Feb 20, 2024
1 parent bb5b909 commit 0856c1c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion safe/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,9 @@ def encoder(
val = str(starting_num) if starting_num < 10 else f"%{starting_num}"
# we cannot have anything of the form "\([@=-#-$/\]*\d+\)"
attach_regexp = re.compile(r"(" + re.escape(attach) + r")")
scaffold_str = attach_regexp.sub(val, scaffold_str)
# check if we have at least 2 matches, if not, we have a dummy
n_matches= len(attach_regexp.findall(scaffold_str))
scaffold_str = attach_regexp.sub(val, scaffold_str) if n_matches > 1 else scaffold_str.replace(attach, "*")
starting_num += 1
# now we need to remove all the parenthesis around digit only number
wrong_attach = re.compile(r"\(([\%\d]*)\)")
Expand Down

0 comments on commit 0856c1c

Please sign in to comment.