Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
typon
typon-compiler
Commits
fc4a6b28
Commit
fc4a6b28
authored
Aug 11, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix find_indices relying on unspecified set iteration order
parent
83f4655e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
trans/transpiler/__init__.py
trans/transpiler/__init__.py
+2
-1
No files found.
trans/transpiler/__init__.py
View file @
fc4a6b28
...
...
@@ -116,7 +116,7 @@ def find_indices(s, indices: list[int]) -> list[int]:
results
=
set
()
i
=
0
j
=
0
it
=
iter
(
s
et
(
indices
))
it
=
iter
(
s
orted
(
list
(
set
(
indices
))
))
current
=
next
(
it
)
while
i
<=
len
(
s
):
if
i
!=
len
(
s
)
and
s
[
i
]
==
"
\
x1b
"
:
...
...
@@ -142,6 +142,7 @@ assert find_indices("\x1b[48;5;237mmath.abcd\x1b[37m\x1b[39m\x1b[49m", [0, 9]) =
assert
find_indices
(
"abcdef"
,
[
2
,
5
])
==
[
2
,
5
]
assert
find_indices
(
"abc
\
x1b
[32mdef"
,
[
2
,
5
])
==
[
2
,
10
],
find_indices
(
"abc
\
x1b
[32mdef"
,
[
2
,
5
])
assert
find_indices
(
"math.abcd
\
x1b
[37m
\
x1b
[39m"
,
[
0
,
9
])
==
[
0
,
19
],
find_indices
(
"math.abcd
\
x1b
[37m
\
x1b
[39m"
,
[
0
,
9
])
assert
find_indices
(
'
\
x1b
[36mprint
\
x1b
[39m(x, y, z)
\
x1b
[37m
\
x1b
[39m'
,
[
4
,
18
])
==
[
9
,
38
],
find_indices
(
'
\
x1b
[36mprint
\
x1b
[39m(x, y, z)
\
x1b
[37m
\
x1b
[39m'
,
[
4
,
18
])
sys
.
excepthook
=
exception_hook
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment