Skip to content

Commit

Permalink
fix: Remove Deprecation errors in Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
b-butler committed Nov 14, 2023
1 parent 6ac49db commit 63d9550
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Added
Changed
+++++++

- Restrict allowable tar file features in Python 3.12 (#957).
- linked views now can contain spaces and other characters except directory separators (#926).

[2.1.0] -- 2023-07-12
Expand Down
8 changes: 7 additions & 1 deletion signac/import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import os
import re
import shutil
import sys
import tarfile
import zipfile
from collections import Counter
Expand Down Expand Up @@ -1144,7 +1145,12 @@ def read_statepoint_file(path):
"The jobs identified with the given schema function are not unique!"
)

tarfile.extractall(path=tmpdir)
if sys.version_info[2] >= 12:
# the data filter should support all needed operations for users using signac's import
# feature. Other filters assume Unix specific features.
tarfile.extractall(path=tmpdir, filter="data")
else:
tarfile.extractall(path=tmpdir)
for path, job in mappings.items():
if not os.path.isdir(tmpdir):
raise RuntimeError(f"The provided tmpdir {tmpdir} is not a directory.")
Expand Down

0 comments on commit 63d9550

Please sign in to comment.