In csvpath/util/line_spooler.py, CsvLineSpooler.next() starts with:
def next(self):
if not self.path:
...
if Nos(self.path).exists() is False:
The "if not self.path: ..." line uses the Ellipsis placeholder as a no-op instead of an actual early return. to_list(), the sibling method right above it, handles the same situation correctly:
def to_list(self) -> list[str]:
if not self.path:
return []
Because next() does not return, when path is falsy it falls through to Nos(self.path).exists(), i.e. Nos(None).exists(). Nos.do raises ValueError("Do cannot be None. Path is: None") when path is None, since there is no backend to route to. So calling next() before a data file path is available raises ValueError instead of yielding nothing.
Left a TODO in next() (see branch test/util-line-monitor-io-spooler) rather than fixing directly, since this touches Result/instance-dir plumbing that intersects with run_home_maker.py, which David has flagged as sensitive and wants extra caution around. The TODO notes that the eventual fix should add a return type hint and return None (not []) for the no-path case, distinct from to_list(), though that may be reconsidered when this is revisited.
In csvpath/util/line_spooler.py, CsvLineSpooler.next() starts with:
The "if not self.path: ..." line uses the Ellipsis placeholder as a no-op instead of an actual early return. to_list(), the sibling method right above it, handles the same situation correctly:
Because next() does not return, when path is falsy it falls through to Nos(self.path).exists(), i.e. Nos(None).exists(). Nos.do raises ValueError("Do cannot be None. Path is: None") when path is None, since there is no backend to route to. So calling next() before a data file path is available raises ValueError instead of yielding nothing.
Left a TODO in next() (see branch test/util-line-monitor-io-spooler) rather than fixing directly, since this touches Result/instance-dir plumbing that intersects with run_home_maker.py, which David has flagged as sensitive and wants extra caution around. The TODO notes that the eventual fix should add a return type hint and return None (not []) for the no-path case, distinct from to_list(), though that may be reconsidered when this is revisited.