Closed NickleDave closed 2 years ago
I am renaming this function but I'm not going to bother making it work across all formats because I will probably just factor out what it's doing anyway
The key issue here is that the function has side effects that are not explicit; it converts a list of paths to str, and the functions that currently call it depend on this behavior for other stuff they do, i.e. to iterate over the list and be able to treat each item in it as a str
But if I'm going to represent single annotation files as classes then there won't be any need for this kind of impenetrable special-cased control flow anyway
This function is not clearly named and may not be working correctly in all cases: https://github.com/NickleDave/crowsetta/blob/a6ec84fa93762a8ab9b4b063b65a51933e010892/src/crowsetta/validation.py#L67
_parse_file
could mean anything; what it actually does isvalidate_extension
, rename to something like thatnotmat2csv
andtextgrid2csv
; it works as intended when the input is a list of filenames. It is not called bykoumura2csv
oryarden2csv
. Note that both use only a single annotation file to represent annotations of multiple audio files. I tried to include it inyarden2csv
but got a weird error because it returns a list with just the single file name. Because it wraps any str or Path input in a list to iterate over and check. I then tried to fix this by just gettingannot_path[0]
only ifannot_path
is a list of length one, but this broke many tests so I removed it and did not pursue further. Tests fornotmat2csv
andtextgrid2csv
should test with a single file not just a list -- writing those tests might help reveal the root of the issue