Skip to content

Commit

Permalink
FileLoaderBase: First attempt at making path: str abstract attr
Browse files Browse the repository at this point in the history
  • Loading branch information
keggsmurph21 committed Dec 20, 2019
1 parent e6895ba commit ceb0642
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions ultratrace2/model/files/loaders/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ class FileLoadError(Exception):


class FileLoaderBase(ABC):
@property
@abstractmethod
def path(self) -> str:
return self._path

def __init__(self, path: str):
self.path = path
@path.setter
def path(self, path) -> None:
self._path = path

def __repr__(self):
return f"{type(self).__name__}({self.path})"
Expand Down
2 changes: 1 addition & 1 deletion ultratrace2/model/files/loaders/dicom.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self, path: str, pixels: np.ndarray):
The `shape` of the pixel array should be `(n_frames, n_rows, n_columns)` for greyscale
images and `(n_frames, n_rows, n_columns, rgb_data)` for full-color images."""
super().__init__(path)
self.path = path
self.pixels = pixels
# FIXME: these should be in the `.ultratrace/` dir
self.png_dir = f"{self.path}-frames"
Expand Down

0 comments on commit ceb0642

Please sign in to comment.