Skip to content

Commit 9165464

Browse files
committed
address pull request notes
1 parent c636284 commit 9165464

2 files changed

Lines changed: 2 additions & 34 deletions

File tree

sigmf/archive.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -76,38 +76,6 @@ def _get_archive_basename(path):
7676
return path.stem
7777

7878

79-
def _get_archive_basename(path):
80-
"""Get the archive base name (without any sigmf archive extension).
81-
82-
Parameters
83-
----------
84-
path : Path
85-
Archive file path.
86-
87-
Returns
88-
-------
89-
str
90-
Base name without sigmf extension.
91-
92-
Examples
93-
--------
94-
>>> _get_archive_basename(Path("recording.sigmf"))
95-
'recording'
96-
>>> _get_archive_basename(Path("recording.sigmf.gz"))
97-
'recording'
98-
>>> _get_archive_basename(Path("my.recording.sigmf.zip"))
99-
'my.recording'
100-
"""
101-
name = path.name
102-
# check compound extensions first (longest match)
103-
for ext in sorted(SIGMF_COMPRESSED_EXTS.values(), key=len, reverse=True):
104-
if name.endswith(ext):
105-
return name[: -len(ext)]
106-
if name.endswith(SIGMF_ARCHIVE_EXT):
107-
return name[: -len(SIGMF_ARCHIVE_EXT)]
108-
return path.stem
109-
110-
11179
class SigMFArchive:
11280
"""
11381
Archive a SigMFFile into a tar or zip file, optionally with compression.

sigmf/sigmffile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ def add_annotation(self, start_index, length=None, metadata=None):
633633
new_annot = metadata or {}
634634
new_annot[keys.SAMPLE_START_KEY] = start_index
635635
if length is not None:
636-
if length <= 0:
636+
if length < 0:
637637
raise SigMFAccessError("Annotation `length` must be >= 0")
638638
new_annot[keys.SAMPLE_COUNT_KEY] = length
639639

@@ -724,7 +724,7 @@ def _count_samples(self):
724724
def _get_sample_count_from_annotations(self):
725725
"""
726726
Returns the number of samples based on annotation with highest end index.
727-
NOTE: Annotations are ordered by START_INDEX_KEY and not end index, so we
727+
NOTE: Annotations are ordered by SAMPLE_START_KEY and not end index, so we
728728
need to go through all annotations
729729
"""
730730
annon_sample_count = []

0 commit comments

Comments
 (0)