Skip to content

Commit

Permalink
Infer .lzma files (#1514)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdaulet authored Jan 26, 2024
1 parent 7700b69 commit f17b6f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fsspec/compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ def isal(infile, mode="rb", **kwargs):
try:
from lzma import LZMAFile

register_compression("lzma", LZMAFile, "xz")
register_compression("xz", LZMAFile, "xz", force=True)
register_compression("lzma", LZMAFile, "lzma")
register_compression("xz", LZMAFile, "xz")
except ImportError:
pass

try:
import lzmaffi

register_compression("lzma", lzmaffi.LZMAFile, "xz", force=True)
register_compression("lzma", lzmaffi.LZMAFile, "lzma", force=True)
register_compression("xz", lzmaffi.LZMAFile, "xz", force=True)
except ImportError:
pass
Expand Down
1 change: 1 addition & 0 deletions fsspec/tests/test_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def test_infer_uppercase_compression():
def test_lzma_compression_name():
pytest.importorskip("lzma")
assert infer_compression("fn.xz") == "xz"
assert infer_compression("fn.lzma") == "lzma"


def test_lz4_compression(tmpdir):
Expand Down

0 comments on commit f17b6f9

Please sign in to comment.