Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for fz compression #44

Merged
merged 2 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Change Log

This document records the main changes to the sdss_access code.

3.0.2 (unreleased)
------------------
- Add support for .fz compression

3.0.1 (2023-06-17)
------------------
- Bug fix for remote access to IPLs > IPL-1
Expand Down
4 changes: 2 additions & 2 deletions python/sdss_access/path/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class BasePath(object):

_netloc = {"dtn": "dtn.sdss.org", "sdss": "data.sdss.org", "sdss5": "data.sdss5.org",
"mirror": "data.mirror.sdss.org", "svn": "svn.sdss.org"}
_s5cfgs = ['sdss', 'ipl'] # SDSS-V releases start with sdss or ipl.
_s5cfgs = ['sdss', 'ipl'] # SDSS-V releases start with sdss or ipl.

def __init__(self, release=None, public=False, mirror=False, verbose=False,
force_modules=None, preserve_envvars=None):
Expand All @@ -112,7 +112,7 @@ def __init__(self, release=None, public=False, mirror=False, verbose=False,

# set attributes
self._special_fxn_pattern = r"\@\w+[|]"
self._compressions = ['.gz', '.bz2', '.zip']
self._compressions = ['.gz', '.bz2', '.zip', '.fz']
self._comp_regex = r'({0})$'.format('|'.join(self._compressions))

# set the path templates from the tree
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ dev =
wheel>=0.33.6

docs =
Sphinx>=2.1.0
Sphinx>=7.1.0
sphinx_bootstrap_theme>=0.4.12
recommonmark>=0.6
sphinx-issues>=1.2.0
Expand Down
4 changes: 2 additions & 2 deletions tests/misc/test_docupaths.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ def test_docupaths(app, status, warning):
dmdoc = app.srcdir / "_build/html/contents.html"
assert dmdoc.exists()

tt = dmdoc.read_text()
tt = dmdoc.read_text()

# check for datamodel directive stuff
assert '<section id="datamodel">' in tt
assert '<h2>DR17<a class="headerlink" href="#dr17" title="Permalink to this heading">¶</a></h2>' in tt
assert '<h2>DR17<a class="headerlink" href="#dr17" title="Link to this heading">¶</a></h2>' in tt
assert "<td><p>$MANGA_SPECTRO_REDUX/{drpver}/{plate}/stack/manga-{plate}-{ifu}-{wave}CUBE.fits.gz</p></td>" in tt

# check for changelog directive stuff
Expand Down
20 changes: 20 additions & 0 deletions tests/path/test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,26 @@ def test_sdss5_paths(self, monkeypatch):

assert f1 == f2

@pytest.mark.parametrize('exist', [True, False])
def test_fzcomp(self, exist, path, monkeypatch, tmp_path):
""" test to test we recognize fz files """

d = tmp_path / "sas"
d.mkdir()

# create the file
if exist:
ff = d / "test.txt"
ff.touch()

monkeypatch.setitem(path.templates, 'test', str(d/'test.txt.fz'))
pp = path.full('test')
print(pp)

if exist:
assert pp.endswith('test.txt')
else:
assert pp.endswith('test.txt.fz')

@pytest.fixture()
def monkeyoos(monkeypatch, mocker):
Expand Down
Loading