Commits
89 89 | def push(self, file: AbstractFolder=None) -> None: |
90 90 | if not isinstance(file, AbstractFolder): |
91 91 | raise ValueError(f'cannot append {file.path}') |
92 92 | elif self.height() == self.max_height: |
93 93 | raise RuntimeError('stack is full') |
94 94 | else: |
95 95 | casalog.post(f'push {file.path} into the stack', 'DEBUG2') |
96 96 | self.stack.append(file) |
97 97 | |
98 98 | def pop(self) -> AbstractFolder: |
99 - | """Return the top of the stack. |
99 + | """Return and remove the top of the stack. |
100 100 | |
101 101 | The stack object should have input CasaImage or converted MeasurementSet at bottom, |
102 102 | so if pop() is called when stack height is zero, then it raises RuntimeError. |
103 103 | """ |
104 104 | if self.height() <= 1: |
105 105 | raise RuntimeError('the stack cannot pop') |
106 106 | return self.stack.pop() |
107 107 | |
108 108 | def peak(self) -> AbstractFolder: |
109 109 | """Return a pointer of the top of the stack.""" |