sigmf-python
sigmf-python copied to clipboard
move keys from sigmf.SigMFFile to top-level sigmf
It's bothered me ever since the beginning that if you want to set or get some key within sigmf you needed to do sigmf.SigMFFile.VERSION_KEY instead of just doing sigmf.VERSION_KEY. Now we appear to also have keys within archive.py for file extensions, which is strange.
Other modules (logging, pygame, numpy) have global vars like this in the top level.
I would like to:
- Consolidate all keys into
keys.pyor similar name. - In the
__init__.pydofrom .keys import *so that we can access a key usingsigmf.VERSION_KEY. - In
SigMFFileattach keys as properties for now and insert a comment saying that functionality will be deprecated in a future version. This keeps backwards compatibility.
This change should increment the minor version (major.minor.patch).
Agree on all points, especially the file extension keys being in archive.py makes little sense. Also noticed that some of the code doesn't actually use these keys and uses the hard-coded extensions instead.
In archivereader.py:
raise SigMFFileError("No .sigmf-data file found in archive!")
In sigmffile.py:
if metafile.endswith(".sigmf-meta") and path.isfile(metafile_path):
metafile = stream_name + ".sigmf_meta"
metafile = self.get_stream_names()[stream_index] + ".sigmf_meta"
The last two are actually incorrect (.sigmf_meta instead of .sigmf-meta) ! However this bug doesn't manifest itself since fromfile treats every extension other that .sigmf and .sigmf-collection as if it were .sigmf-meta (perhaps that's also not ideal).