Skip to content

Commit

Permalink
Python 3.11 compat fix
Browse files Browse the repository at this point in the history
random.sample() used to take arbitrary iterables, now it requires
a sequence (i.e. something that can be indexed).
  • Loading branch information
skizzerz committed Jul 19, 2023
1 parent 2ea9295 commit ecf7b0d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/debug/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def __exit__(self, exc_type: Optional[type], exc_value: Optional[BaseException],

# sanitize paths in tb: convert backslash to forward slash and remove prefixes from src and library paths
variables[1] = variables[1].replace("\\", "/")
variables[1] = re.sub(r'File "[^"]*/(src|gamemodes|oyoyo|roles|lib|wolfbot)', r'File "/\1', variables[1])
variables[1] = re.sub(r'File "[^"]*/(src|gamemodes|oyoyo|roles|[Ll]ib|wolfbot)', r'File "/\1', variables[1])

# sanitize values within local frames
if len(variables) > 3:
Expand Down
2 changes: 1 addition & 1 deletion src/pregame.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def _isvalid(mode, allow_vote_only):
if count == 0 or role in ingame_state.current_mode.SECONDARY_ROLES:
continue

selected = random.sample(vils, count)
selected = random.sample(list(vils), count)
for x in selected:
ingame_state.main_roles[x] = role
vils.remove(x)
Expand Down

0 comments on commit ecf7b0d

Please sign in to comment.