Desired capability or behavior.
get_path currently completes a file with ".csv" if it can't find one with the right file extension. This is unhelpful as we have similarly named files (such as the legacy files vs. converted files), and now that those exist in the legacy folder I often see the converted file returned when I specifically asked to find the legacy file.
Suggested implementation.
get_path() should ONLY look for exact matches, including file extension. If it can't find an exact match, it needs to raise a FileNotFoundError.
get_model() should use this kind of behavior, since it is supposed to be limited to only the aviary/models folder and is designed to assist users trying to find the included models using only their name (they shouldn't need to care about filepath or file extension when using basic commands like run_mission).
For commands where we want that filling behavior, we can first use get_path() to see if the user provided a full valid filepath, then use get_model() if get_path() fails, finally raising the FileNotFoundError if that function fails too.
We probably will need to swap around where we are using get_path() and get_model in the codebase, as some tests, examples, and command utilities are probably relying on the extension completion capabilities of get_path()
Desired capability or behavior.
get_pathcurrently completes a file with ".csv" if it can't find one with the right file extension. This is unhelpful as we have similarly named files (such as the legacy files vs. converted files), and now that those exist in the legacy folder I often see the converted file returned when I specifically asked to find the legacy file.Suggested implementation.
get_path()should ONLY look for exact matches, including file extension. If it can't find an exact match, it needs to raise a FileNotFoundError.get_model()should use this kind of behavior, since it is supposed to be limited to only theaviary/modelsfolder and is designed to assist users trying to find the included models using only their name (they shouldn't need to care about filepath or file extension when using basic commands likerun_mission).For commands where we want that filling behavior, we can first use
get_path()to see if the user provided a full valid filepath, then useget_model()ifget_path()fails, finally raising the FileNotFoundError if that function fails too.We probably will need to swap around where we are using
get_path()andget_modelin the codebase, as some tests, examples, and command utilities are probably relying on the extension completion capabilities ofget_path()