Skip to content

Commit

Permalink
[src/Soros.py] fix FutureWarning: Possible nested set at position
Browse files Browse the repository at this point in the history
reported by Rene Engelhard in GitHub #61.

Also use python3 during unit testing, and remove obsolete "test".
  • Loading branch information
laszlonemeth committed Nov 30, 2021
1 parent 7c8dece commit 8810ddf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/Soros.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def __init__(self, prg, lang):
""")
prg = _tr(prg, _m[:4], _c[:4], "\\") # \\, \", \;, \# -> \uE000..\uE003
# switch off all country-dependent lines, and switch on the requested ones
prg = re.sub(r"(^|[\n;])([^\n;#]*#[^\n]*[[]:[^\n:\]]*:][^\n]*)", r"\1#\2", prg)
prg = re.sub(r"(^|[\n;])#([^\n;#]*#[^\n]*[[]:" + lang.replace("_", "-") + r":][^\n]*)", r"\1\2", prg)
prg = re.sub(r"(^|[\n;])([^\n;#]*#[^\n]*[\[]:[^\n:\]]*:][^\n]*)", r"\1#\2", prg)
prg = re.sub(r"(^|[\n;])#([^\n;#]*#[^\n]*[\[]:" + lang.replace("_", "-") + r":][^\n]*)", r"\1\2", prg)
matchline = re.compile("^\s*(\"[^\"]*\"|[^\s]*)\s*(.*[^\s])?\s*$")
prefix = ""
for s in re.sub("(#[^\n]*)?(\n|$)", ";", prg).split(";"):
Expand Down Expand Up @@ -70,8 +70,8 @@ def __init__(self, prg, lang):
s2 = ""
s2 = _tr(s2, _m[4:], _c[4:], "\\") # \$, \(, \), \|, \[, \] -> \uE004..\uE009
# call inner separator: [ ... $1 ... ] -> $(\uE00A ... \uE00A$1\uE00A ... )
s2 = re.sub(r"[[]\$(\d\d?|\([^\)]+\))",u"$(\uE00A\uE00A|$\\1\uE00A", s2)
s2 = re.sub(r"[[]([^\$[\\]*)\$(\d\d?|\([^\)]+\))",u"$(\uE00A\\1\uE00A$\\2\uE00A", s2)
s2 = re.sub(r"[\[]\$(\d\d?|\([^\)]+\))",u"$(\uE00A\uE00A|$\\1\uE00A", s2)
s2 = re.sub(r"[\[]([^\$[\\]*)\$(\d\d?|\([^\)]+\))",u"$(\uE00A\\1\uE00A$\\2\uE00A", s2)
s2 = re.sub(r"\uE00A]$","|\uE00A)", s2) # add "|" in terminating position
s2 = re.sub(r"]",")", s2)
s2 = re.sub(r"(\$\d|\))\|\$", r"\1||$", s2) # $()|$() -> $()||$()
Expand Down
12 changes: 0 additions & 12 deletions test/test

This file was deleted.

2 changes: 1 addition & 1 deletion test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ if [ ! -d $TEMPDIR ]; then
mkdir $TEMPDIR
fi

PYTHONPATH=../src/ python test.py $TESTDIR/$1 $TESTDIR/$2 $TEMPDIR/test.out$$
PYTHONPATH=../src/ python3 test.py $TESTDIR/$1 $TESTDIR/$2 $TEMPDIR/test.out$$
diff -u $TEMPDIR/test.out$$ $TESTDIR/$3 || exit 1

0 comments on commit 8810ddf

Please sign in to comment.