When writing code such as:
firmware_log_files = list((settings.firmware_folder / "logs").iterdir())
router_log_files = list(settings.log_path.iterdir())
It makes it a bit hard to write it when an empty list is valid logic-wise, adding try blocks or adding is_dir
with intermediary variables for the /
operator.
Since the raise is not clear when the folder does not exist in the documentation, adding an argument such as check_dir
would make the code clear and the intended logic otherwise.
firmware_log_files = list((settings.firmware_folder / "logs").iterdir(check_dir=True))
router_log_files = list(settings.log_path.iterdir(check_dir=True))