forked from sigmf/sigmf-python
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
address feedback, created common base class for sigmffile and new sig…
…mffilecollection class
- Loading branch information
Showing
8 changed files
with
144 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from abc import ABC, abstractmethod | ||
from typing import Iterable | ||
|
||
import sigmf | ||
|
||
from .archive import SigMFArchive | ||
|
||
|
||
class AbstractSigMFFileCollection(ABC): | ||
|
||
@abstractmethod | ||
def sigmffile_count(self): | ||
pass | ||
|
||
@abstractmethod | ||
def get_sigmffiles(self): | ||
pass | ||
|
||
# should tofile() be added? | ||
|
||
@abstractmethod | ||
def archive(self, name=None, fileobj=None, pretty=True): | ||
pass | ||
|
||
|
||
class SigMFFileCollection(AbstractSigMFFileCollection): | ||
|
||
def __init__(self, sigmffiles: Iterable["sigmf.sigmffile.SigMFFile"]) -> None: | ||
self.sigmffiles = sigmffiles | ||
|
||
def sigmffile_count(self): | ||
return len(self.sigmffiles) | ||
|
||
def get_sigmffiles(self): | ||
return self.sigmffiles | ||
|
||
# should tofile() be added? | ||
def archive(self, name=None, fileobj=None, pretty=True): | ||
archive = SigMFArchive(self, | ||
path=name, | ||
fileobj=fileobj, | ||
pretty=pretty) | ||
return archive.path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.